This script is pieced together from various posts, I only take credit for combining the resources.
There is more than initially is seen to this script, based on the code below it will write a text file on c:\ and does need admin privileges in order to run.
Right around lines 358-361 should be uncommented and comment out 365 if you want to use this on a network rather than a specific machine.
Of course if you are attempting this on a network you will need at least domain admin rights to the network
Import-Module WebAdministration function Get-ProductKey { $regVal = Get-ItemProperty $regDir.PSPath $arrVal = $regVal.DigitalProductId $arrBin = $arrVal[52..66] $arrChr = "B", "C", "D", "F", "G", "H", "J", "K", "M", "P", "Q", "R", ` "T", "V", "W", "X", "Y", "2", "3", "4", "6", "7", "8", "9" for ($i = 24; $i -ge 0; $i--) { $k = 0; for ($j = 14; $j -ge 0; $j--) { $k = $k * 256 -bxor $arrBin[$j] $arrBin[$j] = [math]::truncate($k / 24) $k = $k % 24 } $strKey = $arrChr[$k] + $strKey if (($i % 5 -eq 0) -and ($i -ne 0)) { $strKey = "-" + $strKey } } $strKey } function Get-Installed { [CmdletBinding()] param ( [Parameter(Mandatory=$False)] [Alias('computer')] [string]$computername=$env:computername, [string]$re = ".*", [boolean]$compress=$true, [boolean]$namesummary=$false, [boolean]$makeobjects=$false, [boolean]$showupdates=$false, [string]$valuenameRE="displayversion|windowsinstaller|uninstallstring|installlocation|localpackage|installsource|installdate|madeup-|gp_", [string]$makeobjectsRE="displayversion|windowsinstaller|uninstallstring|installlocation|localpackage|installsource|installdate|madeup-|gp_" ) begin { try { $regbase=[Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine,$computername) } catch [Exception] { # see if remote registry is stopped Write-Host "Failed to open registry due to " $_.Exception.Message if ($_.Exception.HResult -eq 53) { # The network path was not found exit } Write-Host "Checking if registry service started on " $computername try { Get-Service remoteregistry -ComputerName $computername|gm $remoteregistry=(Get-Service remoteregistry -ComputerName $computername).status } catch [Exception] { Write-Host "cannot reach service manager on " $computername exit } "Remote Registry status is " + $remoteregistry if ($remoteregistry -ieq "stopped") { Set-Service remoteregistry -Status Running -Computername $computername sleep 5 try { $regbase=[Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine,$computername) } catch [Exception] { return $_.Exception.Message } } else { write-Host "could not open registry for " $computername exit } } $software=@{} # Keep hash of software displaynames -> hash of keypaths -> hash of valuename->values $valuenamesfound=@{} # keep count of valuenames found $pg2displayname=@{} # set in getproductdata and used in getgrouppolicydata $sid2logid=@{} # Set it $installedbywho=@{} # track who has installed a product Function load_sid2logid { # Set $sid2logid using registry profilelist $ProfileListKey=$regbase.OpenSubKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList",$False) if ($ProfileListKey -eq $null) {return "Yuck"} foreach ($guid in $ProfileListKey.GetSubKeyNames()) { if ($guid -imatch "^s-") { switch($guid.ToUpper()) { "S-1-5-18" {$sid2logid.Add("S-1-5-18","System")} "S-1-5-19" {$sid2logid.Add("S-1-5-19","Service")} "S-1-5-20" {$sid2logid.Add("S-1-5-20","Network")} default { [string]$ProfileImagePath=$ProfileListKey.OpenSubKey($guid).GetValue("ProfileImagePath") $logid=$ProfileImagePath.Split("\")[-1] $sid2logid.Add($guid.ToUpper(),$logid) } } } } } load_sid2logid Function WantedDisplayName { param([string]$wanteddisplayname) if ($wanteddisplayname -ieq $null -or $wanteddisplayname -ieq "") { return($false) } if (-not ($wanteddisplayname -imatch $re)) { return($false) } # displayname wanted if ($showupdates) { return($true) } else { if ($wanteddisplayname -imatch "update|hotfix") { return($false) } return($true) } } } process { Function upvaluenamesfound { param([string]$valuename) if ($valuenamesfound.ContainsKey($valuename)) { $valuenamesfound.$valuename++ } else { $valuenamesfound.Add($valuename,1) } } Function getuninstalldata { param([STRING] $subkeyname) $uninstallkey=$regbase.OpenSubKey($subkeyname,$False) if ($uninstallkey -ne $null) { foreach ($gname in $uninstallkey.GetSubKeyNames()) { $prodkey=$uninstallkey.OpenSubKey($gname) $displayname=$prodkey.GetValue("displayname") $uninstallstring=$prodkey.GetValue("uninstallstring") if (WantedDisplayName($displayname) -and $uninstallstring -ine "" -and $uninstallstring -ine $null ) { $KeyPath=$subkeyname+"\"+$gname $valuehash= @{} #"KeyPath=" + $KeyPath #"displayname='" + $displayname + "'" $valuehash.Add("madeup-gname",$gname) upvaluenamesfound("madeup-gname") if ($subkeyname -imatch "wow6432node") { $valuehash.Add("madeup-wow",1) upvaluenamesfound("madeup-wow") } else { $valuehash.Add("madeup-native",1) upvaluenamesfound("madeup-native") } foreach ($valuename in $prodkey.GetValueNames()) { $value=$prodkey.GetValue($valuename) if ($value -ine "" -and $value -ine $null) { $valuehash.Add($valuename.tolower(),$prodkey.GetValue($valuename)) upvaluenamesfound($valuename) #"added " + $valuename + "=" + $valuehash.$valuename } } $guidformat="no" if ($gname.StartsWith("{") -and $gname.EndsWith("}") -and $gname.Length -eq 38 ) {$guidformat="yes"} $tolower=$displayname.ToLower() if ($software.ContainsKey($tolower)) { $software.$tolower.Add($KeyPath.ToLower(),$valuehash) } else { $subhash=@{} $subhash.Add($KeyPath.ToLower(),$valuehash) $software.Add($tolower,$subhash) } } } } } Function getproductdatabysid { param([string]$sid) $subkeyname="SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\"+$sid+"\Products" $productkey=$regbase.OpenSubKey($subkeyname,$False) foreach ($gname in $productkey.GetSubKeyNames()) { $prodkey=$productkey.OpenSubKey($gname).OpenSubKey("InstallProperties") try { $displayname=$prodkey.GetValue("displayname") $uninstallstring=$prodkey.GetValue("uninstallstring") $pg2displayname.Add($gname.ToLower(),$displayname) # remember packed guid } catch { $uninstallstring="" $displayname="" } if (WantedDisplayName($displayname) -and $uninstallstring -ine "" -and $uninstallstring -ine $null ) { $KeyPath=$subkeyname+"\"+$gname + "\InstallProperties" #"KeyPath=" + $KeyPath #"displayname='" + $displayname + "'" $valuehash= @{} $valuehash.Add("madeup-loginid",$sid2logid.$sid) foreach ($valuename in $prodkey.GetValueNames()) { $value=$prodkey.GetValue($valuename) if ($value -ine "" -and $value -ine $null) { $valuehash.Add($valuename.tolower(),$prodkey.GetValue($valuename)) upvaluenamesfound($valuename) #"added " + $valuename + "=" + $valuehash.$valuename } } $tolower=$displayname.ToLower() if ($software.ContainsKey($tolower)) { $software.$tolower.Add($KeyPath.ToLower(),$valuehash) } else { $subhash=@{} $subhash.Add($KeyPath.ToLower(),$valuehash) $software.Add($tolower,$subhash) } } } } Function getproductdata { $subkeyname="SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData" $userdatakey=$regbase.OpenSubKey($subkeyname,$False) foreach ($sid in $userdatakey.GetSubKeyNames()) { getproductdatabysid($sid) } } Function getgrouppolicydata { $subkeyname="SOFTWARE/Microsoft/Windows/CurrentVersion/Group Policy/AppMgmt" $gpkey=$regbase.OpenSubKey($subkeyname,$False) if ($gpkey -eq $null) { return } foreach ($gname in $gpkey.GetSubKeyNames()) { $prodkey=$gpkey.OpenSubKey($gname) $displayname=$pg2displayname.($gname.ToLower()) if (WantedDisplayName($displayname)) { $keypath=$subkeyname+ "\" + $gname $valuehash=@{} foreach ($valuename in $prodkey.GetValueNames()) { $value=$prodkey.GetValue($valuename) if ($value -ine "" -and $value -ine $null) { $valuehash.Add("gp_"+$valuename.tolower(),$prodkey.GetValue($valuename)) upvaluenamesfound($valuename) #"added " + $valuename + "=" + $valuehash.$valuename } } $tolower=$displayname.ToLower() if ($software.ContainsKey($tolower)) { $software.$tolower.Add($KeyPath.ToLower(),$valuehash) } else { $subhash=@{} $subhash.Add($KeyPath.ToLower(),$valuehash) $software.Add($tolower,$subhash) } } } } getuninstalldata("SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall") getuninstalldata("SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall") getproductdata getgrouppolicydata #HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\00002109610090400000000000F01FEC\InstallProperties if ($namesummary) { $mykeys=$valuenamesfound.keys|sort-object -Property @{Expression={[int]$valuenamesfound.$_}; Ascending=$false} foreach ($valuename in ($mykeys)) { if ($valuename -ne "" -and $valuename -ne $null) {$valuename + "," + $valuenamesfound.$valuename} } } elseif ($makeobjects) { foreach ($displayname in ($software.Keys|Sort-Object)) { if ($displayname -imatch $re) { #" " #"displayname=" + $displayname $compressedhash=@{}; foreach ($keypath in ($software.$displayname.Keys|Sort-Object)) { foreach ($valuename in ($software.$displayname.$keypath.Keys|Sort-Object)) { if (-not $compressedhash.ContainsKey($valuename)) { $compressedhash.Add($valuename,$software.$displayname.$keypath.$valuename) } elseif ($valuename -ieq "madeup-loginid") { $compressedhash.$valuename += ("," + $software.$displayname.$keypath.$valuename) } } } $obj=New-Object object $obj|Add-Member -MemberType NoteProperty "displayname" $displayname foreach ($valuename in ($valuenamesfound.keys|Sort-Object)) { if ($valuename -imatch $makeobjectsRE) { if ($compressedhash.ContainsKey($valuename)) { $obj|Add-Member -MemberType NoteProperty $valuename $compressedhash.$valuename } else { $obj|Add-Member -MemberType NoteProperty $valuename "" } } } Write-Output $obj } } } elseif ($compress) { foreach ($displayname in ($software.Keys|Sort-Object)) { if ($displayname -imatch $re) { " " "displayname=" + $displayname $compressedhash=@{}; foreach ($keypath in ($software.$displayname.Keys|Sort-Object)) { foreach ($valuename in ($software.$displayname.$keypath.Keys|Sort-Object)) { if (-not $compressedhash.ContainsKey($valuename)) { $compressedhash.Add($valuename,$software.$displayname.$keypath.$valuename) } elseif ($valuename -ieq "madeup-loginid") { $compressedhash.$valuename += ("," + $software.$displayname.$keypath.$valuename) } } } foreach ($valuename in ($compressedhash.Keys|Sort-Object)) { if ($valuename -imatch $valuenameRE) { " " + $valuename + "=" + $compressedhash.$valuename } } } } } else { foreach ($displayname in ($software.Keys|Sort-Object)) { if ($displayname -imatch $re) { " " "displayname=" + $displayname foreach ($keypath in ($software.$displayname.Keys|Sort-Object)) { " keypath=" + $keypath foreach ($valuename in ($software.$displayname.$keypath.Keys|Sort-Object)) { if ($valuename -imatch $valuenameRE) { " " + $valuename + "=" + $software.$displayname.$keypath.$valuename } } } } } } } } # IP Address Information - Start function Get-NetworkIP { [cmdletbinding()] param ( [parameter(ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)] [string[]]$ComputerName = $env:computername ) begin {} process { foreach ($Computer in $ComputerName) { if(Test-Connection -ComputerName $Computer -Count 1 -ea 0) { try { $Networks = Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName $Computer -EA Stop | ? {$_.IPEnabled} } catch { Write-Warning "Error occurred while querying $computer." Continue } foreach ($Network in $Networks) { $Adapter = $Network.Description $IPAddress = $Network.IpAddress[0] $SubnetMask = $Network.IPSubnet[0] $DefaultGateway = $Network.DefaultIPGateway $DNSServers = $Network.DNSServerSearchOrder $IsDHCPEnabled = $false If($network.DHCPEnabled) { $IsDHCPEnabled = $true } $MACAddress = $Network.MACAddress $OutputObj = New-Object -Type PSObject #$OutputObj | Add-Member -MemberType NoteProperty -Name ComputerName -Value $Computer.ToUpper() $OutputObj | Add-Member -MemberType NoteProperty -Name Adapter -Value $Adapter $OutputObj | Add-Member -MemberType NoteProperty -Name IPAddress -Value $IPAddress $OutputObj | Add-Member -MemberType NoteProperty -Name SubnetMask -Value $SubnetMask $OutputObj | Add-Member -MemberType NoteProperty -Name Gateway -Value $DefaultGateway $OutputObj | Add-Member -MemberType NoteProperty -Name IsDHCPEnabled -Value $IsDHCPEnabled $OutputObj | Add-Member -MemberType NoteProperty -Name DNSServers -Value $DNSServers $OutputObj | Add-Member -MemberType NoteProperty -Name MACAddress -Value $MACAddress $OutputObj } } } } end {} } # IP Address Information - Stop #Windows $regDir = Get-Item "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" $key_1 = Get-ProductKey Function ShowInfo { if ([string]::IsNullOrEmpty($compname)) { Write-Host "Unable to get computer name" } else { "General Computer Information:`n" # Create Table $CITable = New-Object system.Data.DataTable "Computer Information" #Create Columns for table $CITcol1 = New-Object system.Data.DataColumn Item,([string]) $CITcol2 = New-Object system.Data.DataColumn Value,([string]) #Add Columns to table $CITable.columns.add($CITcol1) $CITable.columns.add($CITcol2) $I = gwmi -computer $compname Win32_ComputerSystem #Create Row Variable $CITRow = $CITable.NewRow() #Assign items to row variable $CITRow.Item = 'Computer Name' $CITRow.Value = $I.Name #Add Row to Table using Row Variable $CITable.Rows.Add($CITRow) $CITRow = $CITable.NewRow() $CITRow.Item = 'Domain Name' $CITRow.Value = $I.Domain $CITable.Rows.Add($CITRow) $CITRow = $CITable.NewRow() $CITRow.Item = 'Manufacturer' $CITRow.Value = $I.Manufacturer $CITable.Rows.Add($CITRow) $CITRow = $CITable.NewRow() $CITRow.Item = 'Model' $CITRow.Value = $I.Model $CITable.Rows.Add($CITRow) $CITRow = $CITable.NewRow() $CITRow.Item = 'System Type' $CITRow.Value = $I.SystemType $CITable.Rows.Add($CITRow) $I = gwmi -computer $compname Win32_BIOS $CITRow = $CITable.NewRow() $CITRow.Item = 'Serial Number' $CITRow.Value = $I.SerialNumber $CITable.Rows.Add($CITRow) $CITRow = $CITable.NewRow() $CITRow.Item = 'BIOS Name' $CITRow.Value = $I.Name $CITable.Rows.Add($CITRow) $CITRow = $CITable.NewRow() $CITRow.Item = ' Version' $CITRow.Value = $I.SMBIOSBIOSVersion $CITable.Rows.Add($CITRow) $I = gwmi -computer $compname Win32_ComputerSystem $CITRow = $CITable.NewRow() $CITRow.Item = 'Current User ID' $CITRow.Value = $I.Username $CITable.Rows.Add($CITRow) $I = gwmi -computer $compname Win32_OperatingSystem $CITRow = $CITable.NewRow() $CITRow.Item = 'OS Name' $CITRow.Value = $I.Caption $CITable.Rows.Add($CITRow) $CITRow = $CITable.NewRow() $CITRow.Item = 'OS Service Pack' $CITRow.Value = $I.ServicePackMajorVersion $CITable.Rows.Add($CITRow) $CITRow = $CITable.NewRow() $CITRow.Item = 'OS Version' $CITRow.Value = $I.Version $CITable.Rows.Add($CITRow) $CITRow = $CITable.NewRow() $CITRow.Item = 'OS Product Key' $CITRow.Value = $key_1 $CITable.Rows.Add($CITRow) $CITRow = $CITable.NewRow() $CITRow.Item = 'Serial Number' $CITRow.Value = $I.SerialNumber $CITable.Rows.Add($CITRow) $CITRow = $CITable.NewRow() $CITRow.Item = 'OS Bit Width' $CITRow.Value = $I.OSArchitecture $CITable.Rows.Add($CITRow) $I = gwmi -computer $compname -Class Win32_Processor | select $WMI_ProcProps # CPU count if (@($I)[0].NumberOfCores) #Modern OS { $Sockets = @($I).Count $Cores = ($I | Measure-Object -Property NumberOfLogicalProcessors -Sum).Sum } else #Legacy OS { $Sockets = @($I | Select-Object -Property SocketDesignation -Unique).Count $Cores = @($I).Count } $CITRow = $CITable.NewRow() $CITRow.Item = 'Processor Name' $CITRow.Value = $I.Name $CITable.Rows.Add($CITRow) $CITRow = $CITable.NewRow() $CITRow.Item = ' Info' $CITRow.Value = $I.Caption $CITable.Rows.Add($CITRow) $CITRow = $CITable.NewRow() $CITRow.Item = ' Maker' $CITRow.Value = $I.Manufacturer $CITable.Rows.Add($CITRow) $CITRow = $CITable.NewRow() $CITRow.Item = ' ID' $CITRow.Value = $I.ProcessorId $CITable.Rows.Add($CITRow) $CITRow = $CITable.NewRow() $CITRow.Item = ' Cores' $CITRow.Value = $Cores $CITable.Rows.Add($CITRow) $CITRow = $CITable.NewRow() $CITRow.Item = ' Sockets' $CITRow.Value = $Sockets $CITable.Rows.Add($CITRow) $CITRow = $CITable.NewRow() $CITRow.Item = 'Address Width' $CITRow.Value = $I.AddressWidth $CITable.Rows.Add($CITRow) $wmi = gwmi -computer $compname Win32_OperatingSystem $localdatetime = $wmi.ConvertToDateTime($wmi.LocalDateTime) $lastbootuptime = $wmi.ConvertToDateTime($wmi.LastBootUpTime) $OSInstallDate = $wmi.ConvertToDateTime($wmi.InstallDate) $uptime = $localdatetime - $lastbootuptime $CITRow = $CITable.NewRow() $CITRow.Item = 'OS Install Date' $CITRow.Value = $OSInstallDate $CITable.Rows.Add($CITRow) $CITRow = $CITable.NewRow() $CITRow.Item = 'Time Current' $CITRow.Value = $LocalDateTime $CITable.Rows.Add($CITRow) $CITRow = $CITable.NewRow() $CITRow.Item = ' Last Boot' $CITRow.Value = $LastBootUpTime $CITable.Rows.Add($CITRow) $CITRow = $CITable.NewRow() $CITRow.Item = ' Total Up' $CITRow.Value = "$($Uptime.days) days $($Uptime.hours) hours $($Uptime.minutes) minutes" $CITable.Rows.Add($CITRow) #Output table $fmt = @{Expression={$_.Item};Label="Item";width=20}, @{Expression={$_.Value};Label="Value";Width=40} $CITable | Select-Object Item,Value | Format-Table $fmt -AutoSize #Battery Information "Battery Information:" Get-WmiObject Win32_Battery -ComputerName $compname | Select Caption,Name,DesignVoltage,DeviceID,EstimatedChargeRemaining,EstimatedRunTime | Format-Table -autosize #Disk Info "Drive Information:" $fmt = @{Expression={$_.Name};Label="Drive Letter";width=12}, @{Expression={$_.VolumeName};Label="Vol Name";Width=15}, @{Expression={ '{0:#,000.00}' -f ($_.Size/1gb)};Label="Disk Size / GB";width=14}, @{Expression={ '{0:#,000.00}' -f ($_.FreeSpace/1gb)};Label="Free Space / GB";width=15} $wmi = gwmi -computer $compname Win32_logicaldisk $wmi | Format-Table $fmt -AutoSize # Hard-Disk "Hard Disk Information" Get-WmiObject win32_diskDrive -ComputerName $compname | select Model,SerialNumber,InterfaceType,Size,Partitions | Format-Table -autosize # CD ROM Drive "Optical Disk Information" Get-WmiObject Win32_CDROMDrive -ComputerName $compname | select Name,Drive,MediaLoaded,MediaType,MfrAssignedRevisionLevel | Format-Table -autosize #Memory Info "Memory Information:" $fmt = @{Expression={$_.Manufacturer};Label="Manufacturer";}, @{Expression={$_.PartNumber};Label="PartNumber";}, @{Expression={$_.Speed};Label="Speed";width=20}, @{Expression={$_.DataWidth};Label="Data Width";width=10}, @{Expression={ '{0:#.00}' -f ($_.Capacity/1gb)};Label="Module Size / GB";width=16}, @{Expression={$_.DeviceLocator};Label="Slot";width=6}, @{Expression={$_.SerialNumber};Label="Serial No."} $wmi = gwmi -computer $compname Win32_PhysicalMemory $wmi | Format-Table $fmt -AutoSize # IIS Information - Start "IIS Information:" $props = @{Expression={$_.Name};Label="Site Name"}, ` @{Expression={$_.applicationPool};Label="Site App Pool";}, ` @{Expression={$_.PhysicalPath};Label="Site Physical Path";} dir IIS:\Sites | Format-Table $props -AutoSize # IIS Information - Stop #Network Information "Network Information:" Get-NetworkIP | Format-Table -AutoSize Get-WmiObject win32_networkadapter -ComputerName $compname | Select Name,Manufacturer,Description ,AdapterType,Speed,MACAddress,NetConnectionID | Format-Table -autosize # Network Information - Start foreach ($Computer in $ComputerName) { if(Test-Connection -ComputerName $Computer -Count 1 -ea 0) { try { $Networks = Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName $Computer -EA Stop | ? {$_.IPEnabled} } catch { Write-Warning "Error occurred while querying $computer." Continue } foreach ($Network in $Networks) { $IPAddress = $Network.IpAddress[0] $SubnetMask = $Network.IPSubnet[0] $DefaultGateway = $Network.DefaultIPGateway $DNSServers = $Network.DNSServerSearchOrder $IsDHCPEnabled = $false If($network.DHCPEnabled) { $IsDHCPEnabled = $true } $MACAddress = $Network.MACAddress $OutputObj = New-Object -Type PSObject #$OutputObj | Add-Member -MemberType NoteProperty -Name ComputerName -Value $Computer.ToUpper() $OutputObj | Add-Member -MemberType NoteProperty -Name Interface -Value $Network.Caption $OutputObj | Add-Member -MemberType NoteProperty -Name IPAddress -Value $IPAddress $OutputObj | Add-Member -MemberType NoteProperty -Name SubnetMask -Value $SubnetMask $OutputObj | Add-Member -MemberType NoteProperty -Name Gateway -Value $DefaultGateway $OutputObj | Add-Member -MemberType NoteProperty -Name IsDHCPEnabled -Value $IsDHCPEnabled $OutputObj | Add-Member -MemberType NoteProperty -Name DNSServers -Value $DNSServers $OutputObj | Add-Member -MemberType NoteProperty -Name MACAddress -Value $MACAddress $OutputObj | Format-Table -AutoSize -Wrap } } } # Network Information - Stop #PC Printer Information "Installed Printer Information:" gwmi -computer $compname Win32_Printer | Select-Object DeviceID,DriverName, PortName | Format-Table -autosize # Application Info "Application Information:" Get-Installed -makeobjects $true -compress $false |format-table -autosize displayname, displayversion, installdate #Service Info "Service Information:" Get-Service|Format-Table name,displayname, status –AutoSize #Monitor Info "Monitor Information:" #Turn off Error Messages $ErrorActionPreference_Backup = $ErrorActionPreference $ErrorActionPreference = "SilentlyContinue" $keytype=[Microsoft.Win32.RegistryHive]::LocalMachine if($reg=[Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($keytype,$compname)){ #Create Table To Hold Info $montable = New-Object system.Data.DataTable "Monitor Info" #Create Columns for Table $moncol1 = New-Object system.Data.DataColumn Name,([string]) $moncol2 = New-Object system.Data.DataColumn Serial,([string]) $moncol3 = New-Object system.Data.DataColumn Ascii,([string]) #Add Columns to Table $montable.columns.add($moncol1) $montable.columns.add($moncol2) $montable.columns.add($moncol3) $regKey= $reg.OpenSubKey("SYSTEM\\CurrentControlSet\\Enum\DISPLAY" ) $HID = $regkey.GetSubKeyNames() foreach($HID_KEY_NAME in $HID){ $regKey= $reg.OpenSubKey("SYSTEM\\CurrentControlSet\\Enum\\DISPLAY\\$HID_KEY_NAME" ) $DID = $regkey.GetSubKeyNames() foreach($DID_KEY_NAME in $DID){ $regKey= $reg.OpenSubKey("SYSTEM\\CurrentControlSet\\Enum\\DISPLAY\\$HID_KEY_NAME\\$DID_KEY_NAME\\Device Parameters" ) $EDID = $regKey.GetValue("EDID") foreach($int in $EDID){ $EDID_String = $EDID_String+([char]$int) } #Create new row in table $monrow=$montable.NewRow() #MonitorName $checkstring = [char]0x00 + [char]0x00 + [char]0x00 + [char]0xFC + [char]0x00 $matchfound = $EDID_String -match "$checkstring([\w ]+)" if($matchfound){$monrow.Name = [string]$matches[1]} else {$monrow.Name = '-'} #Serial Number $checkstring = [char]0x00 + [char]0x00 + [char]0x00 + [char]0xFF + [char]0x00 $matchfound = $EDID_String -match "$checkstring(\S+)" if($matchfound){$monrow.Serial = [string]$matches[1]} else {$monrow.Serial = '-'} #AsciiString $checkstring = [char]0x00 + [char]0x00 + [char]0x00 + [char]0xFE + [char]0x00 $matchfound = $EDID_String -match "$checkstring([\w ]+)" if($matchfound){$monrow.Ascii = [string]$matches[1]} else {$monrow.Ascii = '-'} $EDID_String = '' $montable.Rows.Add($monrow) } # End - foreach($DID_KEY_NAME in $DID) } # End - foreach($HID_KEY_NAME in $HID) $montable | select-object -unique Serial,Name,Ascii | Where-Object {$_.Serial -ne "-"} | Format-Table -AutoSize } # End If else { Write-Host "Access Denied - Check Permissions" } } } #End Function ShowInfo #---------Start Main-------------- Clear-Host # Single Computer Based - Start $compname = $env:COMPUTERNAME # Single Computer Based - Stop $exportFile = "c:\Computer_Info_" + $compname + ".txt" ShowInfo > $exportFile
Primary source: http://windowssecrets.com/forums/showthread.php/140015-PowerShell-PC-Information-Utility
Last Updated on November 10, 2015