Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 701
  • Last Modified:

Vbscript to automate fixing of svchost.exe issue

VBscript to reregister the following DLL's.  When you register each one individually a messsage pops up telling you the registration was successful.  I would still like to know if all the dll's registered successfully.

REGSVR32 WUAPI.DLL
REGSVR32 WUAUENG.DLL
REGSVR32 WUAUENG1.DLL
REGSVR32 ATL.DLL
REGSVR32 WUCLTUI.DLL
REGSVR32 WUPS.DLL
REGSVR32 WUPS2.DLL
REGSVR32 WUWEB.DLL

Then a separate script to run:

net stop WuAuServ

Go to c:\windows\

Rename the folder SoftwareDistribution to SDold

net start WuAuServ

Notify if successful for the above steps also.

Thanks

0
kapara
Asked:
kapara
1 Solution
 
PberSolutions ArchitectCommented:
How about via a batch:

@echo off
regsvr32 WUAPI.DLL /s
IF %errorlevel%==0 Goto STEP1
echo WUAPI.DLL register failed
goto CONT1
:STEP1
echo WUAPI.DLL register SUCCESS
:CONT1

regsvr32 WUAUENG.DLL /s
IF %errorlevel%==0 Goto STEP2
echo WUAUENG.DLL register failed
goto CONT2
:STEP2
echo WUAUENG.DLL register SUCCESS
:CONT2

regsvr32 WUAUENG1.DLL /s
IF %errorlevel%==0 Goto STEP3
echo WUAUENG1.DLL register failed
goto CONT3
:STEP3
echo WUAUENG1.DLL register SUCCESS
:CONT3

regsvr32 ATL.DLL /s
IF %errorlevel%==0 Goto STEP4
echo ATL.DLL register failed
goto CONT4
:STEP4
echo ATL.DLL register SUCCESS
:CONT4

regsvr32 WUCLTUI.DLL /s
IF %errorlevel%==0 Goto STEP5
echo WUCLTUI.DLL register failed
goto CONT5
:STEP5
echo WUCLTUI.DLL register SUCCESS
:CONT5

regsvr32 WUPS.DLL /s
IF %errorlevel%==0 Goto STEP6
echo WUPS.DLL register failed
goto CONT6
:STEP6
echo WUPS.DLL register SUCCESS
:CONT6

regsvr32 WUPS2.DLL /s
IF %errorlevel%==0 Goto STEP7
echo WUPS2.DLL register failed
goto CONT7
:STEP7
echo WUPS2.DLL register SUCCESS
:CONT7

regsvr32 WUWEB.DLL /s
IF %errorlevel%==0 Goto STEP8
echo WUWEB.DLL register failed
goto CONT8
:STEP8
echo WUWEB.DLL register SUCCESS
:CONT8

net stop WuAuServ
c:
cd\windows
ren SoftwareDistribution SDold
IF %errorlevel%==0 Goto STEP10
echo SoftwareDistribution rename failed
goto CONT10
:STEP10
echo SoftwareDistribution rename SUCCESS
:CONT10

net start WuAuServ

0
 
RobSampsonCommented:
You can try this VBS file as well:
'=============
arrFiles = Array("WUAPI.DLL", "WUAUENG.DLL", "WUAUENG1.DLL", "ATL.DLL", "WUCLTUI.DLL", "WUPS.DLL", "WUPS2.DLL", "WUWEB.DLL")
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
For intCount = LBound(arrFiles) To UBound(arrFiles)
      intErrCode = objShell.Run "regsvr32 /s " & arrFiles(intCount), 1, True
      If intErrCode <> 0 Then      MsgBox "Registration of " & arrFiles(intCount) & " failed."
Next
objShell.Run "net stop WuAuServ", 0, True
If objFSO.FolderExists("C:\Windows\SDOld") Then
      objFSO.DeleteFolder "C:\Windows\SDOld", True
End If
objFSO.MoveFolder "C:\Windows\SoftwareDistribution", "C:\Windows\SDOld"
objShell.Run "net start WuAuServ", 0, True
MsgBox "Done:
Set objFSO = Nothing
Set objShell = Nothing
'=========

Regards,

Rob.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now