# Check OneDrive install location $onedriveInstallLocation = Get-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\OneDrive' -Name 'InstallLocation' | Select-Object -ExpandProperty 'InstallLocation' if ($onedriveInstallLocation) { Write-Host "OneDrive is installed in: $onedriveInstallLocation" # Run OneDrive with /reset command $onedriveExePath = Join-Path -Path $onedriveInstallLocation -ChildPath 'OneDrive.exe' if (Test-Path $onedriveExePath) { Write-Host "Running OneDrive with /reset command..." Start-Process -FilePath $onedriveExePath -ArgumentList '/reset' -Wait Write-Host "OneDrive reset completed." } else { Write-Host "OneDrive executable not found in the specified location." } } else { Write-Host "OneDrive is not installed on this machine." }