rodneyviana / ODSyncService

OneDrive service/DLL for Sync State
MIT License
93 stars 26 forks source link

Non-interactive mode detected #40

Closed r3aLLL closed 1 year ago

r3aLLL commented 1 year ago

I've integrated this Module into a PS script that - in short - will take the output, parse it, and if errors are found it will notify our helpdesk of errors. It is working great on every machine I've set it up on so far except this on one particular machine. I've tried manually running the command on the problem machine and Get-ODStatus is returning the following error:

Get-ODStatus : Non-Interactive mode detected. OneDrive Status can only be checked interactively unless -OnDemandOnly is specified
At line:1 char:1
+ Get-ODStatus
+
  + CategoryInfo          : NotSpecified: (:) [Get-ODStatus], InvalidOperationException
  + FullyQualifiedErrorId : System.InvalidOperationException,OneDriveLib.GetStatus

I've tried adding -OnDemandOnly to the end of the Get-ODStatus command but then no output is given. I'm not sure if this is an error message indicating an issue with the individual's OneDrive installation or something else, but I am open to suggestions of what might be causing this and how to resolve.

Thank you!

rodneyviana commented 1 year ago

You cannot run in mode that is not interactive (the user session). If you running as a windows task make sure you run in interactive mode with the user logged in. This is a OneDrive security restriction to avoid a spyware from peeking at someone’s OneDrive content. What do you get if you run it from the PowerShell console?

r3aLLL commented 1 year ago

Okay, it looks like I misidentified the real issue on this. I was able to get connected to the computer as the user and confirmed the Get-ODStatus command worked as expected when running it that way. Because of that I scrapped any assumptions I had and tried running the Get-ODStatus command from our RMM tool on another PC that the script was working on and I got the same error. So this specific error seems to be just due to trying to run it directly from the RMM's PS.

The original issue that got me here is the output file for Get-ODStatus is coming out empty (from there I tried running the command manually and ran into the above error, which we not know is not relevant). I started racking my brain about what might be different about this user or computer and I realized the user has administrator access. I believe since the user has administrator access the script is running as admin, causing the expected error to pop up and the file output to be empty.

I'm closing this issue but wanted to thank you for getting back to me on this and for making such a useful tool.