# Copyright © 2012, Microsoft Corporation. All rights reserved. #*================================================================================ param($error) # Load Utilities . .\utils_SetupEnv.ps1 . .\cl_Service.ps1 . .\cl_windowsupdate.ps1 . .\cl_windowsversion.ps1 . .\cl_mutexverifiers.ps1 Import-LocalizedData -BindingVariable Res_GenWUError -FileName CL_LocalizationData cd "$env:windir\system32" #*================================================================================ # resets the CryptService # refers to the step 4 of the KB #*================================================================================ function resetWUSpecificServices(){ #-status $RS_ResetBits.ID_STATUS_STOP_SERVICE Write-DiagProgress -activity (($Res_GenWUError.ID_STATUS_STOP_SERVICE).Replace("%servicename%","CryptSvc")) # stop service CryptSvc &{ $stopService = Servicer "CryptSvc" "Stopped" # debug information if($stopService){ append-debugFile ("RES_GenWUError : CryptSvc is stopped") ($global:OutputReportFile) }else{ append-debugFile ("RES_GenWUWError : CryptSvc is not stopped") ($global:OutputReportFile) } } trap [Exception]{ [string]$str = ($DC_Strings.ID_ERROR_MSG_SERVICE).replace("%ServiceName%","CryptSvc") $str | convertto-xml | update-diagreport -id "RC_GenWUError" -name "$str" -verbosity informational } Write-DiagProgress -activity (($Res_GenWUError.ID_CLEAR_SERVICE).Replace("%servicename%","Bits")) sc.exe sdset bits "D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)" Write-DiagProgress -activity (($Res_GenWUError.ID_STATUS_START_SERVICE).Replace("%servicename%","CryptSvc")) # startServices "CryptSvc" &{ Fix-ServiceWithDebugFile "CryptSvc" ($global:OutputReportFile) "RES_GENWUError : " } trap [Exception]{ [string]$str = ($DC_Strings.ID_ERROR_MSG_SERVICE).replace("%ServiceName%","CryptSvc") $str | convertto-xml | update-diagreport -id "RC_GenWUError" -name "$str" -verbosity informational } } $components =@( "atl.dll","urlmon.dll","mshtml.dll","shdocvw.dll","browseui.dll","jscript.dll","vbscript.dll","scrrun.dll","msxml.dll","msxml3.dll","msxml6.dll","actxprxy.dll","softpub.dll","wintrust.dll","dssenh.dll","rsaenh.dll","gpkcsp.dll","sccbase.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") [int]$win7=61 [int]$winVista=60 [int]$winXP32bit=51 [int]$winXP64bit=52 [int]$winXpDownwardVersion=13 #*================================================================================ #Main #*================================================================================ function Main(){ Write-DiagProgress -activity (($Res_GenWUError.ID_STATUS_STOP_SERVICE).Replace("%servicename%","Bits")) $winVersion = checkWindowsVersion $stopService = Servicer "bits" "Stopped" # debug information if($stopService){ append-debugFile ("RES_GenWUError : Bits is stopped") ($global:OutputReportFile) }else{ append-debugFile ("RES_GenWUWError : Bits is not stopped") ($global:OutputReportFile) } if(Test-Path "$env:ALLUSERSPROFILE\Application Data\Microsoft\Network\Downloader\qmgr*.dat") { Remove-Item "$env:ALLUSERSPROFILE\Application Data\Microsoft\Network\Downloader\qmgr*.dat" -Force -ErrorAction SilentlyContinue } resetWUSpecificServices cd \ $pathSYS32 = $env:windir+"\system32" cd $pathSys32 foreach($comp1 in $components ){ regsvr32 $comp1 /s } if( ( $winversion -ge $WinVista ) ){ # windows vista or win7 or win8 netsh winhttp reset proxy } else #windows XP { netsh winsock reset proxycfg.exe -d } Write-DiagProgress -activity (($Res_GenWUError.ID_STATUS_START_SERVICE).Replace("%servicename%","Bits")) #-status $Res_GenWUError.ID_STATUS_START_SERVICE &{ Fix-ServiceWithDebugFile "bits" ($global:OutputReportFile) "RES_GENWUError : " } trap [Exception]{ [string]$str = ($DC_Strings.ID_ERROR_MSG_SERVICE).replace("%ServiceName%","bits") $str | convertto-xml | update-diagreport -id "RC_GenWUError" -name "$str" -verbosity informational } if( ( $winversion -ge $WinVista ) ){ # windows vista or win7 or win8 $cmd1 = "$env:windir\system32\bitsadmin.exe" $arg1 = "/reset" $arg2 = "/allusers" & $cmd1 $arg1 $arg2 } } #*================================================================================ #Resolve #*================================================================================ Main runningResolver "GenWUError" $error #*================================================================================ #End #*================================================================================