Hi,
is it possible to read the VM´s display-resolution usin PowerCLI ?
Thx
Chakoe
Hi Chakoe
You can use this in PowerCLI
$vm = Get-VM -Name <vm_name>
$vm.Guest.ExtensionData.Screen
Returns:
Width Height DynamicType DynamicProperty
----- ------ ----------- ---------------
1024 768
Hi,
works fine, but i´m missing the VM-Name in the first column of the table...
And is it possible to set the Resolution within an script?
thx
Chakoe
I personally don't know of a way to do it using only PowerCLI/PowerShell, I think you will need to use inline C#, which would make it something of a pain to do.
See here for more info:
You could invoke that script in the guest using Invoke-VMScript from PowerCLI.
Oh, also you don't need to use ExtensionData to get the screen resolution, instead your code can just be: $vm.Guest.ScreenDimensions
Hi,
and how do i add the column " VM-Name" to the output-table?
Try this simple script:
Get-VM | % {
$row = "" | select VMName, Width, Height
$row.VMName = $_.Name
$row.Width = $_.Extensiondata.Guest.Screen.Width
$row.Height = $_.Extensiondata.Guest.Screen.Height
$row
}
Regards,
Yasen
Message was edited by: ykalchev