

If ($PowerSettingsorg.Alias -eq $desiredScheme. How to Fix: Power Plan Keeps Changing on Windows 10.Command Used: powercfg -restoredefaultschemesOne of the issues that many Windows 10 users are reporting i. $hpPlan = Get-WmiObject -Namespace root\cimv2\power -Class win32_powerplan | Where-Object Write-host "++ Power Plan Settings are correct.!" If ($PowerSettings.IsActive -eq $True -And $PowerSettings.ElementName -eq 'Hoge prestaties') $PowerSettings = Get-WmiObject -Namespace root\cimv2\power -Class win32_powerplan

I got the following at this moment: $PowerSettingsorg = Get-WmiObject -Namespace root\cimv2\power -Class win32_powerplan I came up with something like this, but it feels like the -and statements fail to work, or am I doing something terribly wrong? How can I make a PowerShell script to check the current Power plan, change it to "High performance" (if it's not already), then run a long PowerShell script, then after the script, switch back to the original power plan?
