+ Post New Thread
Results 1 to 4 of 4
Scripts Thread, Print Sharing Scripts in Coding and Web Development; Hello I was hoping somebody might have a good script I could use for print sharing. The printer is attached ...
  1. #1
    Bankesy's Avatar
    Join Date
    Jan 2011
    Location
    Chelmsford
    Posts
    109
    Thank Post
    4
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Print Sharing Scripts

    Hello

    I was hoping somebody might have a good script I could use for print sharing.

    The printer is attached to a machine running Windows Vista and needs to be accessed from another machine running Vista as well as 2 machines running XP.

    My plan is to put the script in the start up folder for all users so anybody who logs on can see the printer.

    Thankyou

  2. #2
    rh91uk's Avatar
    Join Date
    Sep 2008
    Location
    UK
    Posts
    877
    Thank Post
    137
    Thanked 132 Times in 114 Posts
    Rep Power
    36
    Try this ....... you will need to share the printer out from the original PC.

    Set net = WScript.CreateObject("wscript.network")

    net.SetDefaultPrinter "\\pc\printer"

  3. #3
    Bankesy's Avatar
    Join Date
    Jan 2011
    Location
    Chelmsford
    Posts
    109
    Thank Post
    4
    Thanked 1 Time in 1 Post
    Rep Power
    0
    Hello

    Can anybody suggest why the following print sharing script appears to not work with Vista but does work with XP and 7?

    @ECHO OFF
    ECHO Installing <PRINTER>...
    %logonserver%\netlogon\adprintx /cd "\\<MACHINE NAME>\<PRINTER NAME>"
    ECHO Finished...
    EXIT

    Thankyou

  4. #4
    thesk8rjesus's Avatar
    Join Date
    Sep 2008
    Posts
    107
    Thank Post
    11
    Thanked 6 Times in 6 Posts
    Rep Power
    14
    '===========================================
    ' Creating Variables
    '===========================================
    ON ERROR RESUME NEXT
    Dim objNetwork, objPrinter
    Set objNetwork = CreateObject("WScript.Network")
    Set objPrinter = objNetwork.EnumPrinterConnections

    '===========================================
    ' Deleting All Network Printers
    '===========================================
    objNetwork.RemovePrinterConnection "\\%MachineName%\%PrinterShareName%", True, True

    '===========================================
    ' Adding New Printers
    '===========================================
    objNetwork.AddWindowsPrinterConnection "\\%MachineName%\%PrinterShareName%"

    '===========================================
    ' Setting Default Printer
    '===========================================
    objNetwork.SetDefaultPrinter "\\%MachineName%\%PrinterShareName%"


    '===========================================
    ' Clearing Memmory
    '===========================================
    Set objNetwork = Nothing
    Set objPrinter = Nothing


    Save this as a .vbs script this is what we use at our school this will work with all versions of windows, and does funny things on mac



SHARE:
+ Post New Thread

Similar Threads

  1. File and Print Sharing Group Policy
    By gollops in forum Wireless Networks
    Replies: 3
    Last Post: 3rd December 2012, 11:45 AM
  2. Print Sharing & Mapping
    By siadam in forum Windows Server 2000/2003
    Replies: 13
    Last Post: 20th December 2010, 08:46 PM
  3. File and Print Sharing Issue
    By Mr.Ben in forum Windows
    Replies: 2
    Last Post: 12th July 2010, 05:50 PM
  4. XP File and print sharing
    By spider6986 in forum Windows
    Replies: 3
    Last Post: 14th January 2010, 09:26 PM
  5. Help running scripts within scripts
    By SimpleSi in forum *nix
    Replies: 7
    Last Post: 7th March 2008, 10:23 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
  •