Powershell: Set Mouse Pointer Scheme to NONE for XenDesktop VM’s

Why to do this?

Better user experience; reduced cpu load on zero client devices like xenith compared to aero mouse scheme.

Mouse-Pointer-Scheme

Powershell Script

$RegConnect = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]"CurrentUser", "$env:COMPUTERNAME")
$RegCursors = $RegConnect.OpenSubKey("Control Panel\Cursors", $true)
$RegCursors.SetValue("", "")
$RegCursors.SetValue("AppStarting", "")
$RegCursors.SetValue("Arrow", "")
$RegCursors.SetValue("Crosshair", "")
$RegCursors.SetValue("Hand", "")
$RegCursors.SetValue("Help", "")
$RegCursors.SetValue("IBeam", "")
$RegCursors.SetValue("No", "")
$RegCursors.SetValue("NWPen", "")
$RegCursors.SetValue("Scheme Source", 0, 'DWord')
$RegCursors.SetValue("SizeAll", "")
$RegCursors.SetValue("SizeNESW", "")
$RegCursors.SetValue("SizeNS", "")
$RegCursors.SetValue("SizeNWSE", "")
$RegCursors.SetValue("SizeWE", "")
$RegCursors.SetValue("UpArrow", "")
$RegCursors.SetValue("Wait", "")
$RegCursors.Close()
$RegConnect.Close()

$CSharpSig = @'
[DllImport("user32.dll", SetLastError = true, EntryPoint = "SystemParametersInfo")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SystemParametersInfo(
                 uint uiAction,
                 uint uiParam,
                 bool pvParam,
                 uint fWinIni);
'@

$CursorRefresh = Add-Type -MemberDefinition $CSharpSig -Name WinAPICall -Namespace SystemParamInfo –PassThru
$CursorRefresh::SystemParametersInfo(0x0057, 0, $null, 0)

References

Hey Scripting Guy!
SystemParametersInfo

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s