You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.5 KiB
42 lines
1.5 KiB
4 years ago
|
# 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"
|