Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why is this working on some PC's but not others

Status
Not open for further replies.

tcspine

IS-IT--Management
Jan 2, 2008
31
0
0
US
First, a little about my background. We have win2k and XP machines here. Some of the XP were upgraded from 2k.

Below is my script which works on SOME XP machines, but not others. I haven't tested it on 2k yet, but I don't know why it wouldn't work.

p.s. Before I tested it, I made sure the PC's were turned on by pinging them first. And another thing is that I'm using the NAME of the PC and not the IP.


computerName = inputbox("Input a Machine Name")


wmiRoot = "winmgmts:\\" & computerName & "\root\cimv2"
wmiQuery = "Select * from Win32_OperatingSystem"

set objWMIOS = getobject(wmiroot)
set colOS = objWMIOS.ExecQuery(wmiQuery)

For Each objOS in colOS
wscript.echo objOS.name
Next


wmiQuery = "Select * from Win32_ComputerSystem"

set objWMIRAM = getobject(wmiroot)
set colRAM = objwmiram.execquery(wmiQuery)

For Each objRAM in colRAM
wscript.echo objRAM.TotalPhysicalMemory / 1024 / 1024
Next

 
Define "doesn't work". Do you get errors? If so, what is the error? What line errors? Is it not doing what it should? How so? Is it doing something that it shouldn't? If so, what?

Have you read up on what conditions are required for remote WMI access? Specifically what permissions are required?

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Here's the error attached.

my.php


I'm not really sure what conditions need to be met for remote WMI access.

By the way, line 8 will be 'set objWMIOS = getobject(wmiroot)'

 
 http://img171.imageshack.us/my.php?image=43439271rd1.png
OK, I figured out the problem. It was simple. Windows Firewall. And I thought it had to do with DCOM permissions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top