I have a simple wsf that enable remote desktop on windows 2012. I have no problem setting the registry value, but my netsh command doesn't seem to work, and with no error
Function ZTIProcess()
iRetVal = Success
ZTIProcess = iRetval
oLogging.CreateEntry "Configure - Enable Remote Desktop: Starting", LogTypeInfo
oShell.RegWrite "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\fDenyTSConnections",0 ,"REG_DWORD"
oShell.RegWrite "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\UserAuthentication",1 ,"REG_DWORD"
iRetVal = oShell.Run("netsh advfirewall firewall set rule group='Remote Desktop' new enable=Yes")
if (iRetVal = 0) or (iRetVal = 3010) then
ZTIProcess = Success
Else
ZTIProcess = Failure
End If
oLogging.CreateEntry "Configure Remote Desktop: Return code value = " & iRetVal, LogTypeInfo
oLogging.CreateEntry "Configure Remote Desktop: Completed Enabling Remote Desktop", LogTypeI
End Function
When I try to run the netsh command [netsh advfirewall firewall set rule group='Remote Desktop' new enable=Yes] in an elevated command prompt on the server, it works without issue, so I presume the syntax is correct. Do I need to set elevated privilege within my task sequence to make this work?