1 changed files with 42 additions and 0 deletions
@ -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" |
Loading…
issues.context.reference_issue