Coder Social home page Coder Social logo

alecmccutcheon / get-cuonedrivestatus Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 30 KB

A compatibility wrapper function for Rodneyviana's "Get-ODStatus" to allow run as (User, Admin. or System)

PowerShell 100.00%
compatibility current-user function onedrive powershell

get-cuonedrivestatus's Introduction

Get-CUOneDriveStatus

A function that grabs the latest version of Rodneyviana's "Get-ODStatus" function and uses My "PSRunAsCurrentUser" function as a compatibility layer of sorts. Which allows it to work as the (User, Admin or even System) account. Note: If you are running it as Administrator or System, keep in mind that a user must be logged into the machine in order for this to work.

Use the following One-liner to Import the function into the current session:

iex ((New-Object System.Net.WebClient).DownloadString("https://rawcdn.githack.com/AlecMcCutcheon/Get-CUOneDriveStatus/d3e33050af3d83b9a734a57908e93207a5958379/Get-CUOneDriveStatus.ps1"));

Usage:

As System:

PS C:\WINDOWS\system32> iex ((New-Object System.Net.WebClient).DownloadString("https://rawcdn.githack.com/AlecMcCutcheon/Get-CUOneDriveStatus/d3e33050af3d83b9a734a57908e93207a5958379/Get-CUOneDriveStatus.ps1"));

PS C:\WINDOWS\system32> (New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator);
True

PS C:\WINDOWS\system32> whoami;
nt authority\system

PS C:\WINDOWS\system32> (Get-CUOneDriveStatus).StatusString;
Up to date
Up to date

PS C:\WINDOWS\system32> (Get-CUOneDriveStatus -Type Business).UserName
AzureAD\AlecMcCutcheon

As User:

PS C:\Users\AlecMcCutcheon\Desktop> iex ((New-Object System.Net.WebClient).DownloadString("https://rawcdn.githack.com/AlecMcCutcheon/Get-CUOneDriveStatus/d3e33050af3d83b9a734a57908e93207a5958379/Get-CUOneDriveStatus.ps1"));

PS C:\Users\AlecMcCutcheon\Desktop> (New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator);
False

PS C:\Users\AlecMcCutcheon\Desktop> whoami
azuread\alecmccutcheon

PS C:\Users\AlecMcCutcheon\Desktop> (Get-CUOneDriveStatus).StatusString;
Up to date
Up to date

PS C:\Users\AlecMcCutcheon\Desktop> (Get-CUOneDriveStatus -Type Business).UserName
AzureAD\AlecMcCutcheon

Syntax:

"Get-CUOneDriveStatus" is basicly just a compatibility wrapper for "Get-ODStatus", so all of the same parameters for the original can be used as you would expect.

Get-CUOneDriveStatus [-Type <type-Name>] [-ByPath <path>] [CLSID <guid>]
             [-IncludeLog] [-Verbose] [-ForceFallback]

Or
Get-CUOneDriveStatus -OnDemandOnly [-Type <type-Name>] [-IncludeLog] [-Verbose] [-ForceFallback]

Where:

-Type <type>       Only returns if Service Type matches <type>
                   Example: Get-CUOneDriveStatus -Type Personal

-ByPath <path>     Only checks a particular folder or file status
                   Example: Get-CUOneDriveStatus -Path "$env:OneDrive\docs"

-CLSD <guid>       Verify only a particular GUID (not used normally)
                   Example: Get-CUOneDriveStatus -CLSD A0396A93-DC06-4AEF-BEE9-95FFCCAEF20E

-IncludeLog        If present will save a log file on the temp folder

-Verbose           Show verbose information

-OnDemandOnly      Normally On Demand is only tested as a fallback, when
                   -OnDemandOnly is present it goes directly to 
                   On Demand status. This may resolve flicker issues

-ForceFallback     Parameter from the "PSRunAsCurrentUser" function. 
                   See "https://github.com/AlecMcCutcheon/PSRunAsCurrentUser" for info

Alias:

Get-CUODStatus

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.