'Fixes a scripting problem in the User accounts applet.
'More information available at the following site..
'For use with Windows® XP only.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'    http://windowsxp.mvps.org/useraccerror.htm
'    Copyright © 2005 Ramesh Srinivasan.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

strComputer = "."
DirtyFlags = "N"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\cimv2")
Set objProcess = objWMIService.Get("Win32_Process")
BasePath = objFSO.GetSpecialFolder(WindowsFolder) & "\system32\"

For Each fName In Array("wshom.ocx", "jscript.dll", "scrrun.dll")
	ModPath = BasePath & fName
	call Registrar (ModPath)
Next

fName = BasePath & "\mshtml.dll"
If objFSO.FileExists(fName) Then
	strCommand = "regsvr32 -i -s " & chr(34) & fName & chr(34)
	intReturn = objProcess.Create _
	    (strCommand, Null, objConfig, intProcessID)
End If

Sub Registrar(strFile)
	If objFSO.FileExists(strFile) Then
		strCommand = "regsvr32 -s " & chr(34) & strFile & chr(34)
		intReturn = objProcess.Create _
	    (strCommand, Null, objConfig, intProcessID)
	Else
		DirtyFlags = "Y"
	End If
End Sub

If DirtyFlags = "Y" Then
	CustMsg = "One or more of the scripting runtimes are missing. "
	CustMsg = CustMsg & "Download Windows Script 5.6 from from Microsoft site."
	MsgBox CustMsg, vbOKonly, "Fix User Accounts applet"
Else
	MsgBox "Done", vbOKonly, "Fix User Accounts applet"	
End If

Set objFSO = Nothing
Set objWMIService = Nothing
