【发布时间】:2019-05-10 05:44:45
【问题描述】:
我有以下 powershell 脚本:
$registrypath = "HKLM:\SYSTEM\CurrentControlSet\Control\DeviceGuard"
$Name = "EnableVirtualizationBasedSecurity"
$ExpectedValue = "1"
$value = Get-ItemProperty -Path $registrypath -Name $Name
Write-Host($value)
它的输出是:
@{EnableVirtualizationBasedSecurity=1; PSPath=Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DeviceGuard; PSParentPath=Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control; PSChildName=DeviceGuard; PSDrive=HKLM;
PSProvider=Microsoft.PowerShell.Core\Registry}
我想将其中的 EnableVirtualizationBasedSecurity 字段的值获取到我的 powershell 脚本中的一个变量中。
点赞$SpecificFieldValue = $value.get(EnableVirtualizationBasedSecurity);
我如何在 powershell 中做到这一点?
【问题讨论】:
标签: windows powershell powershell-4.0