Created
September 26, 2022 22:15
-
-
Save ishu3101/cb6a0359ac232cb30eda6fa0dd0180fb to your computer and use it in GitHub Desktop.
Get Computer Information such as OS, Manufacturer, Model, CPU using Powershell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$osInfo = Get-CimInstance Win32_OperatingSystem | |
$computerInfo = Get-CimInstance Win32_ComputerSystem | |
$diskInfo = Get-CimInstance Win32_LogicalDisk | |
$cpuinfo = Get-WmiObject Win32_Processor | |
[hashtable]$objectProperty = @{} | |
$objectProperty = [ordered]@{ | |
ComputerName = $computerInfo.Name | |
OS = $osInfo.Caption + " $($osInfo.OSArchitecture)" | |
'OS Version' = $("$($osInfo.Version) Build $($osInfo.BuildNumber)") | |
CPU = $cpuinfo.Name | |
Manufacturer = $computerInfo.Manufacturer | |
Model = $computerInfo.Model | |
Domain = $computerInfo.Domain | |
Workgroup = $computerInfo.Workgroup | |
DomainJoined = $computerInfo.PartOfDomain | |
Disks = $diskInfo | |
} | |
$ourObject = New-Object -TypeName psobject -Property $objectProperty |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment