Last active
March 4, 2018 23:10
-
-
Save HamousOnWheels/0fdce05087373904fdd19f7de3b295ed to your computer and use it in GitHub Desktop.
Reset crashed Wacom drivers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Reset crashed Wacom drivers and restore settings automatically (since they can get lost on stopping the service). | |
| # Tested with driver version 6.3.27-2. Restart your painting app after running the script. | |
| #elevation | |
| If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) | |
| { | |
| $arguments = "& '" + $myinvocation.mycommand.definition + "'" | |
| Start-Process powershell -Verb runAs -ArgumentList $arguments | |
| Break | |
| } | |
| #backup the settings | |
| & "C:\Program Files\Tablet\Wacom\32\PrefUtil.exe" /backup "$ENV:UserProfile\Documents\WacomBackup.wacomprefs" | |
| $running = Get-Service WTabletServicePro | |
| #restart the service, if it still isn't running keep trying | |
| do | |
| { | |
| "restarting Wacom service..." | |
| Restart-Service "WTabletServicePro" | |
| Write-Host $running.Status | |
| Start-Sleep -Seconds 2 | |
| $running.Refresh() | |
| if ($running.Status -eq 'Running') #now we're talkin | |
| { | |
| "restoring settings..." | |
| & "C:\Program Files\Tablet\Wacom\32\PrefUtil.exe" /restore /silent "$ENV:UserProfile\Documents\WacomBackup.wacomprefs" | |
| Wait-Process -Name PrefUtil #wait until prefutil is done. For some reason it's faster with the /silent switch | |
| } | |
| } while ($running.Status -ne 'Running') | |
| Read-Host -Prompt "Done. Press Enter to exit and then restart your painting app" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment