Search The Web

Showing posts with label Windows XP. Show all posts
Showing posts with label Windows XP. Show all posts

Saturday, March 30, 2013

Remove Network Printers from Command Line or Script



Remove Network Printers from Command Line or Script


There are several options when it comes to removing printers via command line / script.The first option is to use the "rundll32 printui.dll" method. For this, open a command prompt and type:

rundll32 printui.dll,PrintUIEntry /dn /n \\printsvr\printername

if you want the operation to be silent, then use the /q switch at the end. this is especially useful if you have multiple printers that you want to remove via a batch file and/or if you are unsure if the printers are installed on the end users machines. If the printer is not currently installed and you attempt to remove it without the /q switch then you will receive an error. The figure below shows the command in its entirety:
Remove Network Printers from Command Line or Script
The next method would be to use a VB script such as this :
to make the script work, just replace the \\PRINTSERVER\PRINTERNAME" field with the details of your network printer and save as a .vbs file. to call the script just open up an administrator command prompt and type in " cscript scriptname.vbs " where scriptname is the name of your script.
To delete more printers just another line to the  " Dim sPrinterName "  lines with the printer number at the end, and then again  add another objNetwork.RemovePrinterConnection sPrinterName2, True, True line that reflects the printer number you just added.
Likewise, to remove only one printer just remove one of the above lines.


Option Explicit

  Dim objNetwork, objPrinters

  Set objNetwork = CreateObject("WScript.Network")
  Set objPrinters = objNetwork.EnumPrinterConnections

  ' ### Delete selected network printer

  Dim sPrinterName1
 Dim sPrinterName2
  sPrinterName1 = "\\PRINTSERVER\PRINTERNAME"
 sPrinterName2 = "\\PRINTSERVER\PRINTERNAME"
  objNetwork.RemovePrinterConnection sPrinterName1, True, True
 objNetwork.RemovePrinterConnection sPrinterName2, True, True

I found with this method however that it will error out if that printer does not exist. im not enough of a VB guru to tell you if its possible to quieten it down to run silently.

When all is said and done, there is a much better way of doing this, and that is with Group Policy Preferences. this gives you centralized control over your printer environments, allowing you to add and remove and update printers for small groups or your entire organisation.
Group Policy Preferences will be covered for printers in an upcoming entry.
This article can also be found on our You Tube Channel:















Monday, March 4, 2013

PowerShell - Set Execution Policy - Files Could not be Loaded because the running of scripts is disabled on this system.

PowerShell - Set Execution Policy -  Files Could not be Loaded because the running of scripts is disabled on this system.


when using PowerShell you may get an error stating that " Files Could not be Loaded because the running of scripts is disabled on this system. Please provide a valid certificate with which to sign the files" as shown below:



This at a basic level means that your security settings in PowerShell are preventing you from running the script ( the execution policy.

To fix this, you need to set the execution policy to a more relaxed setting. these are as follows:

  • Restricted - No Scripts can be run. Windows PowerShell can only be used in interactive mode.
  • All Signed - Only Scripts signed by a trusted publisher can be run
  • RemoteSigned - Downloaded scripts must be signed by a trusted publisher before they can be run
  • Unrestricted - No Restrictions, any PowerShell script can be run
At the time of writing, PowerShell comes out of the box in restricted mode.

To check which execution policy your system is running type Get-ExecutionPolicy




To change to policy you type Set-Execution Policy . When you run and go to a less secure setting, you will get a large warning asking if you want to do so
e.g. Set-ExecutionPolicy RemoteSigned.




It's not recommended to use unsigned as this would allow anyone who accesses the system to run malicious or damaging code on your system. Most individuals will settle on Remote Signed, however before doing so in an organisation please ensure that this complies with your organisations security settings.

for a video walk through of this, please check this youtube video from our sister site www.dizzyit.com . The article can also be located there.




Wednesday, November 9, 2011

Printer Error 0x000003eb when installing printer

Printer Error 0x000003eb when installing printer



When trying to connect to a network printer you get the following error 0x000003eb :
For me, this turned out to be a printer driver issue. To determine this, i created a new printer on the server using the same IP, driver, permissions etc and the problem again occurred.
I then changed the printer driver to a random driver  ( of a printer model that i know works OK on the server) on both the new and existing printer objects and ta-da the printer worked.
While researching this, i also found reference to the print spooler service crashing, however this was not a symptom in my case. IMHO, if the service is crashing when you install your printer, this probably points to a driver issue anyways

Thursday, September 22, 2011

how do i add domain users as local admins?

how do i add domain users as local admins?


In environments where you must have local admin access (yes, this is far from ideal but we can get to that later) its not a good idea to add domin users to local admins unless you like you users to have admin rights over each others machines. this can be especially fun in a school / college environment!

a better way to manage this is to have the logged in user on the machine (aka interactive account) become a local admin for its logged in tenure.

the command to do so is (from a dos prompt or batch file):

net localgroup Administrators interactive /add










once again, its far better to avoid local admin access, but if you have to use it, this is the best way i have found to manage it


Thursday, April 22, 2010

How do I prevent XP from running checkdisk?

this tweak prevents XP from running checkdisk when it gets an unclean shutdown. I have found in the past that that sometimes a machine will want to continually check disk every time you reboot for no apparant reason, even though the hard drive is OK

the fastest way i found to circumvent this is to do the following:

open the registry editor: [start] [run] [regedit]
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager
REG_MULTI_SZ: BootExecute=""

in the box you will see " autocheck autochk * " remove these and no more pesky check disk.

obviously, if you suspect your HDD of being fried, this isnt the best solution to just bury your head in the sand!

how do i delete files and folders stored on this computer in XP?

This reg setting deletes the " files and folders stored on this computer" icons shown at the top of Windows explorer / my computer screens in XP. These icons can provide a security concern on shared computers with users being able to see each others files. To remove :

open the registry editor:

[Start] [Run] [Regedit]
Registry Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\
Explorer\MyComputer\NameSpace\DelegateFolders

In the left pane, delete the sub-key {59031a47-3f72-44a7-89c5-5595fe6b30ee}

Exit Registry and Reboot