Changing VM screen resolution under Virtual Server

Changing VM screen resolution under Virtual Server

  • Comments 2

The other day I was asked (by a fellow Microsoft employee) how to change the resolution on a Virtual Server virtual machine.  The reason why he wanted to do this was so that he could put the stand alone VMRC client into full screen mode on his laptop (which runs at 1400 x 1050) and not have to deal with bad pixel scaling due to mismatched resolutions.

So I came up with this handy little script:

vmname = InputBox("Enter the virtual machine name to resize", _
   
      "Virtual machine name")
vmresx = InputBox("Enter the width of the display desired" + _
         " (must be between 640 and 1600 and divisible by 8)", _
         "Virtual display width")
vmresy = InputBox("Enter the height of the display desired" + _
         " (must be between 480 and 1200 and divisible by 8)", _
         "Virtual display height")

Set objVS = CreateObject("VirtualServer.Application")
set objVM = objVS.FindVirtualMachine(vmname)

objVM.Display.SetDimensions vmresx,vmresy

This will only work while the virtual machine is running, and if you are running a Windows virtual machine with Virtual Machine Additions installed - but it is quite handy for setting a custom, non-standard resolution (I have a couple of virtual machines configured to run at 800 x 800 now - just for giggles).

Cheers,
Ben

Leave a Comment
  • Please add 2 and 5 and type the answer here:
  • Post
  • Hi, were do you actually insert this script? Is it in the command arguments for the Virtual Server or command arguments for the Virtual Machine? Thanks!
  • How to use this script? could you please elaborate.

Page 1 of 1 (2 items)