February 16, 2012 at 8:08 am
Hi all,
I made a script to read a list of computers from a txt file. then run a WMI query against them to print out what Cores and logical processors they have.
The script for some reason keeps erroring on some boxs but i dont understand why. Any ideaS?
Script is below:
$Computers = Get-Content -Path 'C:/SQLInstances.txt'
$Computers | % {
$property = "systemname","maxclockspeed", "numberOfCores", "NumberOfLogicalProcessors"
Get-WmiObject -ComputerName $_ -class win32_processor -Property $property | Select-Object -Property $property
}
The error i get is:
Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
At line:6 char:5
+ Get-WmiObject -ComputerName $_ -class win32_processor -Property $property | ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], COMException
+ FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
Example of what errors:
I have a 2 node cluster It reports on the passive node. But fails on the active node. I have some VMWare boxs that report back and others that dont.
There is only 10 servers total in the list.
Any ideas?
Thanks
February 16, 2012 at 8:13 am
Just a note. If i run it directly against one of the boxes it fails on it works.. IE:
$property = "systemname","maxclockspeed", "numberOfCores", "NumberOfLogicalProcessors"
Get-WmiObject -ComputerName Server03 -class win32_processor -Property $property | Select-Object -Property $property
February 16, 2012 at 8:30 am
If it fails on the same servers every time it could be an issue with the txt file. I've seen a copy/paste from an outlook email to a txt file cause problems but when I deleted the line and typed the server name by hand the names resolved.
February 16, 2012 at 9:02 am
Hi Bruce and Thanks!
Went back to the text file and found i had a blank spaces after the servers that werent being picked up.
Cleaned all that up and put into a txt file just to make sure.
Now get a lot less errors but a new error on some machines.
Results of the query now get:
systemname maxclockspeed numberOfCores NumberOfLogicalProcessors
---------- ------------- ------------- -------------------------
Server1 2665 4 8
Server1 2665 4 8
Server2 2665 4 8
Server2 2665 4 8
Server3 3000 2 2
Server3 3000 2 2
Server4 2833 4 4
Server4 2833 4 4
Get-WmiObject : Invalid query "select systemname, maxclockspeed, numberOfCores, NumberOfLogicalProcessors from win32_processor"
At line:6 char:5
+ Get-WmiObject -ComputerName $_ -class win32_processor -Property $property | ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-WmiObject], ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
Server6 2400 1 1
Server6 2400 1 1
Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
At line:6 char:5
+ Get-WmiObject -ComputerName $_ -class win32_processor -Property $property | ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], COMException
+ FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
Server7 2403 1 1
Server7 2400 1 1
Server8 2400 1 1
Server8 3000 2 2
Get-WmiObject : Cannot validate argument on parameter 'ComputerName'. The argument is null or empty. Supply an argument that is not null or empty and then try the command again.
At line:6 char:33
+ Get-WmiObject -ComputerName $_ -class win32_processor -Property $property | ...
+ ~~
+ CategoryInfo : InvalidData: (:) [Get-WmiObject], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.GetWmiObjectCommand
February 16, 2012 at 9:31 am
Not sure why your're still getting errors. I'd check those servers manually just to make sure it's not a WMI availability, OS version or permissions issue.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply