VMware Cloud Community
jvm2016
Hot Shot
Hot Shot

enabling_RDP_on windows vcenter_6.5

Hi Luc,

could you suggest on following.

1:i need to enable rdp on one of the windows vcenter .

is there any powershell command

also for somereasons not able to connect to console of that vm from webclient .

0 Kudos
18 Replies
LucD
Leadership
Leadership

I assume you are talking about the administrative RDP on a Windows box.

If yes, you could send the following via Invoke-VMScript to the VM.

Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -Name "fDenyTSConnections" -Value 0

Enable-NetFirewallRule -DisplayGroup "Remote Desktop"


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

0 Kudos
jvm2016
Hot Shot
Hot Shot

you mean folowing

Invoke-Command Computername server_on_which_rdptobeenabled" ScriptBlock {Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" Value 0 }

and then run

Invoke-Command Computername server_on_which_rdptobeenabled" ScriptBlock {Enable-NetFirewallRule -DisplayGroup "Remote Desktop"}

plesemodify if above is not correct or any prerequistes in terms of powershell remoting needed.
0 Kudos
LucD
Leadership
Leadership

That would work if remote sessions are configured on that server.

If it is a VM, with VMware Tools running, you could also do

$code = @'

Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" –Value 0

Enable-NetFirewallRule -DisplayGroup "Remote Desktop"

'@


Invoke-VMScript -VM “server_on_which_rdptobeenabled" -ScriptText $code


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

0 Kudos
jvm2016
Hot Shot
Hot Shot

Thanks luc.i m going to use it .

0 Kudos
jvm2016
Hot Shot
Hot Shot

i got following

pastedImage_0.png

0 Kudos
LucD
Leadership
Leadership

It looks like the credentials you use to run the cmdlet, do not have the required permissions in the guest OS.

Find an account that has these permission, and then use the GuestCredential or GuestUset/GuestPassword parameters on the Invoke-VMScript mdlet.


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

0 Kudos
jvm2016
Hot Shot
Hot Shot

iamdoing following

$gc=get-credential

$code = @'

Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" –Value 0

Enable-NetFirewallRule -DisplayGroup "Remote Desktop"

'@

Invoke-VMScript -VM “kilmanivc" -ScriptText $code -guestcredential $gc 

however i get general system error.

is there any powershell way to check permissions of my account on memberserver(the one which i m working right now)

0 Kudos
LucD
Leadership
Leadership

Do you get the same error as before when you provide the GuestCredentials?


The fastest way to check is to try to logon to the guest OS with that account.


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

0 Kudos
jvm2016
Hot Shot
Hot Shot

i m going to check this again .however error was different .

0 Kudos
LucD
Leadership
Leadership

Can you show the complete error message?


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

0 Kudos
HassanAlKak88
Expert
Expert

Hello,

To Enable Remote on windows machine use the below:

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /f /v UserAuthentication /t REG_DWORD /d 0

reg add "hklm\system\currentcontrolset\control\terminal server" /f /v fDenyTSConnections /t REG_DWORD /d 0

Please consider marking this answer "CORRECT" or "Helpful" if you think your question have been answered correctly.

Cheers,

VCIX6-NV|VCP-NV|VCP-DC|

@KakHassan

linkedin.com/in/hassanalkak


If my reply was helpful, I kindly ask you to like it and mark it as a solution

Regards,
Hassan Alkak
0 Kudos
jvm2016
Hot Shot
Hot Shot

pastedImage_0.png

0 Kudos
LucD
Leadership
Leadership

What VMware Tools version is that?

Did you already stop/start the VMware Tools in the guest OS?


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

0 Kudos
jvm2016
Hot Shot
Hot Shot

tools version

pastedImage_0.png

i did not start/stop tools in guest as i dont think its needed .

0 Kudos
LucD
Leadership
Leadership

Are you really sure about the guest credentials you are passing along?

Did you try to logon with those same credentials to the guest OS on the VM via a RDP session or via the console?
I saw that exact same message for incorrect guest credentials in the past.


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

0 Kudos
jvm2016
Hot Shot
Hot Shot

well the  the console of vm on which i want to enable rdp  is not connecting either to webclientor vsphere client .

so iam trying to run this script from a different pingable vm,and my id is part of domain admin group so i shoud have all permissions .

0 Kudos
LucD
Leadership
Leadership

Could you perhaps try to run this on another VM?

Just to be able to determine if the problem is only with specific VM or with all VMs


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

0 Kudos
jvm2016
Hot Shot
Hot Shot

ok im checking.

0 Kudos