Dobby Posted October 9, 2005 Share Posted October 9, 2005 I've searched high and low (Google and MSFN Forum that is!) but can't find any command to share a printer without resorting to reg hacking (Not sure if even that can be done yet). NET SHARE seems to be the closest thing but for printers the only option is to delete shares and this doesn't even seem to work properly either (The share is still active according to Control Panel->Printers And Faxes).Help would be appreciated.Thanks. Link to comment Share on other sites More sharing options...
gunsmokingman Posted October 9, 2005 Share Posted October 9, 2005 Here is a VBS script that is supposed to share all printers on the networkHere is the link to the article where I found this script.Hey Script Guys Share Printer'''' This is for XP/2003 onlystrComputer = "."Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")Set colInstalledPrinters = objWMIService.ExecQuery _ ("Select * from Win32_Printer Where Network = FALSE")i = 1For Each objPrinter in colInstalledPrinters objPrinter.Shared = TRUE objPrinter.ShareName = "Printer" & i objPrinter.Put_ i = i + 1Next Link to comment Share on other sites More sharing options...
Dobby Posted October 9, 2005 Author Share Posted October 9, 2005 WOW! Thanks that was a quick response!! I started looking at printui.dll which might have worked if I installed the printers using this command instead of integrating them which is not ideal.Just tried the script and it works fine. Just need to change the share names to something a little more meaningful.Thanks very much. Link to comment Share on other sites More sharing options...
gunsmokingman Posted October 9, 2005 Share Posted October 9, 2005 here try it this way' these comment out the line in the script so they dont get read while the script is active.'''' This is for XP/2003 onlystrComputer = "."Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")Set colInstalledPrinters = objWMIService.ExecQuery _("Select * from Win32_Printer Where Network = FALSE")i = 1For Each objPrinter in colInstalledPrintersobjPrinter.Shared = TRUEobjPrinter.ShareName = "Printer" & i'If 'objPrinter.ShareName = "Place The PrinterName Here"'objPrinter.Put_'exit for'End Ifi = i + 1Next Link to comment Share on other sites More sharing options...
Dobby Posted October 9, 2005 Author Share Posted October 9, 2005 (edited) Actually the names do not need to be more meaningful as the Printer UI shows the full name of the printer anyway.I'm adding the connection to my client machine like this but it seems to always prompt 'You are about to connect to a printer on a server' :rundll32 printui.dll PrintUIEntry /in /n\\server\printer1I've tried the options /q /Gw to try to suppress them but doesn't seem to make any difference.I'll dig around further. Edited October 9, 2005 by Dobby Link to comment Share on other sites More sharing options...
Dobby Posted October 9, 2005 Author Share Posted October 9, 2005 Seems like someone else had the same problem:from http://www.msfn.org/board/index.php?s=&sho...ndpost&p=172024Printer.vbsSet WshShell = WScript.CreateObject ("WScript.Shell")WshShell.Run ("rundll32 printui.dll,PrintUIEntry /in /n\\studeerkamer\samsung /q")WScript.Sleep 5000WshShell.SendKeys "{ENTER}"WScript.QuitThanks again for your help. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now