Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Remote System Information v1.5
- # Shows details of targetted PCs
- # Author: Alaknar (2016-06-30)
- # Based on script by: Thom McKiernan (2014-11-09)
- # Last update: 2016-07-19
- function Get-ComputerInformation {
- <#
- .SYNOPSIS
- Query one or more computers for hardware and system details.
- .DESCRIPTION
- Using CIM retrieve information about the hardware (computer make and model, CPU, GPU, HDD and others)
- and software (operating system, build, architecture and other).
- .PARAMETER Identity
- PC name to be queried.
- .EXAMPLE
- > Get-ComputerInformation PLWD6675
- System Information for: PLWD6675
- Manufacturer: Dell Inc.
- Model: OptiPlex 7010
- Serial Number: 636CGZ1
- CPU: Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz
- HDD Capacity: 465.21GB
- HDD Space: 84.58% Free (393.48GB)
- RAM: 7.89GB
- Operating System: Microsoft Windows 10 Enterprise (build 10.0.10586) 64-bit, Service Pack: 0
- User logged In: BIZ\ZabrzAnd
- Last Reboot: 07/08/2016 14:53:27
- Local Date and Time: 07/19/2016 11:12:56
- .EXAMPLE
- > Get-ComputerInformation PLWD6675, PLWD6632
- Searches for 2 PCs and returns their software and hardware information.
- #>
- Param (
- [Parameter(Mandatory=$True,Position=1)]
- [string[]]$ComputerName
- )
- Foreach ($computer in $ComputerName) {
- [Microsoft.Management.Infrastructure.CimCmdlets.ProtocolType]$Protocol = 'DCOM'
- $option = New-CimSessionOption -Protocol $protocol
- $session = New-CimSession -ComputerName $computer -SessionOption $option
- $computerSystem = Get-CimInstance -CimSession $session -ClassName win32_computersystem
- $computerBIOS = Get-CimInstance -CimSession $session CIM_BIOSElement
- $computerOS = Get-CimInstance -CimSession $session CIM_OperatingSystem
- $computerCPU = Get-CimInstance -CimSession $session CIM_Processor
- $computerHDD = Get-CimInstance -CimSession $session Win32_LogicalDisk -Filter "DeviceID = 'C:'"
- ""
- Write-Host "System Information for:"$computerSystem.Name -BackgroundColor DarkCyan
- "Manufacturer: " + $computerSystem.Manufacturer
- "Model: " + $computerSystem.Model
- "Serial Number: " + $computerBIOS.SerialNumber
- "CPU: " + $computerCPU.Name
- "HDD Capacity: " + "{0:N2}" -f ($computerHDD.Size/1GB) + "GB"
- "HDD Space: " + "{0:P2}" -f ($computerHDD.FreeSpace/$computerHDD.Size) + " Free (" + "{0:N2}" -f ($computerHDD.FreeSpace/1GB) + "GB)"
- "RAM: " + "{0:N2}" -f ($computerSystem.TotalPhysicalMemory/1GB) + "GB"
- "Operating System: " + $computerOS.caption + " (build " + $computerOS.Version + ") "+ $computerOS.OSArchitecture + ", Service Pack: " + $computerOS.ServicePackMajorVersion
- "User logged In: " + $computerSystem.UserName
- "Last Reboot: " + $computerOS.LastBootUpTime
- "Local Date and Time: " + $computerOS.LocalDateTime
- ""
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment