我正在努力让WSMan使用Basic authorizaion.我总是得到Access Denied错误.Kerberos验证工作正常.
Windows远程管理服务在域A中的Windows Server 2008 R2上运行,并具有以下配置:
Config
MaxEnvelopeSizekb = 800
MaxTimeoutms = 600000
MaxBatchItems = 20
MaxProviderRequests = 4294967295
Client
NetworkDelayms = 5000
URLPrefix = wsman
AllowUnencrypted = false
Auth
Basic = true
Digest = true
Kerberos = true
Negotiate = true
Certificate = true
CredSSP = false
DefaultPorts
HTTP = 5985
HTTPS = 5986
TrustedHosts = *
Service
RootSDDL = O:NSG:BAD:P(A;;GA;;;S-1-5-21-2516571543-3809851355-1508507046-1008)(A;;GA;;;BA)(A;;GAGXGWGR;;;S-1-5-21-3465154619-3242790773-2173928322-17804)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)
MaxConcurrentOperations = 4294967295
MaxConcurrentOperationsPerUser = 200
EnumerationTimeoutms = 600000
MaxConnections = 15
MaxPacketRetrievalTimeSeconds = 120
AllowUnencrypted = … 这个自我回答的问题侧重于 Windows [1],解决了以下几个方面:
现在有两个PowerShell 版本- 传统的、仅限Windows 的 Windows PowerShell和跨平台的 PowerShell Core,两者都可以安装在给定的 Windows 机器上:
如何判断哪个 PowerShell 版本将执行远程命令,例如 via Invoke-Command -ComputerName?
我如何通过配置针对特定版本,包括临时的和持久的?
笔记:
对于要在给定机器上通过远程处理可定位的版本,必须将其设置为远程处理:
只有Windows PowerShell中被自动设置为远程处理,但只能在服务器上运行Windows Server 2012或更高版本。
从 v7 开始,PowerShell Core还没有随 Windows 一起提供;如果您使用的是官方安装程序,则可以选择在安装过程中启用远程处理。
在任何情况下,您都可以根据Enable-PSRemoting需要(重新)启用 PowerShell 远程处理,其中:
必须从相应的版本运行。
必须以管理权限运行
[1] 也就是说,问题集中在基于WinRM的远程处理上(WinRM 是 DTMF …
从 macOS 终端,当我执行时:
pwsh -command "Enter-PSSession myhost"
Run Code Online (Sandbox Code Playgroud)
我从 PowerShell 收到错误消息:
pwsh -command "Enter-PSSession myhost"
Run Code Online (Sandbox Code Playgroud)
我花了 2 个小时才找到解决方案。我要回答我自己的问题。
对于交换,uri使用的连接是:
http://machineName/powershell
Run Code Online (Sandbox Code Playgroud)
WSManConnectionInfo对象按以下方式创建:
WSManConnectionInfo connectionInfo = new WSManConnectionInfo(new Uri("http://machineName/powershell"), "http://schemas.microsoft.com/powershell/Microsoft.Exchange", ExchangeCredential)
Run Code Online (Sandbox Code Playgroud)
要连接到Windows,使用的是uri
http://machineName:5985/wsman
Run Code Online (Sandbox Code Playgroud)
WSManConnectionInfo对象按以下方式创建:
WSManConnectionInfo connectionInfo = new WSManConnectionInfo(new Uri("http://machineName:5985/wsman"), "http://schemas.microsoft.com/powershell/Microsoft.PowerShell", credential);
Run Code Online (Sandbox Code Playgroud)
为什么交换和窗口的连接uri有区别?