質問者
PowerShellでリモートシェルが実行できない

質問
-
お世話になります。
PowerShellを使用して、リモート先のPS1を実行したいのですが、
どうにもエラーとなってしまうため質問させていただきます。
これまで、Windows2012R2のサーバに対しては成功していた手順/シェルなのですが。
Windows2016のサーバに対して実行すると失敗していまします。
具体的には下記の通りです。
エラーとなってしまう箇所
・$PSSession = New-PSSession $R_Host -Credential $Credential
・ログ
New-PSSession : [xxx.xxx.xxx.xxx] Connecting to remote server xxx.xxx.xxx.xxx failed with the following error message : Access is denied.
For more information, see the about_Remote_Troubleshooting Help topic.
At E:\work\RemoteExec_test.ps1:93 char:14
+ $PSSession = New-PSSession $R_Host -Credential $Credential
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportExce
ption
+ FullyQualifiedErrorId : AccessDenied,PSSessionOpenFailedWin2016ではNew-PSSession の使い方が変わった等ありますでしょうか・・・?
なお、Windows2016側で下記は実行済です。
Enable-PSRemoting
Set-ExecutionPolicy Unrestricted
宜しくお願い致します。
- 移動 栗下 望Microsoft employee, Moderator 2018年8月28日 1:51 Windows Server > Windows Server 2016
- 編集済み bappa55 2018年8月28日 1:51
すべての返信
-
お世話になります。ご返信ありがとうございます。
- $Credential で指定された資格情報では接続先へのアクセス権限がない
→RDPやファイル共有では使用できるアカウントなのです。
-
接続先 (もしくは接続先までの経路) でファイアウォールが有効になっていて、接続を拒否している
→ファイアウォールは全部OFFにしています。ネットワークも同一NWに配置しています。 -
ワークグループ環境で、接続元に接続先を TrustedHosts に追加していない
→接続元では、Set-Item WSMan:\localhost\Client\TrustedHosts -Value "*" を実行しております。
他に何かお気づきの点はございませんでしょうか?
宜しくお願い致します。
-
LocalAccountTokenFilterPolicy の構成ではないでしょうかね。
hebikuzure
-
hebikuzureさんの「LocalAccountTokenFilterPolicy」についてざっくり補足すると、UACのその項目が有効だとAdministratorsグループのユーザはその影響を受けるということです。
ちなみに「Administrator」というアカウントは特別なので、また違った動きをします。よって、
・UACのLocalAccountTokenFilterPoliciが有効な場合:
Administratrsに所属していない、Remote Management Users グループユーザで接続する。
Administratorを使う。・UACのLocalAccountTokenFilterPoliciが無効:
Administratorsに所属しているユーザで接続する。
Remote Management Usersグループのユーザで接続する。
Administratorを使う。で通るはずです。
- 編集済み やき(Yaki) 2018年8月30日 3:05