VMware Cloud Community
NeenaJim
Enthusiast
Enthusiast

RDP a server by command line

Hello,

Can someone please help me to share the command line that I can RDP servers using my user name and account.

Connect-Mstsc -ComputerName '<VM Name>' -User '<domain/username>' -Password '<password>'

When I tried the above command I am getting this error:

Connect-Mstsc : The term 'Connect-Mstsc' is not recognized as the name of a cmdlet, function, script file, or operable
program.

I tried this too, but no luck:
mstsc /v:<VM Name> -User '<domain/username>' -Password '<password>'

0 Kudos
4 Replies
LucD
Leadership
Leadership

I'm not sure why you ask that question on the PowerCLI forum.
The Connect-MsTsc function is a community-contributed function on the MSFT site.

The v parameter on the mstsc command needs to the hostname of FQDN of the Guest OS running on the VM.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
scott28tt
VMware Employee
VMware Employee

@NeenaJim 

That is a Microsoft cmdlet for PowerShell, not a VMware cmdlet for PowerCLI - you’re asking on the wrong vendor’s forum.


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
0 Kudos
NeenaJim
Enthusiast
Enthusiast

Hello,

I am really sorry. I didnt know that I am supposed to ask this question in a different forum. I have asked this question in MS forum:
https://social.technet.microsoft.com/Forums/en-US/aed9e82e-fc1f-4725-9da5-84367a9b7540/rdp-a-server-...

Since I was stuck at my search I thought to post this question here since we have all great people here like you all.

I tried with FQDN as well, but no luck. In addition to my post: I am getting RDP window, but it is asking for password. User name is automatically taking. My need is connect (RDP) the server properly by a command line with my user name and password. I have asked this question in MS forum.

Thank you though for guiding me

0 Kudos
LucD
Leadership
Leadership

Since the Connect-MsTsc function is not a standard cmdlet, you will have to

- dot-source the function before calling it

- include it in the .ps1 file from which you call the Connect-MstTsc function

The mstsc command doesn't take a -User nor -Password parameter afaik.
You can check by running 'mstsc /?' and check what are the valid parameters


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos