@john_doe Try this, worked for me on a desktop:
Function Toggle-PowerSettingsVisibility {
$Title = 'Select option(s) to toggle visibility'
$PowerSettings = 'HKLM:\SYSTEM\CurrentControlSet\Control\Power\PowerSettings'
@( [PSCustomObject]@{
Attributes = 0
PSChildName = '{ -- No Changes -- }'
Name = ' "Safety" row to clear selection'
} ) +
@( Get-ChildItem $PowerSettings -Recurse | ? Property -contains 'Attributes' | Get-ItemProperty |
Select Attributes, PSCHildName,
@{ N = 'Name' ; E = { $_.FriendlyName.Split(',')[-1] }} ) | Sort PSChildName |
Out-GridView -Passthru -Title $Title | ForEach {
$Splat = @{
Path = Resolve-Path "$PowerSettings\*\$($_.PSChildName)"
Name = 'Attributes'
Value = -bNot $_.Attributes -bAnd 0x0000003
}
Set-ItemProperty @Splat -Confirm
}
}
Toggle-PowerSettingsVisibility
I think the issue was just that the comment markdown had borked some of the text by treating underlines as italics, etc.