'xp_cryptofix.vbs - Correct the Cryptographic Service error 
'when trying to install HotFix KB823980.
'Modifications suggested by Drew Cooper of Microsoft
'02/11/04

Dim fso, WSHShell, WinSysDir, CatRoot2

Set WSHShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")

WinSysDir = WSHShell.RegRead("HKLM\Software\Microsoft\Windows NT\CurrentVersion\SystemRoot")
CatRoot2 = WinSysDir & "\System32\CatRoot2"

'Stop the Cryptographic Service
WshShell.Run("net stop cryptsvc")


'Delete the Catroot2 folder
fso.DeleteFolder(CatRoot2)

'Configure the Cryptographic service to start automatically
WshShell.Run("sc config cryptsvc start= auto")

'Restart the Service
WshShell.Run("net start cryptsvc")

'Re-register necessary DLL's, whether they need it or not.
WshShell.Run("regsvr32 wintrust.dll /s")
WshShell.Run("regsvr32 softpub.dll /s")
WshShell.Run("regsvr32 initpki.dll /s")
WshShell.Run("regsvr32 dssenh.dll /s")
WshShell.Run("regsvr32 rsaenh.dll /s")
WshShell.Run("regsvr32 gpkcsp.dll /s")
WshShell.Run("regsvr32 sccbase.dll /s")
WshShell.Run("regsvr32 slbcsp.dll /s")
WshShell.Run("regsvr32 cryptdlg.dll /s")

Set fso = Nothing
Set WshShell = Nothing
