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

[code language=”powershell”]
$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)
[/code]

References

Hey Scripting Guy!
SystemParametersInfo

Leave a comment

Your email address will not be published. Required fields are marked *

WordPress Appliance - Powered by TurnKey Linux