Re: How can i speed up my script?
- From: "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 12 Apr 2007 08:25:03 -0500
Ryan wrote:
I use one of the ping functions linked on this page to avoid the long
timeout if a remote computer is unavailable:
http://www.rlmueller.net/PingComputers.htm
Less common is to encounter a machine that does not have WMI installed. In
that case an error is raised on the "Set oReg" statement. I see you already
trap this error. I don't know of any way to reduce the timeout experienced
there.
--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--
<ashline@xxxxxxxxx> wrote in message
news:1176383421.875059.106960@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I put together the following script to check, change and report
registry settings on remote machines. It is runnling very slow and I
think it "hangs" when a pc is off or unavailible. Does anyone have
any ideas on what I should change to speed things up?
Thanks for your time
Ryan
Const ForReading = 1
Const REGQ = "c:\plagent\REG QUERY"
Const HKEY_LOCAL_MACHINE = &H80000002
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Wscript.Shell")
Set objTextFile = objFSO.OpenTextFile("c:\plagent\allws.txt",
ForReading)
Set fs = CreateObject("Scripting.FileSystemObject")
Set file = fs.OpenTextFile("C:\plagent\outallws.txt", 8, True)
strKeyPath = "SOFTWARE\Patchlink.com\Gravitix\Agent\Configuration"
strValueName = "ProxyName"
strValue = "gman.work.com"
On Error Resume Next
Do Until objTextFile.AtEndOfStream
strComputer = objTextFile.ReadLine
'WScript.Echo strComputer
Set oReg=GetObject( _
"winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
If Err.Number <> 0 Then
file.Write strComputer & " " & "Error: " & Err.Description &
VbCrLf
Err.Clear
Else
oReg.GetStringValue
HKEY_LOCAL_MACHINE,strKeyPath,strValueName,s1Value
oReg.SetStringValue
HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
oReg.GetStringValue
HKEY_LOCAL_MACHINE,strKeyPath,strValueName,s2Value
file.write strComputer & " " & s1Value & " " & s2Value & VbCrLf
End If
Loop
file.close
objTextFile.Close
.
- Follow-Ups:
- Re: How can i speed up my script?
- From: Al Dunbar
- Re: How can i speed up my script?
- References:
- How can i speed up my script?
- From: ashline@xxxxxxxxx
- How can i speed up my script?
- Prev by Date: How can i speed up my script?
- Next by Date: Re: check for drive letter before copying files.
- Previous by thread: How can i speed up my script?
- Next by thread: Re: How can i speed up my script?
- Index(es):
Relevant Pages
|