I am trying to find a way to automate disabling of the Enhanced pointer precision in Powershell. I have all the data for the basis of the code but it appears to require calling some C code to run the API portion. I based a script on http://blogs.technet.com/b/heyscriptingguy/archive/2013/01/17/use-powershell-to-change-the-mouse-pointer-scheme.aspx
It generates a false response and the pointer option is still enabled when I check in the GUI. The registry Keys do get changed. Anyone good with C code able to fix this? According to the MSDN to change this parameter it requires:
- SPI_SETMOUSE
- 0x0004
Sets the two mouse threshold values and the mouse acceleration. The pvParam parameter must point to an array of three integers that specifies these values. See mouse eventfor further information.
The PShell registry values disable the Enhanced pointer precision by setting the three values to 0. Any way to force the UI to reread or reload the Mouse settings while a user is still logged in?
$RegConnect = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]"CurrentUser","$env:COMPUTERNAME")
$RegMouse = $RegConnect.OpenSubKey("Control Panel\Mouse",$true)
$RegMouse.SetValue("MouseSpeed","0")
$RegMouse.SetValue("MouseThreshold1","0")
$RegMouse.SetValue("MouseThreshold2","0")
$RegMouse.Close()
$RegConnect.Close()
$CSharpSig = @'
[DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
public static extern bool SystemParametersInfo(
uint uiAction,
uint uiParam,
uint pvParam,
uint fWinIni);
'@
$SetMouse = Add-Type -MemberDefinition $CSharpSig -Name WinAPICall -Namespace SystemParamInfo –PassThru
$SetMouse::SystemParametersInfo(0x0004,0,0,0)