We have had a problem recently where users have had a corrupt registry hive for the MS office 2002 application.
When the user logs onto the terminal server the import of the corrupt hive blue screens the server.
We use Appsense Environment Manager to manage our hybrid profiles. Appsense uses Microsoft API's to load the profile and so are unable to offer a fix for this problem.
As a temproary measure while we search for a more permanent fix we are using the following scripts to perform an overnight scan of users registry keys to check for corruption. The script makes use of the microsoft CHKREG.EXE utility.
The first script read a list of user names to check from a users.txt input file.
The path to users profiles should be ameneded as required in the first script.
The 2nd script performs the actual scan. It has a wait timer in it of around 5 seconds. If the CHKREG takes longer than this to complete then we flag that registry
as likely to be corrupt. You may need to adjust this timeout value for your environment.
Script 1. Checker.vbs
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objFileSystem = CreateObject("Scripting.fileSystemObject")
Set objInputFile = objFileSystem.OpenTextFile("users.txt",1)
Set ObjOutPutFile = objFileSystem.CreateTextFile("Bad_Hives.txt",True)
ObjOutPutFile.Close
Do Until objInputFile.AtEndOfStream
strData = objInputFile.ReadLine
StrPath = "%comspec% /c chkreg.exe /F \\profilepath\users\" & StrData & "\hybridprofile\office\Software{;bks}Microsoft{;bks}Office{;bks}10{;dot}0{;bks}Word.UK_" & StrData
StrValidPath = "\\profilepath\users\" & StrData & "\hybridprofile\office\Software{;bks}Microsoft{;bks}Office{;bks}10{;dot}0{;bks}Word.UK_" & StrData
StrPath = "%comspec% /c chkreg.exe /F " & StrValidPath
If objFileSystem.FileExists(StrValidPath) Then
StrCommand = "CMD /C wscript.exe Check.vbs " & StrData & " " & StrValidPath
Set OExec = WshShell.Exec(StrCommand)
Do While Oexec.status = 0
Wscript.sleep 100
Loop
End If
Loop
Msgbox "Script Complete"
Script 2 - Check.vbs
Dim ArjObj
Set Argobj=Wscript.arguments
strData = ArgObj(0)
StrValidPath = ArgObj(1)
Dim i
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objFileSystem = CreateObject("Scripting.fileSystemObject")
Set ObjOutPutFile = objFileSystem.OpenTextFile("Bad_Hives.txt",8)
StrPath = "%comspec% /c chkreg.exe /F " & StrValidPath
Set ObjExecObj = WshShell.Exec(StrPath)
i=1
Do While ObjExecObj.Status = 0
if i = 3000000 Then
Exit Do
End If
i = i+1
Loop
If i = 3000000 Then
ObjOutPutFile.WriteLine StrData & " BAD HIVE !! "
Else
ObjOutPutFile.WriteLine StrData & " Profile seems OK"
End If
ObjOutPutFile.Close
No comments:
Post a Comment