Re: Help with reading remote registries

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Derek (garionb_at_gmail.com)
Date: 01/18/05


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



Relevant Pages

  • Re: Links bar missing, other weird errors
    ... afraid I have a much more serious problem than a registry ... >Have you tried un-locking the toolbars and seeing if you ... >Scripting enabled. ... >the Security tab. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: Administrator Rights
    ... > (I never mess with regedit and never manually edit my registry.) The reason ... Disable/Enable Registry Editing Tools. ... The Parasite Fight Quick Fix Protocol ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.windowsxp.general)
  • Re: Can a script delete reg keys and then isssue a run command.?
    ... ' Delete registry values ... oShell.RegDelete sRegKey & "\AccountDomainSid" ... by setting a registry marker. ... torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.scripting.vbscript)
  • Re: ActiveX not working after update KB896688
    ... middle of the reboot to try it when I posted my last reply. ... lines below into a file that you give a .reg file extension (use e.g. ... Import the registry file by double clicking on it in Explorer, ... torgeir, Microsoft MVP Scripting, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: http://www.microsoft.com/technet/scriptcenter/default.mspx ...
    (microsoft.public.windowsupdate)
  • Re: KB896688 cause problem with Outlook Today and Windows Update S
    ... This affects the Windows Update site as well as the Outlook ... Import the registry file by double clicking on it in Explorer, ... torgeir, Microsoft MVP Scripting, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: http://www.microsoft.com/technet/scriptcenter/default.mspx ...
    (microsoft.public.windowsupdate)