I'm trying to pause a windows 7 print queue using C#.NET visual studio 2008. I have full administrator rights but when I run the following code to Pause the Queue it says Access is Denied. Please help me.
LocalPrintServer lps = new LocalPrintServer(PrintSystemDesiredAccess.AdministrateServer);
//PrintServer lps = new PrintServer("\\\\NOTEBOOK-CI3", PrintSystemDesiredAccess.AdministratePrinter);
lps.Commit();
PrintQueue queue = lps.GetPrintQueue(listBox1.SelectedItem.ToString());
if (!queue.IsPaused)
queue.Pause();
queue.Commit();
lps.Commit();