Dro*_*ick 4 windows powershell
有没有办法在不创建对象 $obj 的情况下执行以下操作?
$obj = New-Object System.Security.Principal.NTAccount("Students") ; $obj.Translate([System.Security.Principal.SecurityIdentifier]).Value
Run Code Online (Sandbox Code Playgroud)
我尝试过管道,如下所示:
New-Object System.Security.Principal.NTAccount("Students") | $_.Translate([System.Security.Principal.SecurityIdentifier]).Value
Run Code Online (Sandbox Code Playgroud)
但出现以下错误:
Expressions are only allowed as the first element of a pipeline.
At line:1 char:128
+ New-Object System.Security.Principal.NTAccount("Students") | $_.Translate([System.Security.Principal.SecurityIdentifi
er]).Value <<<<
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ExpressionsMustBeFirstInPipeline
Run Code Online (Sandbox Code Playgroud)
提前致谢!
$(New-Object System.Security.Principal.NTAccount("Students")).Translate([System.Security.Principal.SecurityIdentifier]).Value
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
13572 次 |
最近记录: |