次の2つのオプションがあります列挙オブジェクトのプロパティと対話
#1:列挙自体と相互作用する、V3に導入
[Microsoft.PowerShell.ExecutionPolicy] | Get-Member -Static -MemberType Property
TypeName: Microsoft.PowerShell.ExecutionPolicy
Name MemberType Definition
---- ---------- ----------
AllSigned Property static Microsoft.PowerShell.ExecutionPolicy AllSigned {get;}
Bypass Property static Microsoft.PowerShell.ExecutionPolicy Bypass {get;}
Default Property static Microsoft.PowerShell.ExecutionPolicy Default {get;}
RemoteSigned Property static Microsoft.PowerShell.ExecutionPolicy RemoteSigned {get;}
Restricted Property static Microsoft.PowerShell.ExecutionPolicy Restricted {get;}
Undefined Property static Microsoft.PowerShell.ExecutionPolicy Undefined {get;}
Unrestricted Property static Microsoft.PowerShell.ExecutionPolicy Unrestricted {get;}
#2- (これは@PetSerAlがコメントしたものの短いバージョンです):
# Values()
[Microsoft.PowerShell.ExecutionPolicy].GetEnumNames()
Unrestricted
RemoteSigned
AllSigned
Restricted
Restricted
Bypass
Undefined
プリV3:
# Names()
[Enum]::GetValues('Microsoft.PowerShell.ExecutionPolicy')
'(Get-Commandコマンドセットexecutionpolicy).parameters.executionpolicy.ParameterType.GetEnumNames()'私はとても近かった – PetSerAl
、感謝 – todd1215