I normally use Windows Remote Desktop to connect to a server machine. All connection configs are saved in an .rdp
file.
I want to instead use PowerShell to connect to that same server, in a similar fashion as SSH. I researched and found about PowerShell remoting with Enter-PSSession
, but I don't know what arguments to give it.
What I know so far:
- Client machine OS: Windows 10. Host machine OS: Windows Server 2012 R2.
- Client and host machines are in different networks/Active Directories. Simply running
Enter-PSSession <HOSTNAME>
doesn't work. - Host machine's PSRemoting is enabled. If I'm on a machine in its same AD, it can be connected with
Enter-PSSession <HOSTNAME>
My question is, if I have a working .rdp
file, can I infer what's needed to PSRemote to a remote server? Or even better, can I pass that .rdp
file to a PS command to make the shell connection?