Advertisement
Advertisement
| 09.01.2008 at 10:30PM PDT, ID: 23694998 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: |
'On Error Resume Next
strComputers = WScript.Arguments.Item(0)
strKeyPath = WScript.Arguments.Item(1)
strValue = WScript.Arguments.Item(2)
strData = WScript.Arguments.Item(3)
strKeyType = WScript.Arguments.Item(4)
Const ForReading = 1
Const ForAppending = 2
set objShell = CreateObject("wscript.Shell")
Set fso = CreateObject("scripting.filesystemobject")
Set f = fso.OpenTextFile(strComputers, ForReading, True)
Set ObjTextFile = fso.OpenTextFile("results.csv", ForAppending, True)
Do While f.AtEndOfLine <> True
strComputer = f.ReadLine
Set objScriptExec = objShell.Exec("ping -n 2 -w 1000 " & strComputer)
strPingResults = LCase(objScriptExec.StdOut.ReadAll)
If InStr(strPingResults, "reply from") Then
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Call CheckForLogin (IsLoggedIn)
If IsloggedIn = True Then
ObjTextFile.WriteLine(strComputer & ",Logged In")
Else
Call UpdateHKU (UpdateHKUResults)
ObjTextFile.WriteLine(strComputer & ",Updated, " & UpdatedHKUResults)
End If
Else
objTextFile.WriteLine(strComputer & " -- NOT RESPONDING ")
End If
Loop
objShell.Run ("Reg unload HKLM\TempHive"), 0, True
Function CheckForLogin (results)
Set colProcessor = objWMIService.ExecQuery _
("SELECT * FROM Win32_Processor WHERE Name = 'explorer.exe'")
If colProcessor.Count = 0 Then
Results = False
Else
Results = True
End If
End Function
Function UpdateHKU (Results)
Set colSubFolders = objWMIService.ExecQuery _
("ASSOCIATORS OF {Win32_Directory.Name='C:\docume~1'} " _
& "WHERE AssocClass = Win32_Subdirectory " _
& "ResultRole = PartComponent")
For Each objFolder In colSubfolders
If LCase(Mid(objFolder.Name,13,50)) = "default user" OR _
LCase(Mid(objFolder.Name,13,50)) = "all users" Then
Else
objRemoteFile = "\\" & strComputer & "\c$\" & Mid(objFolder.Name,4,50) & "\ntuser.dat"
objShell.Run ("reg unload HKLM\TempHive"), 0, True
objShell.Run ("reg load HKLM\TempHive " & objRemoteFile), 0, True
objShell.Run ("reg add ""HKLM\TempHive\" & strKeyPath & """ /v """ & strValue & """ /t " _
& strKeyType & " /d ""' & strDate & '"" /f"), 0, True
Results = Results & Mid(objFolder.Name,13,50) & ","
End If
Next
End Function
|