This works but when I put in a pcname that is not the machine I am running
this on, I get an error something ')' is not correct? blah blah
I want to run this on a one machine and I want to have arrays
$Branch = "pc1", "pc2", "pc3"
how can I get to work in the below code??????
runnning it locally it works fine but I want to run remmote PCnames thru
I Guess the question to ask is "Can I run remote pcnames through this code in a for each next loop to access the remote pcname and local user name?
or does this work only for local pcnames? If I use the local pc name it works, but if I put in a pcname that is not the local machine name, it erros out? what am I doing wrong /???anyone thanks
$Element = "LOCALPCNAME"
$objWMIService = GetObject("winmgmts:\\" + $Element + "\root\cimv2")
$colItems = $objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)
For each $objItem in $colItems
"PC Name: " + $objItem.Name ?
"UserName: " + $objItem.UserName ?
Edited by itdaddy (2009-08-04 09:04 PM)
A+, CCNA, MCP
Credit Union Wisconsin