$cred = Get-Crendetials
A window will open and you can enter your admin-user credentials and now they are stored in $cred and there is no need to enter them over and over again.
Enter-PSSession servername -Credential $cred
The PSDrive cmdlet shows me the available providers I can connect to, filesystem, Registry, ActiveDirectory or Certificate Store by default for example.
Get-PSDrive
Name Used (GB) Free (GB) Provider Root
---- --------- --------- -------- ----
Alias Alias
C 402,81 46,34 FileSystem C:\ -> Filesystem
Cert Certificate \ -> Certificate Store
HKCU Registry HKEY_CURRENT_USER -> Registry
HKLM Registry HKEY_LOCAL_MACHINE -> Registry
I was interested in editing the Registry, that's why I connect to HKEY_LOCAL_MACHINE:
cd HKLM:
I don't remember the exact location, where to find the Registry entry that will allow the RDP connection, but it was under "Control":
cd '.\SYSTEM\CurrentControlSet\Control
This was the part I could remember, now I have to search for the missing pattern, because it was something like *Fdeny*:
ls -Recurse -ea SilentlyContinue | where-object {($_.property -LIKE "*fdeny*")}
Output:
Hive: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
Name Property
---- --------
Terminal Server RCDependentServices : {CertPropSvc, SessionEnv}
NotificationTimeOut : 0
SnapshotMonitors : 1
ProductVersion : 5.1
AllowRemoteRPC : 0
DelayConMgrTimeout : 0
[b] fDenyTSConnections : 1[/b]
StartRCM : 0
TSAdvertise : 0
DeleteTempDirsOnExit : 1
fSingleSessionPerUser : 1
PerSessionTempDir : 0
TSUserEnabled : 0
InstanceID : b667f9ec-e8ba-46a5-9c1b-5efdb5b
This helps! It is the fDenyTSConnections Property I need to change!
Set-ItemProperty -Path '.\Terminal Server' -name fDenyTSConnections -Value 0
Again Get-ItemProperty '.\Terminal Server' can help to verify the changes.
netsh advfirewall firewall set rule group="Remote Desktop" new enable=Yes
Note that in some languages you have to use "remotedesktop" instead.
Set-NetFirewallRule -DisplayGroup "Remote Desktop" -Enabled True
Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.
Comments (0)