STEAM CSOPORT
Steam Remote Play homestream
STEAM CSOPORT
Steam Remote Play homestream
3,118
JÁTÉKBAN
36,410
ONLINE
Alapítva:
2013. november 7.
Összes téma > General Discussion > Téma részletei
Guide: Unlock a Windows host screen using Remote Desktop & a simple script.
TL;DR
Run this script as administrator:

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$sessionid=((quser $env:USERNAME | select -Skip 1) -split '\s+')[2]; tscon $sessionid /dest:console" 2> UnlockErrors.log

Who is this guide for?

  • Security conscious users who DO NOT want to set up auto-login on their host Windows machines.
  • Users who use Remote Desktop to connect to their host machines (OPTIONAL - see Pre-requisites)
  • Users who keep their host machines always on OR use Wake-On-LAN to switch their host machines on remotely.
  • Lazy people like me who can't be bothered to walk two rooms over to unlock the host machines' screen in person.

Pre-requisites

  • Your host machine must be switched on (duh).
  • Your host machine must have Remote Desktop enabled and you must be able to login to it. If your client is a Windows machine you can use PsExec instead of using Remote Desktop. However, my client is a Mac so I need to use Remote Desktop. I may write a PsExec script which can be invoked from the client at some point, but I don't need it and I'm lazy so it might be a while (or never).
  • The user account you use to login to your host machine must have administrator privileges.

Putting It All Together

  1. Paste the script at the top into a text file and save it somewhere. I named mine UnlockScreen.cmd and saved it in my user directory.
  2. Create a shortcut to the script on your desktop or somewhere you can easily double-click on it from.
  3. Right-click the shortcut and bring up the Properties page.
  4. Click Advanced on the Shortcut tab
  5. Check the "Run as Administrator" checkbox and click OK
  6. Click OK again on the Properties page

Usage
  1. Remote into your machine and double-click the script. That's it. Simples.

NOTE: When you run the script, if it is successful your Remote Desktop session will end and will be disconnected. However, your host machine's screen will now be unlocked and you should be able to use Steam In-Home Streaming without Steam complaining with "The screen is locked on the remote computer" error.

Additional caveats - This has only been tested on a Windows 8.1 (now upgraded to Windows 10) Pro host machine. In theory it should work on Windows 7 and Windows 8 too, but if you have any issues have a look for anything obvious in the UnlockErrors.log file otherwise post here and I'll try to help if I can.

As noted here by mattrummins, the script will not work on Home versions of Windows.
Legutóbb szerkesztette: amorpheous; 2017. jan. 8., 17:03
< >
3145/77 megjegyzés mutatása
Hi! What's the difference between your scrip and something more simple like:

tscon.exe 4 /dest:console
omgobby eredeti hozzászólása:
Hi! What's the difference between your scrip and something more simple like:

tscon.exe 4 /dest:console

The script will get the correct session ID rather than you having to guess what it is. I just tried running your command and got "Session ID 4 not found". I tried with 1 and it worked so it can be different for different people/setups hence querying the session ID and using it in the command is more robust.
Confirmed working on Windows 10. Thanks!
Did everything as prescribed. Logged into RDP into my user account, double clicked the ADMIN privileged shortcut to the UNLOCK.CMD file. A dialogue pops up briefly in the background (CMD line). Then it finishes. No errors - but also does not appear to shut down the open RDP window. It just stays open. If I manually close RDP and go to steam on the host computer it tells me the screen is locked.

Not sure what is going on.

Running WIn 10 Home Anniversary Update
Use RDPWrap to unlock RDP capability on Win 10 Home
Followed all your instructions to a T
Is TSCON something missing in Win 10 Home? Is this due to Win 10 Anniversary?

Thanks for all your free help! Would love to enable my laziness of not walking across the house at night to get some late night games in from my Surface Pro 4 tablet while in bed. :)
I should add, it's not 100% clear in your instructions, but this CMD line is a file on the HOST computer, not on the CLIENT...correct?
Is there an edit button in steam? If not...WTH?

In my original post, I mean "Manually close RDP and go to steam on the CLIENT computer...it tells me the screen is locked"
Yes, the command should be run on the host machine. If you try running the command in an administrator command prompt (right-click Start button -> "Command Prompt (Admin)") do you see any errors?
Thanks! This definitely works well for the video on the SteamLink, but the problem I have is no sound is streamed. Has anyone else had this?
powershell -NoProfile -ExecutionPolicy unrestricted -Command "$sessionid=(Get-Process -PID $pid).SessionID; tscon \"$sessionid\" /dest:console"

worked better for me as my username had spaces and this was more direct.
I have tried the original script and the one suggested by Ioconut above. No luck, the RDP session does not close and I still get the 'Screen Locked' response when trying to stream.

Here is the error log:
quser : The term 'quser' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:14
+ $sessionid=((quser $env:USERNAME | select -Skip 1) -split '\s+')[2]; ...
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (quser:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

tscon : The term 'tscon' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:70
+ ... quser $env:USERNAME | select -Skip 1) -split '\s+')[2]; tscon $sessio ...
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (tscon:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Any suggestions? I have read somewhere that if quser is not found this is because the powershell instance is running in x86 when it needs to be running in x64, but this is a little beyond me...
Legutóbb szerkesztette: mattrummins; 2017. jan. 2., 14:34
I had to do the following on Windows 10 x64:

%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy unrestricted -Command "$sessionid=(Get-Process -PID $pid).SessionID; %SYSTEMROOT%\System32\tscon.exe \"$sessionid\" /dest:console"

This fixed errors related to tscon not being recognized.
djpretzel eredeti hozzászólása:
I had to do the following on Windows 10 x64:

%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy unrestricted -Command "$sessionid=(Get-Process -PID $pid).SessionID; %SYSTEMROOT%\System32\tscon.exe \"$sessionid\" /dest:console"

This fixed errors related to tscon not being recognized.

I tried this suggestion - still no luck.
mattrummins eredeti hozzászólása:
I have tried the original script and the one suggested by Ioconut above. No luck, the RDP session does not close and I still get the 'Screen Locked' response when trying to stream.

Here is the error log:
quser : The term 'quser' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:14
+ $sessionid=((quser $env:USERNAME | select -Skip 1) -split '\s+')[2]; ...
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (quser:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

tscon : The term 'tscon' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:70
+ ... quser $env:USERNAME | select -Skip 1) -split '\s+')[2]; tscon $sessio ...
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (tscon:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Any suggestions? I have read somewhere that if quser is not found this is because the powershell instance is running in x86 when it needs to be running in x64, but this is a little beyond me...

Which version of Windows are you on? And is it 32-bit or 64-bit?
It is Windows 10 64 English Home version with RDPwrap. I am streaming from Windows 10 Pro in French (The language differences usually make no difference but thought I would mention it).
Legutóbb szerkesztette: mattrummins; 2017. jan. 5., 1:59
mattrummins eredeti hozzászólása:
It is Windows 10 64 English Home version with RDPwrap. I am streaming from Windows 10 Pro in French (The language differences usually make no difference but thought I would mention it).

I've never heard of RDPWrap before. It seems it's third party software that enables RDP on Home versions of Windows (since it doesn't ship with RDP). This probably explains why you don't have tscon.exe. Did you check if it exists in
%SYSTEMROOT%\System32
< >
3145/77 megjegyzés mutatása
Laponként: 1530 50

Összes téma > General Discussion > Téma részletei
Közzétéve: 2015. máj. 16., 6:58
Hozzászólások: 77