From f5bf592b135b78caf8665b3c2e703c88595fce71 Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 22 Jun 2020 16:00:20 +0000 Subject: [PATCH] Upload files to '' --- elanfix.ps1 | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 elanfix.ps1 diff --git a/elanfix.ps1 b/elanfix.ps1 new file mode 100644 index 0000000..09ffede --- /dev/null +++ b/elanfix.ps1 @@ -0,0 +1,42 @@ +# set path to registry key +$reg = "HKCU:\Software\Elantech\SmartPadDisplay" + +# get properties of key +$regprops = Get-ItemProperty -Path $reg -Name * + +# get members of properties +# this is because $props is a single row with columns for each property +# we'll filter out non-integer properties and any methods, since we only care about the int values +$members = $regprops | gm | ?{$_.MemberType -eq "NoteProperty" -and $_.Definition -like "int*"} + +# the definition property of each $member contains the current reg value and the property name +# clean up $member.definition string +$members = $members.Definition.Replace("int ","") + +# loop through members and create a new object array of property and value +$props = @() +foreach ($m in $members) +{ + $msplit = $m.Split("=") + $mprop = $msplit[0] + $mval = $msplit[1] + + $obj = New-Object -TypeName PSObject + Add-Member -InputObject $obj -MemberType NoteProperty -Name "Property" -Value $mprop + Add-Member -InputObject $obj -MemberType NoteProperty -Name "Value" -Value ([int]$mval) + + $props += $obj +} + +# $props now has an array of registry key properties and their corresponding values +# for every value of 0, change it to a 1 in the registry +foreach ($p in $props) +{ + if ($p.Value -eq 0) + { + New-ItemProperty -Path $reg -Name $p.Property -Value "1" -PropertyType DWORD -Force | Out-Null + } +} + +# Run the control panel +Invoke-Item "C:\Program Files\Elantech\ETDAniConf.exe" \ No newline at end of file