# Get computer system information
$computerSystem = Get-WmiObject -Class Win32_ComputerSystem
# Get CPU information
$cpuInfo = Get-WmiObject Win32_Processor
# Get operating system information
$operatingSystem = Get-WmiObject -Class Win32_OperatingSystem
# Get hard disk information
$diskInfo = Get-WmiObject Win32_DiskDrive
# Get partition information
$partitionInfo = Get-WmiObject Win32_LogicalDisk
# Get RAM information
$ramInfo = Get-WmiObject Win32_PhysicalMemory
# Create objects for export
$computerDetails = [PSCustomObject]@{
"ComputerName" = $computerSystem.Name
"Manufacturer" = $computerSystem.Manufacturer
"Model" = $computerSystem.Model
"SystemType" = $computerSystem.SystemType
"OperatingSystem" = $operatingSystem.Caption
"OSVersion" = $operatingSystem.Version
"OSBuildNumber" = $operatingSystem.BuildNumber
"RegisteredUser" = $operatingSystem.RegisteredUser
"CPUManufacturer" = $cpuInfo.Manufacturer
"CPUModel" = $cpuInfo.Name
"NumberOfCores" = $cpuInfo.NumberOfCores
"NumberOfLogicalProcessors" = $cpuInfo.NumberOfLogicalProcessors
}
# Output computer details
Write-Host "Computer Name: $($computerSystem.Name)"
Write-Host "Computer Manufacturer: $($computerSystem.Manufacturer)"
Write-Host "Computer Model: $($computerSystem.Model)"
Write-Host "System Type: $($computerSystem.SystemType)"
Write-Host "--------------------------------------"
# Output operating system details
Write-Host "Operating System: $($operatingSystem.Caption)"
Write-Host "OS Version: $($operatingSystem.Version)"
Write-Host "OS Build Number: $($operatingSystem.BuildNumber)"
Write-Host "Registered User: $($operatingSystem.RegisteredUser)"
Write-Host "--------------------------------------"
# Output CPU details
Write-Host "CPU Manufacturer: $($cpuInfo.Manufacturer)"
Write-Host "CPU Model: $($cpuInfo.Name)"
Write-Host "CPU Serial Number: $($cpuInfo.ProcessorId)"
Write-Host "CPU Name: $($cpuInfo.Name)"
Write-Host "Number of Cores: $($cpuInfo.NumberOfCores)"
Write-Host "Number of Logical Processors: $($cpuInfo.NumberOfLogicalProcessors)"
Write-Host "CPU Architecture: $($cpuInfo.Architecture)"
Write-Host "--------------------------------------"
# Output hard disk details
foreach ($disk in $diskInfo) {
Write-Host "Hard Disk Model: $($disk.Model)"
Write-Host "Hard Disk Size: $($disk.Size / 1GB) GB"
Write-Host "Hard Disk Serial Number: $($disk.SerialNumber)"
Write-Host "Interface Type: $($disk.InterfaceType)"
Write-Host "--------------------------------------"
}
# Output partition details
foreach ($partition in $partitionInfo) {
Write-Host "Drive Letter: $($partition.DeviceID)"
Write-Host "Volume Name: $($partition.VolumeName)"
Write-Host "File System: $($partition.FileSystem)"
Write-Host "Free Space: $($partition.FreeSpace / 1GB) GB"
Write-Host "Total Size: $($partition.Size / 1GB) GB"
Write-Host "--------------------------------------"
}
# Output RAM details
foreach ($ram in $ramInfo) {
Write-Host "Capacity: $($ram.Capacity / 1GB) GB"
Write-Host "Manufacturer: $($ram.Manufacturer)"
Write-Host "Speed: $($ram.Speed) MHz"
Write-Host "--------------------------------------"
}
# Get monitor serial number
$monitorSerial = Get-WmiObject -Namespace root\wmi -Class WmiMonitorID | ForEach-Object {
$ManufacturerID = $_.ManufacturerName -join ''
$ProductID = $_.ProductCodeID -join ''
$SerialNumberID = $_.SerialNumberID -join ''
$ManufacturerID, $ProductID, $SerialNumberID
}
# Format the serial number
$serialNumber = $monitorSerial[2] -replace '0', ''
$serialNumber = $serialNumber -replace '\s', ''
# Output monitor serial number
if ($serialNumber -ne '') {
Write-Host "Monitor Serial Number: $serialNumber"
} else {
Write-Host "Monitor serial number not found."
}
Write-Host "--------------------------------------"
# Get currently logged-in user
$loggedUser = (Get-WmiObject -Class Win32_ComputerSystem).UserName
# Output the logged-in user
Write-Host "Logged-in user: $loggedUser"
# Get domain joined details
$domainJoinedDetails = Get-WmiObject -Class Win32_ComputerSystem
# Output domain joined details
Write-Host "Domain: $($domainJoinedDetails.Domain)"
Write-Host "Domain Joined: $($domainJoinedDetails.PartOfDomain)"
Write-Host "--------------------------------------"
# Get members of the local Administrators group
$adminMembers = Get-LocalGroupMember -Group "Administrators"
Write-Host "--------------------------------------"
# Output the members of the local Administrators group
Write-Host "Members of the local Administrators group:"
foreach ($member in $adminMembers) {
Write-Host $member.Name
}
Write-Host "--------------------------------------"
# Get the last update date
$lastUpdateDate = (Get-WmiObject -Class Win32_OperatingSystem).LastBootUpTime
# Output the last update date
Write-Host "Last update date: $lastUpdateDate"
# Get details about the last patch installed
$lastPatch = Get-HotFix | Sort-Object -Property InstalledOn -Descending | Select-Object -First 1
# Output details about the last patch
Write-Host "Last patch details:"
Write-Host "KB Number: $($lastPatch.HotFixID)"
Write-Host "Description: $($lastPatch.Description)"
Write-Host "Installed on: $($lastPatch.InstalledOn)"