使用する PowerShell 構成を登録しましたが、問題が発生しています。目的は、サービス アカウントがサーバーにリモートでアクセスできるようにする構成を実装し、他のことを実行する機能を許可せずにサーバーを再起動することでした。当然のことながら、JEA が最適であると思われました。構成を次のように登録しました。
#Create Role Capability file
$ServerRestartRole2012 = @{
Path = "$env:ProgramFiles\WindowsPowerShell\Modules\JEAServerRestart\RoleCapabilities\ServerRestarter.psrc"
Author = "xx"
Company = "xx"
VisibleCmdlets = 'Restart-Computer'
ModulesToImport = 'Microsoft.PowerShell.Management'
}
New-PSRoleCapabilityFile @ServerRestartRole2012
#Create JEA Config
$ServerRestartConfig2012 = @{
Path = "$env:ProgramData\JEA\JEAServerRestart.pssc"
Author = "xx"
Description = "Allows for service account to reboot servers for Server Management Application"
SessionType = "RestrictedRemoteServer"
TranscriptDirectory = "$env:windir\Logs"
RunAsVirtualAccount = $true
RoleDefinitions = @{'xx\D7_APP_ServerRestart' = @{ RoleCapabilities = 'ServerRestarter'}}
}
New-PSSessionConfigurationFile @ServerRestartConfig2012
Register-PSSessionConfiguration -Name ServerRestarters -Path "$env:ProgramData\JEA\JEAServerRestart.pssc"
Restart-Service -Name WinRM
登録が成功し、「D7_APP_ServerRestart」グループに含まれるアカウントでセッションに入ることができます。使用Get-Command
すると期待どおりの結果が得られRestart-Computer
ますが、返されるメッセージを実行するPrivilege not held
と、セットアッププロセスの一部が欠けていますか?
EndPoint が登録されているサーバーは 2012R2 です。