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. 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, …

Disconnect ICA session from inside

[code language=”csharp” title=”C# .Net”] /******************************************************************** * Citrix Server SDK WFAPI Component * Author: Siva Mulpuru * The following code invokes the WFDisconnectSession in WFAPI.dll * Works on XenDesktop and Xenapp ICA session **********************************************************************/ using System; using System.ComponentModel; using System.Runtime.InteropServices; namespace ICA_Disconnect { class Program { const int CurrentSession = -1; static readonly IntPtr CurrentServer = …

SetDefaultPrinter using Pinvoke and Powershell

[code language=”powershell” wraplines=”false” collapse=”false”] $code = @’ using System; using System.Runtime.InteropServices; namespace ChangeDefaultPrinter { public class Program { [DllImport("Winspool.drv", CharSet=CharSet.Auto, SetLastError=true)] private static extern bool SetDefaultPrinter(string printerName); public static bool Run(string PrinterName) { bool default_result = SetDefaultPrinter(PrinterName); return default_result; } } } ‘@ cls Add-Type -TypeDefinition $code -Language CSharp #Set Default Printer – for network …

Programmatically remove Public Folders under Windows 7 Libraries

Download Orinal source code from Microsoft CSWin7ShellLibrary.exe Modify Source to the following class Program { static void Main(string[] args) { string[] LibArray = new string[] { “Pictures”, “Videos”, “Documents”, “Music” }; foreach (string libraryName in LibArray) { using (ShellLibrary library = ShellLibrary.Load(libraryName, false)) { string folderPath = “C:\\Users\\Public\\” + libraryName; library.Remove(folderPath); } } } } …

Powershell [System.Printing] – Add/Remove network printers – WMI alternative

Script ########################################################################### # # NAME: EP-Printer-Connction.ps1 # # AUTHOR: smulpuru # # COMMENT: Adding network printers using .Net System.Printing Class # # VERSION HISTORY: # 1.0 3/2/2012 – Initial release # ########################################################################### Add-Type -AssemblyName System.Printing $printerTXT = “\\FILESRV01\Printer_Scripts\EPprinters.txt” if(Test-Path $printerTXT) { $allRead = Get-Content $printerTXT #for citrix using sessionstate monitor – http://support.citrix.com/article/CTX127491 – #$endPointClientName will …

C# MULTI-THREADING DEMO

########################################################################### # # NAME: MThreadingDemo # # AUTHOR: SivaMulpuru # # COMMENT: This Program illustrates the advantage of using multithreading # # VERSION HISTORY: # 1.0 5/4/2011 – Initial release # ########################################################################### using System; using System.Threading; using System.Diagnostics; //for Stopwatch class Program {     static void Main(string[] args)     {         Console.WriteLine("Processor Count is {0}\n", Environment.ProcessorCount);         Stopwatch stopwatch = new Stopwatch();         Console.WriteLine("#################SingleThread####################");         stopwatch.Start();         Console.WriteLine("Fibonacci of {0} is {1}", 40, Fibonacci(40).ToString());         Console.WriteLine("Fibonacci of {0} is {1}", 41, Fibonacci(41).ToString());         stopwatch.Stop();    Console.WriteLine("Time taken for Fibonacci of {0} and {1} asynchronously is {2} secs",                             40, 41, stopwatch.ElapsedMilliseconds / 1000);         Console.WriteLine("#################SingleThreadEnd#################\n");         Console.WriteLine("#################TwoThreads####################");         int[] x = new int[2];         Thread[] threads = new Thread[2];         x[0] = 40;         x[1] = 41;         stopwatch.Restart(); …

WordPress Appliance - Powered by TurnKey Linux