Powershell: use logged on credentials to logon to RDP?


Is there a way to pass credentials with which I'm logged on to my Windows system to an RDP session (mostly Windows 7/2012)?
So that would be  mstsc /admin /v:$computername
then using  @runas /user:$env:USERDOMAIN\$env:USERNAME  with cachedcredentials.

Please advise.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NEnterprise Systems EngineerCommented:

I was looking for something very similar yesterday and found the following:


While not the same scenario as yourself it certainly implies that you can't pass the cached credentials.  I'm no expert on powershell though so happy to stand corrected!
Philip ElderTechnical Architect - HA/Compute/StorageCommented:
To set things up so that a domain user can log on to internal Remote Desktop Services Session Hosts and RemoteApp services Single-Sign On needs to be set up in Group Policy.

Once that's done then any connection to an RDS setup would automagically log the user in.

This should apply for a Virtual Desktop Infrastructure (VDI) setup with desktop operating systems served via RDS.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
janhoedtAuthor Commented:
what gpo to set/use?
Philip ElderTechnical Architect - HA/Compute/StorageCommented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.