Skip to content

Instantly share code, notes, and snippets.

@SmugZombie
Created September 16, 2016 17:30
Show Gist options
  • Save SmugZombie/479fc18d867bf27fcfd5098e380b4d87 to your computer and use it in GitHub Desktop.
Save SmugZombie/479fc18d867bf27fcfd5098e380b4d87 to your computer and use it in GitHub Desktop.
Fixes OneDrive Credential Issues after Password Change
@echo off
REM Carlos script to fix OneDrive
REM Used to fix OneDrive after a password change
REM to verify saved creds are deleted: rundll32.exe keymgr.dll, KRShowKeyMgr
echo.
echo Open Excel, Word, and signout from your Office 365 Account, then continue
echo.
pause
REM Carlos script to fix OneDrive
REM to verify saved creds are deleted: rundll32.exe keymgr.dll, KRShowKeyMgr
taskkill /IM "groove.exe" /F
taskkill /IM "msosync.exe" /F
taskkill /IM "msouc.exe" /F
taskkill /IM OneDrive.exe /F
taskkill /IM "ONENOTEM.EXE" /F
tskill OneNote
RMDIR "%UserProfile%\AppData\Local\Microsoft\Office\Spw" /S /Q
RMDIR "%UserProfile%\AppData\Local\Microsoft\Office\14.0\OfficeFileCache" /S /Q
RMDIR "%UserProfile%\AppData\Local\Microsoft\Office\15.0\OfficeFileCache" /S /Q
RMDIR "%UserProfile%\AppData\Local\Microsoft\Office\16.0\OfficeFileCache" /S /Q
setlocal
set Filter=MicrosoftOffice16_Data:
for /f "tokens=1*" %%a in ('cmdkey.exe /list ^| find /i "%Filter%"') do (
echo Removing credentials for target '%%~b'
cmdkey.exe /delete:"%%~b"
)
setlocal
set Filter=MicrosoftOffice15_Data:
for /f "tokens=1*" %%a in ('cmdkey.exe /list ^| find /i "%Filter%"') do (
echo Removing credentials for target '%%~b'
cmdkey.exe /delete:"%%~b"
)
echo.
echo.
echo copy this path and save it https://<sharepointdomain>.sharepoint.com/personal/firstname_lastname_<domain>_com/Documents
echo You need to reboot computer. Open IE, sign in to O365 (select keep me logged in)
echo Do the same for Sharepoint
echo open Word and sign in with Office account.
exit from OneDrive and run it as an admin
echo.
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment