Workspace-Guru

install-OneDrive

Jun 12th, 2018
14,061
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ### User Parameters
  2. $OneDriveSetupPath = "C:\TEMP\OneDriveSetup.exe" ### Change to location of OneDriveSetup.exe
  3.  
  4. ### Script Parameters
  5. $user = $env:USERNAME
  6. $OneDrivePath = "C:\Users\$user\AppData\Local\Microsoft\OneDrive\OneDrive.exe"
  7.  
  8. ### Check OneDrive and Install or startup
  9. $testPath = Test-Path $OneDrivePath
  10.  
  11. if (!$testPath){
  12. $arguments = "/Silent"
  13. $process = Start-Process -FilePath "$OneDriveSetupPath" -ArgumentList $arguments -Wait -PassThru -NoNewWindow
  14. Start-Process -FilePath $OneDrivePath
  15. } else {
  16. Start-Process -FilePath $OneDrivePath -ArgumentList "/background"}
Advertisement
Add Comment
Please, Sign In to add comment