I am struggling to open a remote PS session on a remote server (Windows Server 2022 Standard). The remote server is not part of a domain.
When running the command
Enter-PSSession -ComputerName server01 -Credential server01\administrator
I receive "Access is denied".
What I have done:
- server
Enable-PSRemoting
Enable-WSManCredSSP -Role server
- client
Add-Content -Path C:\Windows\System32\drivers\etc\hosts -Value "`n192.168.1.250`tserver01"
winrm quickconfig
Set-Item WSMan:\localhost\Client\TrustedHosts -Value server01
When executing on client
Enter-PSSession -ComputerName server01 -Credential server01\administrator
and entering the password I receive:
Enter-PSSession : Beim Verbinden mit dem Remoteserver "server01" ist
folgender Fehler aufgetreten: Zugriff verweigert Weitere Informationen
finden Sie im Hilfethema "about_Remote_Troubleshooting". In Zeile:1
Zeichen:1
+ Enter-PSSession -ComputerName server01 -Credential server01\administrator
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (server01:String) [Enter-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : CreateRemoteRunspaceFailed
When executing on the client
winrm identify -r:http://server01:5985 -u:server01\Administrator -p:secret
I receive
WSManFault
Message = Zugriff verweigert
Fehlernummer: -2147024891 0x80070005 Zugriff verweigert
What am I missing?
UPDATE:
In winrm config I set Auth/Basic
and AllowUnencrypted
to true
(both client and service) - same result. I then configured HTTPS access with a self signed certificate - same result.
As there is no entry in Microsoft-Windows-Windows Remote Management/Operational
on server side it looks like the request is blocked on client side. Test-NetConnection -ComputerName server01 -Port 5985
succeeds (as it does with port 5986).