Is there any way to get the sync status using PowerShell Script?

%3CLINGO-SUB%20id%3D%22lingo-sub-699119%22%20slang%3D%22en-US%22%3ERe%3A%20Is%20there%20any%20way%20to%20get%20the%20sync%20status%20using%20PowerShell%20Script%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-699119%22%20slang%3D%22en-US%22%3ETheres%20no%20way%20out%20of%20the%20box!%3CBR%20%2F%3E%3CBR%20%2F%3EYou%20can%20use%20the%20onedrivelib.dll%20to%20fetch%20some%20information%20via%20a%20script%20and%20it%E2%80%99s%20a%20bit%20tricky%20to%20get%20it%20to%20run%20remotely%3CBR%20%2F%3E%3CBR%20%2F%3EPossible%20values%3A%3CBR%20%2F%3EError%2C%20Shared%2C%20SharedSync%2C%20UpToDate%2C%20Syncing%2C%20ReadOnly%2C%20NotInstalled%3CBR%20%2F%3E%3CBR%20%2F%3ESee%20here%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fblogs.msdn.microsoft.com%2Frodneyviana%2F2017%2F06%2F06%2Fpowershell-cmdlet-to-check-onedrive-for-business-or-onedrive-personal-status%2F%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fblogs.msdn.microsoft.com%2Frodneyviana%2F2017%2F06%2F06%2Fpowershell-cmdlet-to-check-onedrive-for-business-or-onedrive-personal-status%2F%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EAnd%20here%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fwww.intrust-it.com%2F2017%2F11%2F17%2Fcentrally-monitor-microsoft-onedrive-sync-status%2F%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fwww.intrust-it.com%2F2017%2F11%2F17%2Fcentrally-monitor-microsoft-onedrive-sync-status%2F%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EAdam%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-699229%22%20slang%3D%22en-US%22%3ERe%3A%20Is%20there%20any%20way%20to%20get%20the%20sync%20status%20using%20PowerShell%20Script%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-699229%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F72542%22%20target%3D%22_blank%22%3E%40adam%20deltinger%3C%2FA%3E%26nbsp%3BI%20aleady%20saw%20this%20url%20and%20tried%20following%20script%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EImport-Module%20%22.%5COneDriveLib.dll%22%3C%2FP%3E%3CP%3EGet-ODStatus%20-ByPath%20%24env%3AOneDrive%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGetting%20Syncing%20or%20OneDemandOruknown%20during%20syncing.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHow%20to%20check%20in%20script%20that%20once%20status%20is%20%3CSTRONG%3EUptoDate%20%3C%2FSTRONG%3Estatus%2C%20script%20should%20terminate%20especially%20when%20user%20is%20syncing%20first%20time%20and%20data%20size%20is%20large.%20I%20dont%20think%20running%20in%20infinite%20loop%20is%20good%20idea.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20advise.%3C%2FP%3E%3CP%3EAvian%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-699238%22%20slang%3D%22en-US%22%3ERe%3A%20Is%20there%20any%20way%20to%20get%20the%20sync%20status%20using%20PowerShell%20Script%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-699238%22%20slang%3D%22en-US%22%3EI%20think%20i%20read%20somewhere%20%2C%20this%20breaks%20if%20FOD%20is%20used%20though..%3CBR%20%2F%3E%3CBR%20%2F%3EI%20guess%20writing%20some%20sort%20of%20IF%20statement%20depending%20on%20status%20would%20help!%3CBR%20%2F%3E%3CBR%20%2F%3EWhat%E2%80%99s%20your%20usecase%20here%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-699304%22%20slang%3D%22en-US%22%3ERe%3A%20Is%20there%20any%20way%20to%20get%20the%20sync%20status%20using%20PowerShell%20Script%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-699304%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F72542%22%20target%3D%22_blank%22%3E%40adam%20deltinger%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20created%20script%20where%20I%20am%20initiating%20ODB%20wizard%2C%20once%20user%20completed%20the%20wizard%20thne%20copying%20the%20contents%20automatically%20from%20file%20server%20to%20user%20local%20OneDrive%20cache%20folder.%20Once%20contents%20is%20copied%2C%20add%20a%20record%20with%20copy%20completion%20status%20in%20dashboardlog%20which%20is%20exist%20in%20one%20common%20repository.%20This%20script%20pushing%20thru%20SCCM%2C%20this%20will%20run%20only%20once.%20This%20is%20implemented%20for%20so%20many%20users.%20Now%20I%20want%20to%20track%20the%20sync%20status%20for%20each%20user.%20Once%20sync%20is%20completed%20then%20I%20can%20update%20in%20dashboardlog.%20I%20want%20this%20activity%20should%20be%20part%20of%20above%20script.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ELet%20me%20know%20if%20you%20have%20some%20better%20idea.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20you%20share%20some%20more%20information%20that%20Get-ODStatus%20is%20failed%20if%20FOD%20is%20enabled%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CP%3EAvian%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-699443%22%20slang%3D%22en-US%22%3ERe%3A%20Is%20there%20any%20way%20to%20get%20the%20sync%20status%20using%20PowerShell%20Script%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-699443%22%20slang%3D%22en-US%22%3ECan%E2%80%99t%20seem%20to%20find%20it%2C%20so%20ignore%20that%20part%20for%20now%20%3A)%3C%2Fimg%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-699475%22%20slang%3D%22en-US%22%3ERe%3A%20Is%20there%20any%20way%20to%20get%20the%20sync%20status%20using%20PowerShell%20Script%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-699475%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F72542%22%20target%3D%22_blank%22%3E%40adam%20deltinger%3C%2FA%3E%26nbsp%3BI%20found%20it.%20Check%20this%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Frodneyviana%2FODSyncService%2Fissues%2F3%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Frodneyviana%2FODSyncService%2Fissues%2F3%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20sync%20is%20completed%20now%20it%20is%20showing%20status%20as%20%3CSTRONG%3EOnDemandorUnknown%3C%2FSTRONG%3E%20instead%20on%20%3CSTRONG%3EUptoDate%3C%2FSTRONG%3E.%20As%20per%20the%20above%20link%20other%20user%20is%20also%20noticed%20same.%20See%20the%20June%2014th%20Post.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAvian%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-699751%22%20slang%3D%22en-US%22%3ERe%3A%20Is%20there%20any%20way%20to%20get%20the%20sync%20status%20using%20PowerShell%20Script%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-699751%22%20slang%3D%22en-US%22%3EHave%20you%20checked%20ODFB%20usage%20reports%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-699812%22%20slang%3D%22en-US%22%3ERe%3A%20Is%20there%20any%20way%20to%20get%20the%20sync%20status%20using%20PowerShell%20Script%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-699812%22%20slang%3D%22en-US%22%3EAFAIK%20there%20are%20no%20sync%20status%20parameters%20in%20there%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-699065%22%20slang%3D%22en-US%22%3EIs%20there%20any%20way%20to%20get%20the%20sync%20status%20using%20PowerShell%20Script%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-699065%22%20slang%3D%22en-US%22%3E%3CP%3EHello%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20any%20way%20to%20get%20the%20sync%20status%20using%20PowerShell%20Script%20if%20user%20is%20doing%20syncing%20first%20time%20%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAvian%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-699065%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EOneDrive%20for%20Business%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1154581%22%20slang%3D%22en-US%22%3ERe%3A%20Is%20there%20any%20way%20to%20get%20the%20sync%20status%20using%20PowerShell%20Script%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1154581%22%20slang%3D%22en-US%22%3EThere%20are%20uservoice%20request%20for%20this%20simple%20feature%20to%20a%20simple%20solution%20but%20not%20evwn%20a%20We%20are%20looking%20into%20it%20from%20microsoft.%20It%20is%20almost%20like%20they%20are%20happy%20there%20is%20one%20or%20two%20third%20party%20vendor%20selling%20this%20I%20am%20sure%20not%20for%20a%20nickle.%3C%2FLINGO-BODY%3E
Highlighted
Frequent Contributor

Hello

 

Is there any way to get the sync status using PowerShell Script if user is doing syncing first time ?

 

Avian

9 Replies
Highlighted
Theres no way out of the box!

You can use the onedrivelib.dll to fetch some information via a script and it’s a bit tricky to get it to run remotely

Possible values:
Error, Shared, SharedSync, UpToDate, Syncing, ReadOnly, NotInstalled

See here:

https://blogs.msdn.microsoft.com/rodneyviana/2017/06/06/powershell-cmdlet-to-check-onedrive-for-busi...

And here:

https://www.intrust-it.com/2017/11/17/centrally-monitor-microsoft-onedrive-sync-status/

Adam
Highlighted

@adam deltinger I aleady saw this url and tried following script

 

Import-Module ".\OneDriveLib.dll"

Get-ODStatus -ByPath $env:OneDrive

 

Getting Syncing or OneDemandOruknown during syncing.

 

How to check in script that once status is UptoDate status, script should terminate especially when user is syncing first time and data size is large. I dont think running in infinite loop is good idea.

 

Please advise.

Avian

Highlighted
I think i read somewhere , this breaks if FOD is used though..

I guess writing some sort of IF statement depending on status would help!

What’s your usecase here?
Highlighted

@adam deltinger 

 

I created script where I am initiating ODB wizard, once user completed the wizard thne copying the contents automatically from file server to user local OneDrive cache folder. Once contents is copied, add a record with copy completion status in dashboardlog which is exist in one common repository. This script pushing thru SCCM, this will run only once. This is implemented for so many users. Now I want to track the sync status for each user. Once sync is completed then I can update in dashboardlog. I want this activity should be part of above script.

 

Let me know if you have some better idea.

 

Can you share some more information that Get-ODStatus is failed if FOD is enabled?

 

Thanks

Avian

Highlighted
Can’t seem to find it, so ignore that part for now :)
Highlighted

@adam deltinger I found it. Check this

https://github.com/rodneyviana/ODSyncService/issues/3

 

My sync is completed now it is showing status as OnDemandorUnknown instead on UptoDate. As per the above link other user is also noticed same. See the June 14th Post.

 

Avian

Highlighted
Have you checked ODFB usage reports?
Highlighted
AFAIK there are no sync status parameters in there
Highlighted
There are uservoice request for this simple feature to a simple solution but not evwn a We are looking into it from microsoft. It is almost like they are happy there is one or two third party vendor selling this I am sure not for a nickle.