none
How to undo PowerShell script? (nevermind) RRS feed

  • Question

  • Edit: I've since reinstalled Windows.

    Hi, I used a Power Shell script to remove the Game Bar and some other components and now I want to reverse the changes, how do I do that? Below is a copy of the Power Shell script I originally used:

    (
    reg add "HKLM\System\CurrentControlSet\Services\xbgm" /v "Start" /t REG_DWORD /d "4" /f
    sc config XblAuthManager start= disabled
    sc config XblGameSave start= disabled
    sc config XboxGipSvc start= disabled
    sc config XboxNetApiSvc start= disabled
    schtasks /Change /TN "Microsoft\XblGameSave\XblGameSaveTask" /Disable
    takeown /f "%WinDir%\System32\GameBarPresenceWriter.exe" /a
    icacls "%WinDir%\System32\GameBarPresenceWriter.exe" /grant:r Administrators:F /c
    taskkill /im GameBarPresenceWriter.exe /f
    move "C:\Windows\System32\GameBarPresenceWriter.exe" "C:\Windows\System32\GameBarPresenceWriter.OLD"
    schtasks /Change /TN "Microsoft\XblGameSave\XblGameSaveTask" /Disable
    takeown /f "%WinDir%\System32\bcastdvr.exe" /a
    icacls "%WinDir%\System32\bcastdvr.exe" /grant:r Administrators:F /c
    taskkill /im bcastdvr.exe /f
    move C:\Windows\System32\bcastdvr.exe C:\Windows\System32\bcastdvr.OLD
    reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\GameDVR" /v "AppCaptureEnabled" /t REG_DWORD /d "0" /f
    reg add "HKCU\Software\Microsoft\GameBar" /v "UseNexusForGameBarEnabled" /t REG_DWORD /d "0" /f
    reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\GameDVR" /v "AudioCaptureEnabled" /t REG_DWORD /d "0" /f
    reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\GameDVR" /v "CursorCaptureEnabled" /t REG_DWORD /d "0" /f
    reg add "HKCU\Software\Microsoft\GameBar" /v "ShowStartupPanel" /t REG_DWORD /d "0" /f
    reg add "HKCU\System\GameConfigStore" /v "GameDVR_Enabled" /t REG_DWORD /d "0" /f
    reg add "HKLM\Software\Policies\Microsoft\Windows\GameDVR" /v "AllowgameDVR" /t REG_DWORD /d "0" /f
    reg add "HKCU\Software\Microsoft\GameBar" /v "AllowAutoGameMode" /t REG_DWORD /d "0" /f
    )

    I've made numerous attempts to undo the changes and all of them failed.


    Windows 10 Pro x64 | Intel Core i7 920 @ 3.6GHZ | ASUS P6T Motherboard | 24GB DDR3 RAM | MSI Gamer 1070Ti | Corsair Ax760 Power Supply | Fractal Design Define R5 Computer Case



    Monday, August 26, 2019 7:21 AM

All replies

  • Hi,

    Thanks for your question.

    Firstly, your script is not a powershell script. It use some cmd tool and commands.

    You can't Undo scripts that have already been executed.Your script add some registry key and some actions.

    Try to rewrite the script that does the opposite. Also, be careful to run scripts downloaded from the web.

    Best regards,

    Lee


    Just do it.

    Monday, August 26, 2019 8:22 AM