PS-對使用者的遠端 shell 訪問

PS-對使用者的遠端 shell 訪問

我目前正在手動向用戶添加完全控制。請參閱下面的螢幕截圖。但這需要透過PS腳本來完成。https://blogs.technet.microsoft.com/heyscriptingguy/2010/11/18/use-powershell-to-set-security-permissions-for-remoting/鏈接,但我在逐個執行此操作時遇到錯誤。請建議。

錯誤-

PS C:\Windows\system32> $user = "bsg\sisyphus"
PS C:\Windows\system32> $accval = New-Object Security.Principal.NTAccount $user
PS C:\Windows\system32> $accval

Value
-----
bsg\sisyphus


PS C:\Windows\system32> $sid = $accval.Translate([Security.Principal.SecurityIdentifier]).Value
Exception calling "Translate" with "1" argument(s): "Some or all identity references could not be translated."
At line:1 char:1
+ $sid = $accval.Translate([Security.Principal.SecurityIdentifier]).Val ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : IdentityNotMappedException

在此輸入影像描述

答案1

嘗試將 Security.Principal.NTAccount 重新命名為 System.Security.Principal.NTAccount 並查看是否收到其他錯誤。

相關內容