Script to get EmailID and Force OneDrive Signin

Copper Contributor

Hello Team,

In my Organization we have rolled out OneDrive for Business. We are controlling the OneDrive silent Login using GPOs.

There are 1000+ users having different samaccount and EmailID, so Single sign on is not working.

We used a Powershell script to fetch the emailID and force the OneDrive login which was working fine, but Powershell is restircted for a OU where we unable to use this PS script.

Query: Anyone have VB script or Batch file to fetch the current logged on user email ID and force the OneDrive to Login? Kindly assit.

4 Replies

So if I get it right, powershell is being blocked on a specific OU. Maybe converting the ps1 to an exe .

@Rudy_Ooms_MVP  Thanks a Lot Rudy. Let me give a try and Update.


Meanwhile, I have lot of users who are installed with OneDrive, but to Onedrive not autostarted, they never synced their files. Is there a way to Start the OneDrive app remotely either using SCCM or AD. Please help.

You could script the automatic sign in with their azure ad credentials of course, also make sure you skip the wizard etc .. and you run place a shortcut in the programs\startup folder to make sure onedrive is started when starting windows

Hi Julie, are you able to share the script you use to force signin?

I would normally just use Azure SSO and the native GPO or Intune config but i have a scenario where i can't do that