Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Author: Chris Kennedy
- #Description: Configures Vive driver power save settings so that the driver is never put to sleep.
- #Version History:
- #1.0 [2018-07-25] - Initial Release
- Clear-Host
- #Check to see if this is running as administrator, and if not provide a UAC message and relaunch script.
- $currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
- if (!($currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))) {
- Write-Host "I have detected that the script is not running as an Administrator."
- Write-Host "I will relaunch the script. If you see a prompt from 'User Account Control' asking if you want to allow PowerShell to make changes, you must click 'Yes'."
- Pause
- Start-Process -FilePath PowerShell -Verb runas -ArgumentList "-File $($PSCommandPath) -ExecutionPolicy Bypass"
- Exit
- }
- Write-Host "It should take just a moment to find the proper key."
- #Gathers all the subkeys
- $registryRoot = Get-ChildItem "HKLM:\SYSTEM\CurrentControlSet\Control\Class\{4d36e96c-e325-11ce-bfc1-08002be10318}" -ErrorAction Ignore
- #Iterates through each subkey so we can determine if we need to touch it.
- foreach ($subkey in $registryRoot) {
- $driverKey = Get-ItemProperty -Path $subkey.PSPath
- #The only one we want to change is the one for NVIDIA HD Audio
- if ($driverKey.DriverDesc -eq "NVIDIA High Definition Audio") {
- Write-Host "NVIDIA Driver located, setting proper values."
- $powerKey = Get-ItemProperty -PSPath "$($subkey.PSPath)\PowerSettings"
- try {
- Set-ItemProperty -Path $powerKey.PSPath -Name ConservationIdleTime -Value ([byte[]](0xFF, 0xFF, 0xFF, 0xFF))
- Set-ItemProperty -Path $powerKey.PSPath -Name PerformanceIdleTime -Value ([byte[]](0xFF, 0xFF, 0xFF, 0xFF))
- Set-ItemProperty -Path $powerKey.PSPath -Name IdlePowerState -Value ([byte[]](0x00, 0x00, 0x00, 0x00))
- Write-Host "Successfully configured the registry, a reboot may be required for changes to take effect."
- Pause
- Exit
- }
- catch {
- Write-Host "Failed - $($_.Exception.Message)"
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement