Powershell远程

"

 本身如果是domain, 又是服务器, wsman 已经起来

但在workground 下, 需要2边enable wsman , 加trustedhosts. 才可以。


设定winrm 需要把winrm 服务起来, (Win 10 那边, win2019 本身就enable 了。)

winrm set winrm/config/client '@{TrustedHosts="服务器名字"}'

设定完可以把stop-service winrm

 

如果要在 windows 远程 hyperv  , 还要enable-wsmancredssp ,

不知为什么我运行powershell 有error

Enable-WSManCredSSP : This command cannot be executed because the setting cannot be enabled.

我直接改regkey 就可了..

 

New-Item -path hklm:\SOFTWARE\Policies\Microsoft\Windows\CredentialsDelegation\AllowFreshCredentia

New-Item -path hklm:\SOFTWARE\Policies\Microsoft\Windows\CredentialsDelegation\AllowFreshCredentialsWhenNTLMOnly


New-ItemProperty -path hklm:\SOFTWARE\Policies\Microsoft\Windows\CredentialsDelegation -Name AllowFreshCredentials -Value 1 -PropertyType Dword

New-ItemProperty -path hklm:\SOFTWARE\Policies\Microsoft\Windows\CredentialsDelegation -Name ConcatenateDefaults_AllowSaved -Value 1 -PropertyType Dword
New-ItemProperty -path hklm:\SOFTWARE\Policies\Microsoft\Windows\CredentialsDelegation -Name AllowFreshCredentialsWhenNTLMOnly -Value 1 -PropertyType Dword

New-ItemProperty -path hklm:\SOFTWARE\Policies\Microsoft\Windows\CredentialsDelegation\AllowFreshCredentials -Name 1 -Value wsman/HyberVserver.local -PropertyType String
New-ItemProperty -path hklm:\SOFTWARE\Policies\Microsoft\Windows\CredentialsDelegation\AllowFreshCredentials -Name 2 -Value wsman/HyberVserver -PropertyType String

留言