Get-WmiObject : Invalid namespace
At C:\Temp\bdb4988c-8ce2-4322-8e4f-ee32d4b61a01.ps1:11 char:22
+ $ts = get-WMIObject <<<< Win32_TerminalServiceSetting -computername $server -Namespace ROOT\CIMV2\TerminalServices
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
Function Get-RemoteDesktopConfig {
if ((Get-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server').fDenyTSConnections -eq 1)
{"Connections not allowed"}
elseif ((Get-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp').UserAuthentication -eq 1)
{"Only Secure Connections allowed"}
else
{"All Connections allowed"}
}
Get-RemoteDesktopConfig
This will give you what you want except the NLA information
Open in new window
Can you confirm which version of powershell you are using as there may be a way of using remote registry call to find out the NLa info.
Regards
Joe