![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Trouble with winmgmts in vbs... I've got a script that goes out and reads registry keys on computers on our network and then writes them to a .csv. It works... but only for one computer at a time. If I try to run a list of computer names through it.. it just keeps pulling the registry from the first machine. Here's the winmgmts line: ============================== Set oRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}!\ \" & strComputer & "/root/default:StdRegProv") ========================= The strComputer variable changes just fine as the script moves through the list. But, for some reason the winmgmts command doesn't want to look at anything other than the first computer... even when instructed not to. Does the winmgmts need to be reset or something? I just don't get it. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Trouble with winmgmts in vbs... "skipjack" <skipjack2001@xxxxxx> wrote in message news:3c57e507-2478-4c20-ad18-5980a72a5b2e@xxxxxx Quote: > I've got a script that goes out and reads registry keys on computers > on our network and then writes them to a .csv. > > It works... but only for one computer at a time. If I try to run a > list of computer names through it.. it just keeps pulling the registry > from the first machine. > > Here's the winmgmts line: > > ============================== > Set oRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}!\ > \" & strComputer & "/root/default:StdRegProv") > ========================= > > The strComputer variable changes just fine as the script moves through > the list. But, for some reason the winmgmts command doesn't want to > look at anything other than the first computer... even when instructed > not to. > > Does the winmgmts need to be reset or something? I just don't get > it. > if you encounter a computer that cannot be connected to (because of permissions, old OS, corrupt WMI, disabled DCOM, remote computer offline, etc.). We need to see more code to troubleshoot further. Hopefully you don't use "On Error Resume Next" throughout as that makes troubleshooting very difficult and could account for what you observe. You might be able to troubleshoot the problem yourself by removing "On Error Resume Next". When I code similar things I use "On Error Resume Next" only for the GetObject("winmgmts:...") statement. Then I trap the error if the computer cannot be contacted with "If (Err.Number <> 0) Then" and then restore normal error handling with "On Error GoTo 0". If this doesn't help, we need to see more code. -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| access denied on a remote computer with winmgmts | VB Script | |||
| winmgmts not working on some servers | VB Script | |||
| How to terminate a Win32 process without using "winmgmts:" | VB Script | |||
| LAN trouble can- see only one way | Vista General | |||
| LAN trouble | Vista General | |||