+ Post New Thread
Results 1 to 5 of 5
Scripts Thread, Printer script and the adding of printers from a long dead server! in Coding and Web Development; I've started using a simple script to map my printers: Code: Set WshNetwork = CreateObject("WScript.Network") On Error Resume Next Set ...
  1. #1
    Gibbo's Avatar
    Join Date
    Feb 2008
    Location
    Cheshire
    Posts
    908
    Thank Post
    207
    Thanked 344 Times in 238 Posts
    Rep Power
    93

    Printer script and the adding of printers from a long dead server!

    I've started using a simple script to map my printers:

    Code:
    Set WshNetwork = CreateObject("WScript.Network")
    On Error Resume Next
    Set oPrinters = WshNetwork.EnumPrinterConnections
            For i = 1 to oPrinters.Count - 1 Step 2
                  WshNetwork.RemovePrinterConnection oPrinters.Item(i)
            Next
    
    Set WshNetwork = CreateObject("WScript.Network")
    WshNetwork.AddWindowsPrinterConnection "\\HP-SERVER\PRINTIT1"
    WshNetwork.AddWindowsPrinterConnection "\\HP-SERVER\PRINTIT2"
    WshNetwork.AddWindowsPrinterConnection "\\HP-SERVER\PRINTIT3"
    WshNetwork.AddWindowsPrinterConnection "\\HP-SERVER\PRINTIT4"
    WshNetwork.AddWindowsPrinterConnection "\\HP-SERVER\PRINTLRC"
    WshNetwork.AddWindowsPrinterConnection "\\HP-SERVER\PRINTART"
    WshNetwork.AddWindowsPrinterConnection "\\HP-SERVER\PRINTMUSIC"
    
    rem ** Setup default printer **
    WshNetwork.SetDefaultPrinter "\\HP-SERVER\PRINTLRC"
    But when the pupils logon they're also getting

    CF-SERVER\PRINTLRC
    CF-SERVER\PRINTIT1
    CF-SERVER\PRINTIT2

    CF-SERVER was the print server but was wiped back in 2008 and doesn't have any printers on it at all.

    Any idea where it could be pulling this information from? The registry shows nothing for CF-SERVER.

    TIA

  2. #2


    Join Date
    Jul 2007
    Location
    Rural heck
    Posts
    2,662
    Thank Post
    120
    Thanked 434 Times in 353 Posts
    Rep Power
    126
    WshNetwork.RemovePrinterConnection "\\server\printer", true, true

    can be used to zap it. It could be being stored in a profile.

  3. Thanks to K.C.Leblanc from:

    Gibbo (21st September 2010)

  4. #3
    Gibbo's Avatar
    Join Date
    Feb 2008
    Location
    Cheshire
    Posts
    908
    Thank Post
    207
    Thanked 344 Times in 238 Posts
    Rep Power
    93
    Just about to add that I've narrowed it down to the pupil's mandatory profile!

    For some reason it's adding the rogue server to the registry at HKLM\Software\Microsoft\Windows NT\CurrentVersion\Print\Providers\LanMan Print Services\Servers

  5. #4


    Join Date
    Jul 2007
    Location
    Rural heck
    Posts
    2,662
    Thank Post
    120
    Thanked 434 Times in 353 Posts
    Rep Power
    126
    I've had that problem before, I can't remember how I fixed it. It'll probably be one of these./

    You can either make a copy of the profile, make it writeable (change ntuser.man to ntuser.man),assign it to an unrestricted account with no GPOS of scripts. Then log in the account remove the printers, log off the profile changes will be saved. Then test the profile and use it to replace the original student profile

    Of you can use regedit's load hive function to edit the ntuser.man file. Load a hive into the registry: Core Services. Don't edit a live student profile, make a copy edit the copy then test and copy back over.

  6. #5
    Gibbo's Avatar
    Join Date
    Feb 2008
    Location
    Cheshire
    Posts
    908
    Thank Post
    207
    Thanked 344 Times in 238 Posts
    Rep Power
    93
    All sorted. Gave an Admin account the mandatory profile. Logged in and removed the rogue printers.

    Found this old thread about it:

    Modifying a mandatory profile - printers

SHARE:
+ Post New Thread

Similar Threads

  1. Desktop authorty printer adding error rpc server unavailable
    By Hacksawbob in forum How do you do....it?
    Replies: 0
    Last Post: 14th January 2009, 07:44 AM
  2. Script to change printer server
    By button_ripple in forum Scripts
    Replies: 1
    Last Post: 16th September 2008, 12:29 PM
  3. Terminal server logon script for printers
    By cookie_monster in forum Scripts
    Replies: 11
    Last Post: 13th August 2008, 11:46 AM
  4. Script not deleting/adding printer correctly
    By dave.81 in forum Scripts
    Replies: 2
    Last Post: 5th June 2008, 01:17 PM
  5. Adding x32 printer drivers to x64 server
    By Dos_Box in forum Windows
    Replies: 7
    Last Post: 2nd May 2008, 10:35 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •