Last active
May 16, 2018 23:03
-
-
Save Chirishman/cc30ca0cdb2a5ca6aa8a7e1f324f6986 to your computer and use it in GitHub Desktop.
IronScripter Prequel 1
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
function Get-MonitorInfo { | |
[CmdletBinding()] | |
Param( | |
[Parameter(ValueFromPipelineByPropertyName=$true)] | |
[string[]]$ComputerName = $env:COMPUTERNAME | |
) | |
$MonitorSelect = @( | |
@{ | |
N = 'ComputerName' | |
E = { $_.PSComputerName } | |
}, | |
@{ | |
N = 'ComputerType' | |
E = [scriptblock]::Create("'$(Get-CimInstance -Class Win32_ComputerSystem -ComputerName $ComputerName | select -ExpandProperty Model)'") | |
}, | |
@{ | |
N = 'ComputerSerial' | |
E = [scriptblock]::Create("'$(Get-CimInstance -Class Win32_Bios -ComputerName $ComputerName | select -ExpandProperty SerialNumber)'") | |
}, | |
@{ | |
N = 'MonitorSerial' | |
E = { (-join( $_.SerialNumberID | %{[char]$_ } )) | ?{$_ -ne 0} } | |
}, | |
@{ | |
N = 'MonitorType' | |
E = { (-join( $_.UserFriendlyName | %{[char]$_ } )) | ?{$_ -ne ''} } | |
} | |
) | |
Get-CimInstance -Class wmiMonitorID -namespace root\wmi -ComputerName $ComputerName | Select $MonitorSelect | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Get-WmiObject
toGet-CimInstance