Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;

public static class NativeMouse
{
    [DllImport("user32.dll", CharSet = CharSet.Auto)]
    public static extern bool SystemParametersInfo(
        uint uiAction, uint uiParam, int[] pvParam, uint fWinIni);

    [DllImport("user32.dll", CharSet = CharSet.Auto)]
    public static extern bool SystemParametersInfo(
        uint uiAction, uint uiParam, IntPtr pvParam, uint fWinIni);

    public const uint SPI_GETMOUSE = 0x0003;
    public const uint SPI_SETMOUSE = 0x0004;
    public const uint SPI_SETMOUSESPEED = 0x0071;

    public const uint SPIF_UPDATEINIFILE = 0x0001;
    public const uint SPIF_SENDCHANGE = 0x0002;
}
"@

$mouseParams = [int[]]::new(3)
[NativeMouse]::SystemParametersInfo(
    [NativeMouse]::SPI_GETMOUSE,
    0,
    $mouseParams,
    0
) | Out-Null
$mouseParams[2] = 0
[NativeMouse]::SystemParametersInfo(
    [NativeMouse]::SPI_SETMOUSE,
    0,
    $mouseParams,
    [NativeMouse]::SPIF_UPDATEINIFILE -bor [NativeMouse]::SPIF_SENDCHANGE
) | Out-Null
[NativeMouse]::SystemParametersInfo(
    [NativeMouse]::SPI_SETMOUSESPEED,
    0,
    [IntPtr]10,
    [NativeMouse]::SPIF_UPDATEINIFILE -bor [NativeMouse]::SPIF_SENDCHANGE
) | Out-Null

Write-Host "Mouse settings have been set."
Read-Host "Press Enter to exit..."
