0
I'm trying to run some automated GUI tests without a screen by using the command
tscon 3 /dest:console
This worked great on a Windows Server 2008 (32bit) but I'm trying to move everything to Windows Server 2008 R2 (64bit) and running into a problem with this. On the original machine it was no problem to run the tests without a screen for multiple times (without entering the machine by RDP). Now on the new machine the tests are also able to run with the same command for one time but when trying it for a second time (without entering the machine by using RDP) I get the error:
Error [7045]:The requested session access is denied.
I tried to use the following script found on this issue:
for /f %%i in ('qwinsta ^| grep "^>" ^| awk "{print $4}"') do set VAR=%%i
tscon %var% /dest:console
but it also only works the 1st time. The second time it also returns ID 3 but then I get the access is denied error.
You should answer your own question and mark it as good answer. – K_Rol – 2016-11-10T22:17:18.813
I've found the solution, use the command with runas! runas /savecred /user:yogurt\administrator "tscon.exe 3 /dest:console" , to pass the password for the administrator use the script on http://www.sysopt.com/showthread.php?153867-quot-runas-quot-command-line-without-manually-typing-a-password
– Nicholas – 2014-04-04T12:22:56.540