我正在尝试从GPO获取screensavertimeout值。
Import-module -Name PolicyFileEditor
$UserDir = "$env:windir\system32\GroupPolicy\User\registry.pol"
$RegPath = 'Software\Policies\Microsoft\Windows\Control Panel\Desktop'
$RegName = 'ScreenSaveTimeOut'
Get-PolicyFileEntry -Path $UserDir -Key $RegPath -ValueName $RegName | select Data
我得到的值为
60
如何只获取60而不是完整值?
答案 0 :(得分:0)
添加-ExpandProperty
https://devblogs.microsoft.com/powershell/select-expandproperty-propertyname/
Get-PolicyFileEntry -Path $UserDir -Key $RegPath -ValueName $RegName | Select -ExpandProperty Data