Re: Help with reading remote registries
From: Derek (garionb_at_gmail.com)
Date: 01/18/05
- Next message: Derek: "Re: cdo email results in an email that displays blank sender in outlook"
- Previous message: emebohw2_at_netscape.net: "cdo email results in an email that displays blank sender in outlook"
- In reply to: Torgeir Bakken \(MVP\): "Re: Help with reading remote registries"
- Next in thread: Torgeir Bakken \(MVP\): "Re: Help with reading remote registries"
- Reply: Torgeir Bakken \(MVP\): "Re: Help with reading remote registries"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 18 Jan 2005 12:19:58 -0600
Thanks! I apologize, I thought I turned that off :( Anyway, it is working
now but I have another question:
What would I need to put in to do some error checking to find out the
following:
1. Computer not available;
2. Access denied to registry
Any help is appreciated, thanks again!
"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
news:uTwSefY$EHA.3596@TK2MSFTNGP12.phx.gbl...
> Derek wrote:
>
>> Hello,
>> I am having trouble with the following script. Could someone please help
>> me figure out why I am not able to retrieve the registry key properly
>> from a list of computers I am reading from a text file? The script runs
>> fine when searching the local computer but will not retrieve the registry
>> key remotely? Any help is appreciated, thanks!
>>
>> Derek
>>
>> Option Explicit
>> On Error Resume Next
>
> Never use a "global" On Error Resume Next during testing and
> when having problems!
>
> [snip]
>>
>> For Each strComputer In arrComputers
>> Do While Not objTextFile.AtEndOfStream
>
> You should remove the "Do While" loop as it is not valid any more and
> will make the script go into a eternal loop (remove the "On Error
> Resume Next" and you will get an error on it).
>
>
>> Set objWMIService = GetObject("winmgmts:" _
>> & "{impersonationLevel=impersonate}!\\" & strComputer &
>> "\root\cimv2")
>> Set objRegistry = GetObject("winmgmts:\\" & _
>> strComputer & "\root\default:StdRegProv")
>>
>> strKeyPath = "SOFTWARE\Veritas\NetBackup\CurrentVersion\"
>> strValueName = "version"
>> objRegistry.GetStringValue
>> HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
>>
>> If IsNull(strValue) Then
>> objfile.Write strComputer & "The registry key does not exist."
>> Else
>> objfile.Write strComputer,strValue
>
> Again, your "On Error Resume Next" suppresses an error here. The line
> above will always fail. Change it to:
>
> objfile.Write strComputer & strValue
>
>
>> End If
>>
>>
>> objfile.Write VbCrLf & String(80, "-")
>> Loop
>
> Remove "Loop".
>
>> Next
>
>
> --
> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of
> the 1328 page Scripting Guide:
> http://www.microsoft.com/technet/scriptcenter/default.mspx
- Next message: Derek: "Re: cdo email results in an email that displays blank sender in outlook"
- Previous message: emebohw2_at_netscape.net: "cdo email results in an email that displays blank sender in outlook"
- In reply to: Torgeir Bakken \(MVP\): "Re: Help with reading remote registries"
- Next in thread: Torgeir Bakken \(MVP\): "Re: Help with reading remote registries"
- Reply: Torgeir Bakken \(MVP\): "Re: Help with reading remote registries"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|