System Information

Just another Tech site

System Information

Working to get system information in the Batcave.  I wanted to create a way to gather system information as part of log file when working with application installations and troubleshooting systems.

$CurrDate = $(Get-Date)
$CompName = $Env:COMPUTERNAME
$IPAddress = ([System.Net.Dns]::GetHostByName($Inputmachine).AddressList[0]).IpAddressToString
$IPMAC = Get-WmiObject -Class Win32_NetworkAdapterConfiguration -ComputerName $CompName
$MACAddress = ($IPMAC | Where-Object { $_.IpAddress -eq $IPAddress }).MACAddress
$SysDeviceInfoStatus = $(Get-WMIObject -class Win32_ComputerSystem | Select-Object Status) | Format-Table -HideTableHeaders | Out-String | ForEach-Object { $_.Trim() }
$SysDeviceInfoModel = $(Get-WMIObject -class Win32_ComputerSystem | Select-Object Model) | Format-Table -HideTableHeaders | Out-String | ForEach-Object { $_.Trim() }
$SysDeviceInfoChassis = $(Get-WMIObject -class Win32_ComputerSystem | Select-Object ChassisSKUNumber) | Format-Table -HideTableHeaders | Out-String | ForEach-Object { $_.Trim() }
$SysDeviceInfoManufacturer = $(Get-WMIObject -class Win32_ComputerSystem | Select-Object Manufacturer) | Format-Table -HideTableHeaders | Out-String | ForEach-Object { $_.Trim() }
$SysDeviceInfoSysType = $(Get-WMIObject -class Win32_ComputerSystem | Select-Object SystemType) | Format-Table -HideTableHeaders | Out-String | ForEach-Object { $_.Trim() }
$SysDeviceInfoMemory = $(Get-WMIObject -class Win32_ComputerSystem | Select TotalPhysicalMemory) | Format-Table -HideTableHeaders | Out-String | ForEach-Object { $_.Trim() }
$SysDeviceInfoPrimaryOwner = $(Get-WMIObject -class Win32_ComputerSystem | select-object PrimaryOwnerName) |Format-Table -HideTableHeaders | Out-String | ForEach-Object { $_.Trim() }