2023-11-14 15:45:48 -06:00
|
|
|
Function Invoke-WinUtilMouseAcceleration {
|
|
|
|
<#
|
|
|
|
|
|
|
|
.SYNOPSIS
|
|
|
|
Enables/Disables Mouse Acceleration
|
|
|
|
|
|
|
|
.PARAMETER DarkMoveEnabled
|
|
|
|
Indicates the current Mouse Acceleration State
|
|
|
|
|
|
|
|
#>
|
|
|
|
Param($MouseAccelerationEnabled)
|
2024-08-06 15:35:17 -05:00
|
|
|
try {
|
|
|
|
if ($MouseAccelerationEnabled -eq $false) {
|
2023-11-14 15:45:48 -06:00
|
|
|
Write-Host "Enabling Mouse Acceleration"
|
|
|
|
$MouseSpeed = 1
|
|
|
|
$MouseThreshold1 = 6
|
|
|
|
$MouseThreshold2 = 10
|
2024-08-06 15:35:17 -05:00
|
|
|
} else {
|
2023-11-14 15:45:48 -06:00
|
|
|
Write-Host "Disabling Mouse Acceleration"
|
|
|
|
$MouseSpeed = 0
|
|
|
|
$MouseThreshold1 = 0
|
2024-06-28 17:15:39 -05:00
|
|
|
$MouseThreshold2 = 0
|
|
|
|
|
2023-11-14 15:45:48 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
$Path = "HKCU:\Control Panel\Mouse"
|
|
|
|
Set-ItemProperty -Path $Path -Name MouseSpeed -Value $MouseSpeed
|
|
|
|
Set-ItemProperty -Path $Path -Name MouseThreshold1 -Value $MouseThreshold1
|
|
|
|
Set-ItemProperty -Path $Path -Name MouseThreshold2 -Value $MouseThreshold2
|
2024-08-06 15:35:17 -05:00
|
|
|
} catch [System.Security.SecurityException] {
|
2023-11-14 15:45:48 -06:00
|
|
|
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
2024-08-06 15:35:17 -05:00
|
|
|
} catch [System.Management.Automation.ItemNotFoundException] {
|
2023-11-14 15:45:48 -06:00
|
|
|
Write-Warning $psitem.Exception.ErrorRecord
|
2024-08-06 15:35:17 -05:00
|
|
|
} catch {
|
2023-11-14 15:45:48 -06:00
|
|
|
Write-Warning "Unable to set $Name due to unhandled exception"
|
|
|
|
Write-Warning $psitem.Exception.StackTrace
|
|
|
|
}
|
2024-08-06 15:35:17 -05:00
|
|
|
}
|