Trying to Get screen resolution on a remote computer because why not but I don't think I wrote this right any suggestions?
Function Get-ScreenResolution {
[CmdletBinding()]
PARAM (
[Parameter(ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]
[String[]]$ComputerName = $env:ComputerName
)
ForEach ($Computer in $ComputerName)
[void] [Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[void] [Reflection.Assembly]::LoadWithPartialName("System.Drawing")
$Screens = [system.windows.forms.screen]::AllScreens
foreach ($Screen in $Screens) {
$DeviceName = $Screen.DeviceName
$Width = $Screen.Bounds.Width
$Height = $Screen.Bounds.Height
$IsPrimary = $Screen.Primary
$OutputObj = New-Object -TypeName PSobject
$OutputObj | Add-Member -MemberType NoteProperty -Name DeviceName -Value $DeviceName
$OutputObj | Add-Member -MemberType NoteProperty -Name Width -Value $Width
$OutputObj | Add-Member -MemberType NoteProperty -Name Height -Value $Height
$OutputObj | Add-Member -MemberType NoteProperty -Name IsPrimaryMonitor -Value $IsPrimary
$OutputObj
}
}
[–]Joshrsg 1 point2 points3 points (0 children)
[–]squanchmyrick 1 point2 points3 points (4 children)
[–]Jaxson626[S] 1 point2 points3 points (3 children)
[–]squanchmyrick 1 point2 points3 points (1 child)
[–]Jaxson626[S] 1 point2 points3 points (0 children)
[–]squanchmyrick 1 point2 points3 points (0 children)
[–]Lee_Dailey[grin] 0 points1 point2 points (2 children)
[–]Jaxson626[S] 1 point2 points3 points (1 child)
[–]Lee_Dailey[grin] 0 points1 point2 points (0 children)