WINRM Enter-Pssession が新しいマシンで動作しない

WINRM Enter-Pssession が新しいマシンで動作しない

新しいマシンで混合ドメイン モードで win rm を有効にしようとしています。

別のワークステーションからは、次のコマンドで接続できます。

Enter-PSSession -ComputerName 89.251.114.100 -Credential $mycred

新しいマシンで Enable-PSremoting を実行しましたが、次のコマンドを実行すると、次のようになります。

Enter-PSSession : Connecting to remote server failed with the following error message : Access is denied. For more info rmation, see the about_Remote_Troubleshooting Help topic. At C:\Users\Dev1\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:93 char:17 + Enter-PSSession <<<< -ComputerName 89.251.114.100 -Credential $mycred + CategoryInfo : InvalidArgument: (00.000.000.000:String) [Enter-PSSession], PSRemotingTransportException + FullyQualifiedErrorId : CreateRemoteRunspaceFailed

奇妙に思えるのは InvalidArgument です。

興味深いことに、次のようにしてリモート コマンドを実行できます。

powershell.exe -ExecutionPolicy 制限なし C:\root\deploy.ps1 -inputformat なし

答え1

PSCredential オブジェクト内のユーザー アカウントは、ターゲット マシンの管理者グループに属していますか?

winrm quickconfig新しいマシンで管理者特権のコマンド プロンプトを使用して実行しましたか? winrm サービスが開始され、対応するファイアウォール例外を使用して TCP ポート 5985 に winrm リスナーが作成されます。その後、実行しwinrs -r:http://<targetmachine>:5985 -u:<targetmachine>\<administrator account> "dir c:\"て C: の内容が出力されるかどうかを確認できます。これにより、winrm が正しく動作していることがわかります。

その後、ターゲット マシンで Enable-PSRemoting を再度実行してみてください (再度、管理者特権の Powershell プロンプトで)。

関連情報