Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save swaters86/f3e9b7d0e4e7557092713112ed952a81 to your computer and use it in GitHub Desktop.
Save swaters86/f3e9b7d0e4e7557092713112ed952a81 to your computer and use it in GitHub Desktop.
#set-executionpolicy unrestricted
$wshell = New-Object -ComObject wscript.shell;
$wshell.AppActivate('title of the application window')
Sleep 1
# stopping Bit service
$nbStopCommand1 = {net stop bits}
$nbStopCommand2 = {net stop wuauserv}
$nbStopCommand3 = {net stop appidsvc}
$nbStopCommand4 = {net stop cryptsvc}
Invoke-Command $nbStopCommand1
Invoke-Command $nbStopCommand2
Invoke-Command $nbStopCommand3
Invoke-Command $nbStopCommand4
Invoke-Command Del "%ALLUSERSPROFILE%\Microsoft\Network\Downloader\qmgr*.dat"
Invoke-Command Ren %systemroot%\SoftwareDistribution SoftwareDistribution.bak
Invoke-Command Ren %systemroot%\system32\catroot2 catroot2.bak
# reset bit service
<#
Invoke-Command sc.exe sdset bits D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)
Invoke-Command sc.exe sdset wuauserv D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU
#>
Invoke-Command cd /d %windir%\system32
$dlls = @(
"urlmon.dll",
"mshtml.dll",
"shdocvw.dll",
"browseui.dll",
"jscript.dll",
"vbscript.dll",
"scrun.dll",
"msxml.dll",
"msxml3.dll",
"msxml6.dll",
"actxprxy.dll",
"softpub.dll",
"wintrust.dll",
"dssenh.dll",
"rsaenh.dll",
"gpkcsp.dll",
"scbase.dll",
"slbcsp.dll",
"cryptdlg.dll",
"oleaut32.dll",
"ole32.dll",
"shell32.dll",
"initpki.dll",
"wuapi.dll",
"wuaueng.dll",
"wuaueng1.dll",
"wucltui.dll",
"wups.dll",
"wups2.dll",
"wuweb.dll",
"qmgr.dll",
"qmgrprxy.dll",
"wucltux.dll",
"muweb.dll",
"wuwebv.dll"
)
For ($i=0; $i -lt $dlls.Length; $i++) {
Invoke-Command regsvr32.exe $dlls[$i] /s
}
Invoke-Command netsh winsock reset
# stopping Bit service
$nbStartCommand1 = {net start bits}
$nbStartCommand2 = {net start wuauserv}
$nbStartCommand3 = {net start appidsvc}
$nbStartCommand4 = {net start cryptsvc}
Invoke-Command $nbStartCommand1
Invoke-Command $nbStartCommand2
Invoke-Command $nbStartCommand3
Invoke-Command $nbStartCommand4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment