How do I set new screen resolution for a headless server (using teamviewer 10 )

I'm using VNC and this command works for me: xrandr --fb 1366x768


After a lot of trial and error, I determined the following commands on the remotely controlled machine (the headless machine) will increase the resolution of the screen seen by Teamviewer.

xrandr --newmode "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
xrandr --addmode VIRTUAL1 1920x1080_60.00
xrandr --output VIRTUAL1 --mode 1920x1080_60.00
xrandr --output LVDS1 --off

The commands should be executed on the the headless machine when it starts up, but if this cannot be achieved they can be executed from the remote machine using a low resolution connection. The screen can then be set to a higher resolution.