Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
95 lines (86 sloc) 3.69 KB
Function Get-ComputerInfo {
Get basic information for a computer
Get's basic information about a computer, like IP address, Make/Model, CPU, disk space, etc.
Leverages Get-DiskInfo function.
** Requires AH.Automation Function **
Name or names of the computers you wish to get the information about.
Get-ComputerInfo -ComputerName opsadmin101
$DocTrans = 1..5 | ForEach { "doctransa10$_" }
Get-ComputerInfo -ComputerName $DocTrans
Add-PSSNapin VMware.VIMAutomation.Core
Connect-VIServer vcenter101
Get-Folder "A Environment" | Get-VM | Get-ComputerInfo
Get computer information for all servers in Bedford and Belfast "A" faxing environments
Get-ADComputer -Filter {Name -like "*db*"} | Get-ComputerInfo
Get computer information for all servers in Active Directory that have the letters "db" in them.
Author: Martin Pugh
Date: 2/15/2016
01/15 MLP - Initial Release
02/16 MLP - Added error capture on first WMI call so if there is a failure it won't keep trying. Added pipeline support. Added comment based help.
Param (
[string[]]$Name = $env:COMPUTERNAME
ForEach ($Computer in $Name)
If (Test-Connection $Computer -Count 1 -Quiet)
If ($Computer -match "\d+\.\d+\.\d+\.\d+")
$IP = $Computer
$Computer = ([System.Net.Dns]::GetHostByAddress($Computer)).HostName
$IP = [System.Net.Dns]::GetHostEntry($Computer) | Select -ExpandProperty AddressList
Try {
$WMI = Get-WmiObject -ComputerName $Computer -Class Win32_ComputerSystem -ErrorAction Stop
Catch {
Write-Error "$(Get-Date): Unable to contact $Computer over WMI"
$Uptime = Get-Uptime -Name $Computer
$Result = [PSCustomObject]@{
Name = $Computer
Domain = $WMI.Domain
IP = $IP
OS = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $Computer | Select -ExpandProperty Caption
Make = $WMI.Manufacturer
Model = $WMI.Model
CPU = @(Get-WmiObject -Class Win32_Processor -ComputerName $Computer).Count
RAM = [math]::Round($WMI.TotalPhysicalMemory / 1gb)
Uptime = $Uptime.RebootSince
LastReboot = $Uptime.LastBootTime
$Disks = Get-DiskInfo -ComputerName $Computer
ForEach ($Disk in $Disks)
$Result | Add-Member -MemberType NoteProperty -Name $Disk.Drive -Value ("$($Disk.UsedGB)GB of $($Disk.CapacityGB)GB ({0:N2}GB, $($Disk.FreePercent.Replace(' ','')) Free) ($($Disk.Disk.Replace('\\.\','')) $($Disk.VolumeName))" -f ($Disk.CapacityGB - $Disk.UsedGB))
Write-Output $Result
get-computerinfo -Name corpbatch101
You can’t perform that action at this time.