PowerShell CmdLet to check OneDrive for Business or OneDrive Personal Status


My good friend Neil Hodgkinson gave me a challenge: some partners and companies were asking him how to verify the status of OneDrive. He gave me the idea to check the icon of the OneDrive folder and depending on the icon, tell the status. I created a proof-of-concept and then helped some folks at Microsoft Consulting Services to have a PowerShell cmdlet to do so. Not being enough the status of OneDrive using the regular OneDrive synchronization, I also included the status of OneDrive when synchronized via Groove (yes, people still use it).

The project is open source and available in GitHub. To get only the PowerShell cmdlet, download OneDriveLib.dll here. License is MIT and can be found here. It is an open source project so it is not entitled for Microsoft support but I will do my best to respond questions in this post. Just ask them in comments.


How to use:

  • Open PowerShell is normal mode (it will not work in Elevated mode for OneDrive own design)
  • Import the module OneDriveLib.dll
  • Run Get-ODStatus



Get-ODStatus [-Type <type-pattern>] [-ByPath <path>]



-Type <type-pattern> let you filter by OneDrive type (e.g. Personal or Business) [optional]

-ByPath <path> if the folder information is not in the registry you can test a particular folder (this form will return only a status string)



Get-ODStatus –Type Business

Get-ODStatus –ByPath c:\user\rodneyviana\onedrive


Example of output

PS C:\ODTool>; Import-Module OneDriveLib.dll
PS C:\ODTool>; Get-ODStatus
StatusString : UpToDate
LocalPath    : E:\MicrosoftOnedrive\OneDrive - Contoso
UserSID      : S-1-5-21-124012345-708012345-1543012345-802000
UserName     : CONTOSO\rodneyviana
ServiceType  : Business1
StatusString : UpToDate
LocalPath    : D:\Onedrive
UserSID      : S-1-5-21-124012345-708012345-1543012345-802000
UserName     : CONTOSO\rodneyviana
ServiceType  : Personal
Comments (17)

  1. Saqlain Tahir says:

    It’s great and will be very helpful for my customers

  2. Thanks, great to have this. Just as a side note, in order to use the DLL, make sure you UNBLOCK it via the properties of the file. Basically right click, select unblock and apply. Close and re-open your PowerShell and then follow the instructions.

    1. Rocky says:

      Scott, thanks for the tip. I just ran import-module and got the error saying the dll is missing. Doh!

  3. Scott says:

    What is it’s intended return for Work Folders?

  4. Gareth says:

    Hey, This is exactly what we are looking for. However as novices require a little guidance on the setup? Ive downloaded the full project but dont understand where to save the files to and successfully run the commands. Please help!

  5. Dan says:

    Thanks for this. Can you help provide more details on StatusString, like what would be the expected output if user are syncing their Personal OneDrive on their PC or laptop?

    1. Possible values:
      public enum ServiceStatus

  6. Sasa says:

    I use that module and got status for all client but several. On several pc’s I don’t get any results. (win10). Do you have any idea?

    1. You may need to unblock the DLL.
      In Windows Explorer see the DLL properties
      Check ‘Unblock’

  7. Roberto says:

    Is great however Get-ODstatus only show me personal information and not the business even if I use the -Type. When I specify -ByPath I can have the business information. Do you have any idea what can be the cause ?

    1. It will show personal (OneDrive) and Business (OneDrive for Business). Per OneDrive design it will only show information about your user. Also per design it will not work if you run in elevated privileges. Not my rules.

  8. Chris Webb says:

    So how are you guys going about deploying this? I’m assuming every machine has to have this dll and the command run on it?

    1. Hi Chris,

      You are correct. It has to be local and it has to run in user context. It will not work in non-interactive way (like a service for example) and it will not work in elevated privileges. OneDrive requirements.

  9. Stuart Landells says:

    Has anyone been able to apply where-object filtering (or any other) to the output?
    I’ve tried all sorts of things and must just be having a moment, or it simply doesn’t work. I either get all results back regardless of the filter, or no results back. Nothing in between.
    There are some Dropbox accounts on the machines being scanned, and it actually picks those up too 🙂
    Get-ODStatus –Type Business | where {$_.LocalPath -like ‘*OneDrive*’} = Everything Business
    Get-ODStatus –Type Business | where {$_.ServiceType -like ‘Business1’} = Everything Business
    Get-ODStatus –Type Business | where {$_.StatusString -eq “UpToDate”} = Everything Business, even tho only one has that status.

  10. uday says:


    is not giving any output.
    Not even,

    Get-ODStatus -Type Business

Skip to main content