Author Posts

May 18, 2014 at 10:16 pm


This is the script i run

$KRErrorLogPreferance = "E:\Education\BIT\MCSA\Powershell\CBT Tool Making Code"

function Get-SystemInfo{
< # .SYNOPSIS Quieries critical information from a single computer .DESCRIPTION Quiries OS and the Hardware information from a single computer. This Utilize WMI Objects,so appropriate WMI port must be open and you must be admin on the remort machine .PARAMETER ComputerName The computer name to query, accept multiple values and pipeline input .PARAMETER IPAddress Enter the IP Address to query, pipeline is not accepted .EXAMPLE Get-SystemInfo.ps1 -ComputerName WHATEVER This will query infromation from the computer WHATEVER .EXAMPLE Get-SystemInfo.ps1 -ComputerName WHATEVER | Format-Table * This will display the information as a table #>


HelpMessage="Enter the computer name to qury WMI object")]

HelpMessage="Enter the IP Address to query WMI Object",

[string]$ErrorLogFilePath =$KRErrorLogPreferance



foreach($computer in $ComputerName){

Write-Verbose "Connecting via WMI $computer"

$os=Get-WmiObject win32_OperatingSystem -ComputerName $computer
$cs=Get-WmiObject win32_computerSystem -ComputerName $computer

Write-Verbose "Finished with WMI building output"

$props =@{'ComputerName'=$computer;
'OSVersion'= $os.version;
'RAM'=$cs.TotalPhysicalMemory / 1GB -as [int]

$obj = New-Object -TypeName PSObject -Property $props

Write-Verbose "Outputing to pipeline "

Write-Output $obj



#Get-SystemInfo -ComputerName localhost
#'kasunrajapakse','localhost','kasunrajapakse' | Get-SystemInfo
#Import-Csv -Path 'E:\Education\BIT\MCSA\PowerShell\CBT Tool Making Code\computers.csv' | Get-SystemInfo
Get-SystemInfo -IPAddress -Verbose

When i run it using ipaddress parameter it gives me the following error

Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
At line:57 char:17
+ $os=Get-WmiObject win32_OperatingSystem -ComputerName $computer
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], COMException
+ FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

Please help me !!!

May 18, 2014 at 11:01 pm

The IP address you've provided is not valid. One .0 octet too much.

Try again with:
Get-SystemInfo -IPAddress -Verbose

Verify "localhost" address:
ping -4 localhost

May 18, 2014 at 11:51 pm

oh i see it thanks for pointing it to me 🙂