RE: [ActiveDir] Help with VB script to map printers
Title: RE: [ActiveDir] Help with VB script to map printers If you are using that exact script. Line eight asks for UNCpath3 Line 3 4 specify UNCpath2 change UNCpath2 on line 4 to UNCpath3 hth Rick From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Noah Eiger Sent: Wednesday, December 07, 2005 1:10 PM To: ActiveDir@mail.activedir.org Subject: [ActiveDir] Help with _vbscript_ to map printers Hi I am trying to modify a VBS found on the Internet to map multiple printers. This will be run for every user in an OU. I keep getting the following error for line 8: 8007007B - The filename, directory name or volume syntax is incorrect I have played around with the syntax but think I am missing something very basic here. Any thoughts? I got this from: http://www.computerperformance.co.uk/ezine/ezine16.htm#Example%203:%20Mapping%20Multiple%20Printers ' Poached from Guy Thomas February 2004. ' ** Dim multiPrinter, UNCpath1, UNCpath2, UNCpath3 UNCpath1 = \\server.abc.private\HP Color LaserJet 3500 UNCpath2 = \\server.abc.private\HP LaserJet 3300 UNCpath2 = \\server.abc.private\HP LaserJet 5000 Set multiPrinter = CreateObject(WScript.Network) multiPrinter.AddWindowsPrinterConnection UNCpath1 multiPrinter.AddWindowsPrinterConnection UNCpath2 multiPrinter.AddWindowsPrinterConnection UNCpath3 ' WScript.Echo Your printer is mapped from : UNCpath1 _ ' and from : UNCpath2 WScript.Quit ' End of _vbscript_
Re: [ActiveDir] Help with VB script to map printers
Below is an example in my environment: If IsMember("GROUPNAME") Then MapDrive "G:", "\\SERVER\SHARE$" (I hide all my user shares) MapDrive "P:", "\\SERVER\SHARE-2$" gDrive ="G:\" pDrive ="P:\" oShell.NameSpace(gDrive).Self.Name = " RENAME Share" (Rename the hidden share) oShell.NameSpace(pDrive).Self.Name = "RENAME Share" Prn.AddWindowsPrinterConnection "\\Server\PrinterName" (Map the group to a network printer) Prn.SetDefaultPrinter "\\Server\PrinterName" (Set the default printer for a group/OU) End If ** Let me know if someone wants the full script. -Z.V. Active Directory wrote: RE: [ActiveDir] Help with _vbscript_ to map printers If you are using that exact script. Line eight asks for UNCpath3 Line 3 4 specify UNCpath2 change UNCpath2 on line 4 to UNCpath3 hth Rick From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Noah Eiger Sent: Wednesday, December 07, 2005 1:10 PM To: ActiveDir@mail.activedir.org Subject: [ActiveDir] Help with _vbscript_ to map printers Hi I am trying to modify a VBS found on the Internet to map multiple printers. This will be run for every user in an OU. I keep getting the following error for line 8: 8007007B - The filename, directory name or volume syntax is incorrect I have played around with the syntax but think I am missing something very basic here. Any thoughts? I got this from: http://www.computerperformance.co.uk/ezine/ezine16.htm#Example%203:%20Mapping%20Multiple%20Printers ' Poached from Guy Thomas February 2004. ' ** Dim multiPrinter, UNCpath1, UNCpath2, UNCpath3 UNCpath1 = "\\server.abc.private\HP Color LaserJet 3500" UNCpath2 = "\\server.abc.private\HP LaserJet 3300" UNCpath2 = "\\server.abc.private\HP LaserJet 5000" Set multiPrinter = CreateObject("WScript.Network") multiPrinter.AddWindowsPrinterConnection UNCpath1 multiPrinter.AddWindowsPrinterConnection UNCpath2 multiPrinter.AddWindowsPrinterConnection UNCpath3 ' WScript.Echo "Your printer is mapped from : " UNCpath1 _ ' "and from : " UNCpath2 WScript.Quit ' End of _vbscript_ List info : http://www.activedir.org/List.aspx List FAQ: http://www.activedir.org/ListFAQ.aspx List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/
RE: [ActiveDir] Help with VB script to map printers
BAHHH! now works for me too! Must have been a Hotfix MS released recently hehe --- Rich Milburn MCSE, Microsoft MVP - Directory Services Sr Network Analyst, Field Platform Development Applebee's International, Inc. 4551 W. 107th St Overland Park, KS 66207 913-967-2819 -- I love the smell of red herrings in the morning - anonymous From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ed Crowley [MVP] Sent: Wednesday, December 07, 2005 2:33 PM To: ActiveDir@mail.activedir.org Subject: RE: [ActiveDir] Help with _vbscript_ to map printers Strange. I've never had problems with double double-quotes in a _vbscript_. Ed Crowley MCSE+Internet MVP Freelance E-Mail Philosopher Protecting the world from PSTs and Bricked Backups! From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rich Milburn Sent: Wednesday, December 07, 2005 12:17 PM To: ActiveDir@mail.activedir.org Subject: RE: [ActiveDir] Help with _vbscript_ to map printers Try using Chr(34) instead of quotes for your paths i.e. UNCpath1 = \\server.abc.private\ Chr(34) HP Color LaserJet 3500 Chr(34) Chr(34) is how you get quotes into a string at least its the only way Ive ever gotten to work my WSH doesnt seem to like the double quotes I see some people use sometimes (i.e. MsgBox I said, Hello. would always give me an error. MsgBox I said, chr(34) Hello. Chr(34) works) Rich --- Rich Milburn MCSE, Microsoft MVP - Directory Services Sr Network Analyst, Field Platform Development Applebee's International, Inc. 4551 W. 107th St Overland Park, KS 66207 913-967-2819 -- I love the smell of red herrings in the morning - anonymous From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Noah Eiger Sent: Wednesday, December 07, 2005 1:10 PM To: ActiveDir@mail.activedir.org Subject: [ActiveDir] Help with _vbscript_ to map printers Hi I am trying to modify a VBS found on the Internet to map multiple printers. This will be run for every user in an OU. I keep getting the following error for line 8: 8007007B - The filename, directory name or volume syntax is incorrect I have played around with the syntax but think I am missing something very basic here. Any thoughts? I got this from: http://www.computerperformance.co.uk/ezine/ezine16.htm#Example%203:%20Mapping%20Multiple%20Printers ' Poached from Guy Thomas February 2004. ' ** Dim multiPrinter, UNCpath1, UNCpath2, UNCpath3 UNCpath1 = \\server.abc.private\HP Color LaserJet 3500 UNCpath2 = \\server.abc.private\HP LaserJet 3300 UNCpath2 = \\server.abc.private\HP LaserJet 5000 Set multiPrinter = CreateObject(WScript.Network) multiPrinter.AddWindowsPrinterConnection UNCpath1 multiPrinter.AddWindowsPrinterConnection UNCpath2 multiPrinter.AddWindowsPrinterConnection UNCpath3 ' WScript.Echo Your printer is mapped from : UNCpath1 _ ' and from : UNCpath2 WScript.Quit ' End of _vbscript_ ---APPLEBEE'S INTERNATIONAL, INC. CONFIDENTIALITY NOTICE--- PRIVILEGED / CONFIDENTIAL INFORMATION may be contained in this message or any attachments. This information is strictly confidential and may be subject to attorney-client privilege. This message is intended only for the use of the named addressee. If you are not the intended recipient of this message, unauthorized forwarding, printing, copying, distribution, or using such information is strictly prohibited and may be unlawful. If you have received this in error, you should kindly notify the sender by reply e-mail and immediately destroy this message. Unauthorized interception of this e-mail is a violation of federal criminal law. Applebee's International, Inc. reserves the right to monitor and review the content of all messages sent to and from this e-mail address. Messages sent to or from this e-mail address may be stored on the Applebee's International, Inc. e-mail system. -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.371 / Virus Database: 267.13.12/194 - Release Date: 12/7/2005 ---APPLEBEE'S INTERNATIONAL, INC. CONFIDENTIALITY NOTICE--- PRIVILEGED / CONFIDENTIAL INFORMATION may be contained in this message or any attachments. This information is strictly confidential and may be subject to attorney-client privilege. This message is intended only for the use of the named addressee. If you are not the intended recipient of this message, unauthorized forwarding, printing, copying, distribution, or using such information is strictly prohibited and may be unlawful. If you have received this in error, you should kindly notify the sender by reply e-mail and
RE: [ActiveDir] Help with VB script to map printers
Hello Noah, besides from the other answers: Are you planning on implementing any single Windows Server 2003 R2 in the close future? If yes then you can use the print-managementconsole which will allow you to publish printers by group policy to either users or computers and you only need to run one command in your startup and logon-scripts to make the clients aware of that policy. Gruesse - Sincerely, Ulf B. Simon-Weidner MVP-Book Windows XP - Die Expertentipps: http://tinyurl.com/44zcz Weblog: http://msmvps.org/UlfBSimonWeidner Website: http://www.windowsserverfaq.org Profile:http://mvp.support.microsoft.com/profile=""> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Noah Eiger Sent: Wednesday, December 07, 2005 8:10 PM To: ActiveDir@mail.activedir.org Subject: [ActiveDir] Help with _vbscript_ to map printers Hi I am trying to modify a VBS found on the Internet to map multiple printers. This will be run for every user in an OU. I keep getting the following error for line 8: 8007007B - The filename, directory name or volume syntax is incorrect I have played around with the syntax but think I am missing something very basic here. Any thoughts? I got this from: http://www.computerperformance.co.uk/ezine/ezine16.htm#Example%203:%20Mapping%20Multiple%20Printers ' Poached from Guy Thomas February 2004. ' ** Dim multiPrinter, UNCpath1, UNCpath2, UNCpath3 UNCpath1 = \\server.abc.private\HP Color LaserJet 3500 UNCpath2 = \\server.abc.private\HP LaserJet 3300 UNCpath2 = \\server.abc.private\HP LaserJet 5000 Set multiPrinter = CreateObject(WScript.Network) multiPrinter.AddWindowsPrinterConnection UNCpath1 multiPrinter.AddWindowsPrinterConnection UNCpath2 multiPrinter.AddWindowsPrinterConnection UNCpath3 ' WScript.Echo Your printer is mapped from : UNCpath1 _ ' and from : UNCpath2 WScript.Quit ' End of _vbscript_ -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.371 / Virus Database: 267.13.12/194 - Release Date: 12/7/2005
RE: [ActiveDir] Help with VB script to map printers
My wsh book shows the command to be .AddPrinterConnection not .AddWindowsPrinterConnection HTH Thanks, JD Northrop Grumman Information Technology Commercial, State Local Solutions 512-377-x235 Alphapage 866-521-6091 E-Page [EMAIL PROTECTED] From: Noah Eiger [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 07, 2005 1:10 PM To: ActiveDir@mail.activedir.org Subject: [ActiveDir] Help with _vbscript_ to map printers Hi - I am trying to modify a VBS found on the Internet to map multiple printers. This will be run for every user in an OU. I keep getting the following error for line 8: 8007007B - The filename, directory name or volume syntax is incorrect I have played around with the syntax but think I am missing something very basic here. Any thoughts? I got this from: http://www.computerperformance.co.uk/ezine/ezine16.htm#Example%203:%20Mapping%20Multiple%20Printers ' Poached from Guy Thomas February 2004. ' ** Dim multiPrinter, UNCpath1, UNCpath2, UNCpath3 UNCpath1 = \\server.abc.private\HP Color LaserJet 3500 UNCpath2 = \\server.abc.private\HP LaserJet 3300 UNCpath2 = \\server.abc.private\HP LaserJet 5000 Set multiPrinter = CreateObject(WScript.Network) multiPrinter.AddWindowsPrinterConnection UNCpath1 multiPrinter.AddWindowsPrinterConnection UNCpath2 multiPrinter.AddWindowsPrinterConnection UNCpath3 ' WScript.Echo Your printer is mapped from : UNCpath1 _ ' and from : UNCpath2 WScript.Quit ' End of _vbscript_ -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.371 / Virus Database: 267.13.12/194 - Release Date: 12/7/2005
RE: [ActiveDir] Help with VB script to map printers
Actually both are valid. From: WILLIAMS, J.D.Sent: Wed 07/12/2005 2:31 PMTo: 'ActiveDir@mail.activedir.org'Cc: '[EMAIL PROTECTED]'Subject: RE: [ActiveDir] Help with _vbscript_ to map printers My wsh book shows the command to be .AddPrinterConnection not .AddWindowsPrinterConnection HTH Thanks, JD Northrop Grumman Information Technology Commercial, State Local Solutions512-377-x235 Alphapage 866-521-6091 E-Page [EMAIL PROTECTED] From: Noah Eiger [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 07, 2005 1:10 PMTo: ActiveDir@mail.activedir.orgSubject: [ActiveDir] Help with _vbscript_ to map printers Hi - I am trying to modify a VBS found on the Internet to map multiple printers. This will be run for every user in an OU. I keep getting the following error for line 8: 8007007B - The filename, directory name or volume syntax is incorrect I have played around with the syntax but think I am missing something very basic here. Any thoughts? I got this from: http://www.computerperformance.co.uk/ezine/ezine16.htm#Example%203:%20Mapping%20Multiple%20Printers ' Poached from Guy Thomas February 2004. ' ** Dim multiPrinter, UNCpath1, UNCpath2, UNCpath3 UNCpath1 = "\\server.abc.private\HP Color LaserJet 3500" UNCpath2 = "\\server.abc.private\HP LaserJet 3300" UNCpath2 = "\\server.abc.private\HP LaserJet 5000" Set multiPrinter = CreateObject("WScript.Network") multiPrinter.AddWindowsPrinterConnection UNCpath1 multiPrinter.AddWindowsPrinterConnection UNCpath2 multiPrinter.AddWindowsPrinterConnection UNCpath3 ' WScript.Echo "Your printer is mapped from : " UNCpath1 _ ' "and from : " UNCpath2 WScript.Quit ' End of _vbscript_ --No virus found in this outgoing message.Checked by AVG Free Edition.Version: 7.1.371 / Virus Database: 267.13.12/194 - Release Date: 12/7/2005
RE: [ActiveDir] Help with VB script to map printers
Try using Chr(34) instead of quotes for your paths i.e. UNCpath1 = \\server.abc.private\ Chr(34) HP Color LaserJet 3500 Chr(34) Chr(34) is how you get quotes into a string at least its the only way Ive ever gotten to work my WSH doesnt seem to like the double quotes I see some people use sometimes (i.e. MsgBox I said, Hello. would always give me an error. MsgBox I said, chr(34) Hello. Chr(34) works) Rich --- Rich Milburn MCSE, Microsoft MVP - Directory Services Sr Network Analyst, Field Platform Development Applebee's International, Inc. 4551 W. 107th St Overland Park, KS 66207 913-967-2819 -- I love the smell of red herrings in the morning - anonymous From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Noah Eiger Sent: Wednesday, December 07, 2005 1:10 PM To: ActiveDir@mail.activedir.org Subject: [ActiveDir] Help with _vbscript_ to map printers Hi I am trying to modify a VBS found on the Internet to map multiple printers. This will be run for every user in an OU. I keep getting the following error for line 8: 8007007B - The filename, directory name or volume syntax is incorrect I have played around with the syntax but think I am missing something very basic here. Any thoughts? I got this from: http://www.computerperformance.co.uk/ezine/ezine16.htm#Example%203:%20Mapping%20Multiple%20Printers ' Poached from Guy Thomas February 2004. ' ** Dim multiPrinter, UNCpath1, UNCpath2, UNCpath3 UNCpath1 = \\server.abc.private\HP Color LaserJet 3500 UNCpath2 = \\server.abc.private\HP LaserJet 3300 UNCpath2 = \\server.abc.private\HP LaserJet 5000 Set multiPrinter = CreateObject(WScript.Network) multiPrinter.AddWindowsPrinterConnection UNCpath1 multiPrinter.AddWindowsPrinterConnection UNCpath2 multiPrinter.AddWindowsPrinterConnection UNCpath3 ' WScript.Echo Your printer is mapped from : UNCpath1 _ ' and from : UNCpath2 WScript.Quit ' End of _vbscript_ ---APPLEBEE'S INTERNATIONAL, INC. CONFIDENTIALITY NOTICE--- PRIVILEGED / CONFIDENTIAL INFORMATION may be contained in this message or any attachments. This information is strictly confidential and may be subject to attorney-client privilege. This message is intended only for the use of the named addressee. If you are not the intended recipient of this message, unauthorized forwarding, printing, copying, distribution, or using such information is strictly prohibited and may be unlawful. If you have received this in error, you should kindly notify the sender by reply e-mail and immediately destroy this message. Unauthorized interception of this e-mail is a violation of federal criminal law. Applebee's International, Inc. reserves the right to monitor and review the content of all messages sent to and from this e-mail address. Messages sent to or from this e-mail address may be stored on the Applebee's International, Inc. e-mail system. -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.371 / Virus Database: 267.13.12/194 - Release Date: 12/7/2005
Re: [ActiveDir] Help with VB script to map printers
I'd guess that you have path problem. Try copying and pasting \\server.abc.private\HP Color LaserJet 3500 , with the quotes, in your start-run box and see if it connects that printer. If it doesn't work then you need to look at the ip name and share name, and double check security permissions. On 12/7/05, Noah Eiger [EMAIL PROTECTED] wrote: Hi – I am trying to modify a VBS found on the Internet to map multiple printers. This will be run for every user in an OU. I keep getting the following error for line 8: 8007007B - The filename, directory name or volume syntax is incorrect I have played around with the syntax but think I am missing something very basic here. Any thoughts? I got this from: http://www.computerperformance.co.uk/ezine/ezine16.htm#Example%203:%20Mapping%20Multiple%20Printers ' Poached from Guy Thomas February 2004. ' ** Dim multiPrinter, UNCpath1, UNCpath2, UNCpath3 UNCpath1 = \\server.abc.private\HP Color LaserJet 3500 UNCpath2 = \\server.abc.private\HP LaserJet 3300 UNCpath2 = \\server.abc.private\HP LaserJet 5000 Set multiPrinter = CreateObject(WScript.Network) multiPrinter.AddWindowsPrinterConnection UNCpath1 multiPrinter.AddWindowsPrinterConnection UNCpath2 multiPrinter.AddWindowsPrinterConnection UNCpath3 ' WScript.Echo Your printer is mapped from : UNCpath1 _ ' and from : UNCpath2 WScript.Quit ' End of _vbscript_ -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.371 / Virus Database: 267.13.12/194 - Release Date: 12/7/2005 -- Paul Wilkinson[EMAIL PROTECTED]
RE: [ActiveDir] Help with VB script to map printers
This should work: UNCpath1 = "\\server.abc.private\"HP Color LaserJet 3500""" Ed Crowley MCSE+Internet MVPFreelance E-Mail PhilosopherProtecting the world from PSTs and Bricked Backups! From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rich MilburnSent: Wednesday, December 07, 2005 12:17 PMTo: ActiveDir@mail.activedir.orgSubject: RE: [ActiveDir] Help with _vbscript_ to map printers Try using Chr(34) instead of quotes for your paths i.e. UNCpath1 = "\\server.abc.private\" Chr(34) HP Color LaserJet 3500" Chr(34) Chr(34) is how you get quotes into a string at least its the only way Ive ever gotten to work my WSH doesnt seem to like the double quotes I see some people use sometimes (i.e. MsgBox I said, Hello. would always give me an error. MsgBox I said, chr(34) Hello. Chr(34) works) Rich ---Rich MilburnMCSE, Microsoft MVP - Directory ServicesSr Network Analyst, Field Platform DevelopmentApplebee's International, Inc.4551 W. 107th StOverland Park, KS 66207913-967-2819--I love the smell of red herrings in the morning - anonymous From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Noah EigerSent: Wednesday, December 07, 2005 1:10 PMTo: ActiveDir@mail.activedir.orgSubject: [ActiveDir] Help with _vbscript_ to map printers Hi I am trying to modify a VBS found on the Internet to map multiple printers. This will be run for every user in an OU. I keep getting the following error for line 8: 8007007B - The filename, directory name or volume syntax is incorrect I have played around with the syntax but think I am missing something very basic here. Any thoughts? I got this from: http://www.computerperformance.co.uk/ezine/ezine16.htm#Example%203:%20Mapping%20Multiple%20Printers ' Poached from Guy Thomas February 2004. ' ** Dim multiPrinter, UNCpath1, UNCpath2, UNCpath3 UNCpath1 = "\\server.abc.private\HP Color LaserJet 3500" UNCpath2 = "\\server.abc.private\HP LaserJet 3300" UNCpath2 = "\\server.abc.private\HP LaserJet 5000" Set multiPrinter = CreateObject("WScript.Network") multiPrinter.AddWindowsPrinterConnection UNCpath1 multiPrinter.AddWindowsPrinterConnection UNCpath2 multiPrinter.AddWindowsPrinterConnection UNCpath3 ' WScript.Echo "Your printer is mapped from : " UNCpath1 _ ' "and from : " UNCpath2 WScript.Quit ' End of _vbscript_ ---APPLEBEE'S INTERNATIONAL, INC. CONFIDENTIALITY NOTICE--- PRIVILEGED / CONFIDENTIAL INFORMATION may be contained in this message or any attachments. This information is strictly confidential and may be subject to attorney-client privilege. This message is intended only for the use of the named addressee. If you are not the intended recipient of this message, unauthorized forwarding, printing, copying, distribution, or using such information is strictly prohibited and may be unlawful. If you have received this in error, you should kindly notify the sender by reply e-mail and immediately destroy this message. Unauthorized interception of this e-mail is a violation of federal criminal law. Applebee's International, Inc. reserves the right to monitor and review the content of all messages sent to and from this e-mail address. Messages sent to or from this e-mail address may be stored on the Applebee's International, Inc. e-mail system. --No virus found in this outgoing message.Checked by AVG Free Edition.Version: 7.1.371 / Virus Database: 267.13.12/194 - Release Date: 12/7/2005
RE: [ActiveDir] Help with VB script to map printers
Strange. I've never had problems with double double-quotes in a _vbscript_. Ed Crowley MCSE+Internet MVPFreelance E-Mail PhilosopherProtecting the world from PSTs and Bricked Backups! From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rich MilburnSent: Wednesday, December 07, 2005 12:17 PMTo: ActiveDir@mail.activedir.orgSubject: RE: [ActiveDir] Help with _vbscript_ to map printers Try using Chr(34) instead of quotes for your paths i.e. UNCpath1 = "\\server.abc.private\" Chr(34) HP Color LaserJet 3500" Chr(34) Chr(34) is how you get quotes into a string at least its the only way Ive ever gotten to work my WSH doesnt seem to like the double quotes I see some people use sometimes (i.e. MsgBox I said, Hello. would always give me an error. MsgBox I said, chr(34) Hello. Chr(34) works) Rich ---Rich MilburnMCSE, Microsoft MVP - Directory ServicesSr Network Analyst, Field Platform DevelopmentApplebee's International, Inc.4551 W. 107th StOverland Park, KS 66207913-967-2819--I love the smell of red herrings in the morning - anonymous From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Noah EigerSent: Wednesday, December 07, 2005 1:10 PMTo: ActiveDir@mail.activedir.orgSubject: [ActiveDir] Help with _vbscript_ to map printers Hi I am trying to modify a VBS found on the Internet to map multiple printers. This will be run for every user in an OU. I keep getting the following error for line 8: 8007007B - The filename, directory name or volume syntax is incorrect I have played around with the syntax but think I am missing something very basic here. Any thoughts? I got this from: http://www.computerperformance.co.uk/ezine/ezine16.htm#Example%203:%20Mapping%20Multiple%20Printers ' Poached from Guy Thomas February 2004. ' ** Dim multiPrinter, UNCpath1, UNCpath2, UNCpath3 UNCpath1 = "\\server.abc.private\HP Color LaserJet 3500" UNCpath2 = "\\server.abc.private\HP LaserJet 3300" UNCpath2 = "\\server.abc.private\HP LaserJet 5000" Set multiPrinter = CreateObject("WScript.Network") multiPrinter.AddWindowsPrinterConnection UNCpath1 multiPrinter.AddWindowsPrinterConnection UNCpath2 multiPrinter.AddWindowsPrinterConnection UNCpath3 ' WScript.Echo "Your printer is mapped from : " UNCpath1 _ ' "and from : " UNCpath2 WScript.Quit ' End of _vbscript_ ---APPLEBEE'S INTERNATIONAL, INC. CONFIDENTIALITY NOTICE--- PRIVILEGED / CONFIDENTIAL INFORMATION may be contained in this message or any attachments. This information is strictly confidential and may be subject to attorney-client privilege. This message is intended only for the use of the named addressee. If you are not the intended recipient of this message, unauthorized forwarding, printing, copying, distribution, or using such information is strictly prohibited and may be unlawful. If you have received this in error, you should kindly notify the sender by reply e-mail and immediately destroy this message. Unauthorized interception of this e-mail is a violation of federal criminal law. Applebee's International, Inc. reserves the right to monitor and review the content of all messages sent to and from this e-mail address. Messages sent to or from this e-mail address may be stored on the Applebee's International, Inc. e-mail system. --No virus found in this outgoing message.Checked by AVG Free Edition.Version: 7.1.371 / Virus Database: 267.13.12/194 - Release Date: 12/7/2005
RE: [ActiveDir] Help with VB script to map printers
Quite. And, when I change the script for a server\printer on my network, it works. The only difference is that I don't have any printer shares with spaces. Not sure if it would be a big deal. Along with what Rich said, if you write scripts in Word, opposed to Notepad, the " character is not translated correctly. Word may use the 66 99 looking ones, depending on your font, I guess. If you haven't, try to copy it to Notepad and edit it there. May also try creating a test printer share with no spaces, see if that helps. Thanks, JD Northrop Grumman Information Technology Commercial, State Local Solutions 512-377-x235 Alphapage 866-521-6091 E-Page [EMAIL PROTECTED] From: AD [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 07, 2005 1:37 PM To: ActiveDir@mail.activedir.org Subject: RE: [ActiveDir] Help with _vbscript_ to map printers Actually both are valid. From: WILLIAMS, J.D. Sent: Wed 07/12/2005 2:31 PM To: 'ActiveDir@mail.activedir.org' Cc: '[EMAIL PROTECTED]' Subject: RE: [ActiveDir] Help with _vbscript_ to map printers My wsh book shows the command to be .AddPrinterConnection not .AddWindowsPrinterConnection HTH Thanks, JD Northrop Grumman Information Technology Commercial, State Local Solutions 512-377-x235 Alphapage 866-521-6091 E-Page [EMAIL PROTECTED] From: Noah Eiger [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 07, 2005 1:10 PM To: ActiveDir@mail.activedir.org Subject: [ActiveDir] Help with _vbscript_ to map printers Hi - I am trying to modify a VBS found on the Internet to map multiple printers. This will be run for every user in an OU. I keep getting the following error for line 8: 8007007B - The filename, directory name or volume syntax is incorrect I have played around with the syntax but think I am missing something very basic here. Any thoughts? I got this from: http://www.computerperformance.co.uk/ezine/ezine16.htm#Example%203:%20Mapping%20Multiple%20Printers ' Poached from Guy Thomas February 2004. ' ** Dim multiPrinter, UNCpath1, UNCpath2, UNCpath3 UNCpath1 = \\server.abc.private\HP Color LaserJet 3500 UNCpath2 = \\server.abc.private\HP LaserJet 3300 UNCpath2 = \\server.abc.private\HP LaserJet 5000 Set multiPrinter = CreateObject(WScript.Network) multiPrinter.AddWindowsPrinterConnection UNCpath1 multiPrinter.AddWindowsPrinterConnection UNCpath2 multiPrinter.AddWindowsPrinterConnection UNCpath3 ' WScript.Echo Your printer is mapped from : UNCpath1 _ ' and from : UNCpath2 WScript.Quit ' End of _vbscript_ -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.371 / Virus Database: 267.13.12/194 - Release Date: 12/7/2005
RE: [ActiveDir] Help with VB script to map printers
Thanks to all for suggestions. I pasted the path directly into the run line as Paul suggested. This worked fine and brought up the printer immediately. I then made the Chr(34) change as Rich suggested. When I did this, it told me the printer name was wrong. If I add an echo as below, the result is 0. UNCpath1 = \\server.abc.private\ Chr(34) HP Color LaserJet 3500 Chr(34) Wscript.Echo UNCpath1 Hmmm. From: Rich Milburn [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 07, 2005 12:17 PM To: ActiveDir@mail.activedir.org Subject: RE: [ActiveDir] Help with _vbscript_ to map printers Try using Chr(34) instead of quotes for your paths i.e. UNCpath1 = \\server.abc.private\ Chr(34) HP Color LaserJet 3500 Chr(34) Chr(34) is how you get quotes into a string at least its the only way Ive ever gotten to work my WSH doesnt seem to like the double quotes I see some people use sometimes (i.e. MsgBox I said, Hello. would always give me an error. MsgBox I said, chr(34) Hello. Chr(34) works) Rich --- Rich Milburn MCSE, Microsoft MVP - Directory Services Sr Network Analyst, Field Platform Development Applebee's International, Inc. 4551 W. 107th St Overland Park, KS 66207 913-967-2819 -- I love the smell of red herrings in the morning - anonymous From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Noah Eiger Sent: Wednesday, December 07, 2005 1:10 PM To: ActiveDir@mail.activedir.org Subject: [ActiveDir] Help with _vbscript_ to map printers Hi I am trying to modify a VBS found on the Internet to map multiple printers. This will be run for every user in an OU. I keep getting the following error for line 8: 8007007B - The filename, directory name or volume syntax is incorrect I have played around with the syntax but think I am missing something very basic here. Any thoughts? I got this from: http://www.computerperformance.co.uk/ezine/ezine16.htm#Example%203:%20Mapping%20Multiple%20Printers ' Poached from Guy Thomas February 2004. ' ** Dim multiPrinter, UNCpath1, UNCpath2, UNCpath3 UNCpath1 = \\server.abc.private\HP Color LaserJet 3500 UNCpath2 = \\server.abc.private\HP LaserJet 3300 UNCpath2 = \\server.abc.private\HP LaserJet 5000 Set multiPrinter = CreateObject(WScript.Network) multiPrinter.AddWindowsPrinterConnection UNCpath1 multiPrinter.AddWindowsPrinterConnection UNCpath2 multiPrinter.AddWindowsPrinterConnection UNCpath3 ' WScript.Echo Your printer is mapped from : UNCpath1 _ ' and from : UNCpath2 WScript.Quit ' End of _vbscript_ ---APPLEBEE'S INTERNATIONAL, INC. CONFIDENTIALITY NOTICE--- PRIVILEGED / CONFIDENTIAL INFORMATION may be contained in this message or any attachments. This information is strictly confidential and may be subject to attorney-client privilege. This message is intended only for the use of the named addressee. If you are not the intended recipient of this message, unauthorized forwarding, printing, copying, distribution, or using such information is strictly prohibited and may be unlawful. If you have received this in error, you should kindly notify the sender by reply e-mail and immediately destroy this message. Unauthorized interception of this e-mail is a violation of federal criminal law. Applebee's International, Inc. reserves the right to monitor and review the content of all messages sent to and from this e-mail address. Messages sent to or from this e-mail address may be stored on the Applebee's International, Inc. e-mail system. -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.371 / Virus Database: 267.13.12/194 - Release Date: 12/7/2005 -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.371 / Virus Database: 267.13.12/194 - Release Date: 12/7/2005 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.371 / Virus Database: 267.13.12/194 - Release Date: 12/7/2005
RE: [ActiveDir] Help with VB script to map printers
You shouldn't need the extra quotes in the printer name/path. The value of the variable is passed in its entirety, it doesn't get truncated because it contains spaces. Someone else already recommended trying to connect to the printer from the Run line, I'll second that. -Andrew From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ed Crowley [MVP]Sent: Wednesday, December 07, 2005 2:32 PMTo: ActiveDir@mail.activedir.orgSubject: RE: [ActiveDir] Help with _vbscript_ to map printers This should work: UNCpath1 = "\\server.abc.private\"HP Color LaserJet 3500""" Ed Crowley MCSE+Internet MVPFreelance E-Mail PhilosopherProtecting the world from PSTs and Bricked Backups! From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rich MilburnSent: Wednesday, December 07, 2005 12:17 PMTo: ActiveDir@mail.activedir.orgSubject: RE: [ActiveDir] Help with _vbscript_ to map printers Try using Chr(34) instead of quotes for your paths i.e. UNCpath1 = "\\server.abc.private\" Chr(34) HP Color LaserJet 3500" Chr(34) Chr(34) is how you get quotes into a string at least its the only way Ive ever gotten to work my WSH doesnt seem to like the double quotes I see some people use sometimes (i.e. MsgBox I said, Hello. would always give me an error. MsgBox I said, chr(34) Hello. Chr(34) works) Rich ---Rich MilburnMCSE, Microsoft MVP - Directory ServicesSr Network Analyst, Field Platform DevelopmentApplebee's International, Inc.4551 W. 107th StOverland Park, KS 66207913-967-2819--I love the smell of red herrings in the morning - anonymous From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Noah EigerSent: Wednesday, December 07, 2005 1:10 PMTo: ActiveDir@mail.activedir.orgSubject: [ActiveDir] Help with _vbscript_ to map printers Hi I am trying to modify a VBS found on the Internet to map multiple printers. This will be run for every user in an OU. I keep getting the following error for line 8: 8007007B - The filename, directory name or volume syntax is incorrect I have played around with the syntax but think I am missing something very basic here. Any thoughts? I got this from: http://www.computerperformance.co.uk/ezine/ezine16.htm#Example%203:%20Mapping%20Multiple%20Printers ' Poached from Guy Thomas February 2004. ' ** Dim multiPrinter, UNCpath1, UNCpath2, UNCpath3 UNCpath1 = "\\server.abc.private\HP Color LaserJet 3500" UNCpath2 = "\\server.abc.private\HP LaserJet 3300" UNCpath2 = "\\server.abc.private\HP LaserJet 5000" Set multiPrinter = CreateObject("WScript.Network") multiPrinter.AddWindowsPrinterConnection UNCpath1 multiPrinter.AddWindowsPrinterConnection UNCpath2 multiPrinter.AddWindowsPrinterConnection UNCpath3 ' WScript.Echo "Your printer is mapped from : " UNCpath1 _ ' "and from : " UNCpath2 WScript.Quit ' End of _vbscript_ ---APPLEBEE'S INTERNATIONAL, INC. CONFIDENTIALITY NOTICE--- PRIVILEGED / CONFIDENTIAL INFORMATION may be contained in this message or any attachments. This information is strictly confidential and may be subject to attorney-client privilege. This message is intended only for the use of the named addressee. If you are not the intended recipient of this message, unauthorized forwarding, printing, copying, distribution, or using such information is strictly prohibited and may be unlawful. If you have received this in error, you should kindly notify the sender by reply e-mail and immediately destroy this message. Unauthorized interception of this e-mail is a violation of federal criminal law. Applebee's International, Inc. reserves the right to monitor and review the content of all messages sent to and from this e-mail address. Messages sent to or from this e-mail address may be stored on the Applebee's International, Inc. e-mail system. --No virus found in this outgoing message.Checked by AVG Free Edition.Version: 7.1.371 / Virus Database: 267.13.12/194 - Release Date: 12/7/2005 smime.p7s Description: S/MIME cryptographic signature
Re: [ActiveDir] Help with VB script to map printers
Try multiPrinter.AddWindowsPrinterConnection \\server.abc.private\HP Color LaserJet 3500etc.Rewrite it all out in a basic text editor like notepad to ensure you aren't getting some hidden character junk. Btw, I've confirmed in one of my login scripts that has the same line, and it works with a printer share that has spaces. No need for extra quotes.On 12/7/05, Noah Eiger [EMAIL PROTECTED] wrote: Hi – I am trying to modify a VBS found on the Internet to map multiple printers. This will be run for every user in an OU. I keep getting the following error for line 8: 8007007B - The filename, directory name or volume syntax is incorrect I have played around with the syntax but think I am missing something very basic here. Any thoughts? I got this from: http://www.computerperformance.co.uk/ezine/ezine16.htm#Example%203:%20Mapping%20Multiple%20Printers ' Poached from Guy Thomas February 2004. ' ** Dim multiPrinter, UNCpath1, UNCpath2, UNCpath3 UNCpath1 = \\server.abc.private\HP Color LaserJet 3500 UNCpath2 = \\server.abc.private\HP LaserJet 3300 UNCpath2 = \\server.abc.private\HP LaserJet 5000 Set multiPrinter = CreateObject(WScript.Network) multiPrinter.AddWindowsPrinterConnection UNCpath1 multiPrinter.AddWindowsPrinterConnection UNCpath2 multiPrinter.AddWindowsPrinterConnection UNCpath3 ' WScript.Echo Your printer is mapped from : UNCpath1 _ ' and from : UNCpath2 WScript.Quit ' End of _vbscript_ -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.371 / Virus Database: 267.13.12/194 - Release Date: 12/7/2005 -- Paul Wilkinson[EMAIL PROTECTED]
RE: [ActiveDir] Help with VB script to map printers
Ok. The problem appears to be that I was testing it on the machine that held the shares. I was under the (mistaken) impression that you could map a network printer on the machine that is sharing that printer just as you can do with file shares. Guess not. When I tried it (finally) from a workstation, the original script ran correctly. This process has led me to other questions: - So far, all of these printers have the default Windows drivers. What if I try to automate the install of a new printer or want to specify a different driver? - If the printer is already installed, the script appears to leave it alone. Is it actually leaving it alone or is it just writing over it? If someone has made a change to the printer under their profile, will that get wiped away? Thanks again for all the help. -- nme From: Paul Wilkinson [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 07, 2005 1:42 PM To: ActiveDir@mail.activedir.org Subject: Re: [ActiveDir] Help with _vbscript_ to map printers Try multiPrinter.AddWindowsPrinterConnection \\server.abc.private\HP Color LaserJet 3500 etc. Rewrite it all out in a basic text editor like notepad to ensure you aren't getting some hidden character junk. Btw, I've confirmed in one of my login scripts that has the same line, and it works with a printer share that has spaces. No need for extra quotes. On 12/7/05, Noah Eiger [EMAIL PROTECTED] wrote: Hi I am trying to modify a VBS found on the Internet to map multiple printers. This will be run for every user in an OU. I keep getting the following error for line 8: 8007007B - The filename, directory name or volume syntax is incorrect I have played around with the syntax but think I am missing something very basic here. Any thoughts? I got this from: http://www.computerperformance.co.uk/ezine/ezine16.htm#Example%203:%20Mapping%20Multiple%20Printers ' Poached from Guy Thomas February 2004. ' ** Dim multiPrinter, UNCpath1, UNCpath2, UNCpath3 UNCpath1 = \\server.abc.private\HP Color LaserJet 3500 UNCpath2 = \\server.abc.private\HP LaserJet 3300 UNCpath2 = \\server.abc.private\HP LaserJet 5000 Set multiPrinter = CreateObject(WScript.Network) multiPrinter.AddWindowsPrinterConnection UNCpath1 multiPrinter.AddWindowsPrinterConnection UNCpath2 multiPrinter.AddWindowsPrinterConnection UNCpath3 ' WScript.Echo Your printer is mapped from : UNCpath1 _ ' and from : UNCpath2 WScript.Quit ' End of _vbscript_ -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.371 / Virus Database: 267.13.12/194 - Release Date: 12/7/2005 -- Paul Wilkinson [EMAIL PROTECTED] -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.371 / Virus Database: 267.13.12/194 - Release Date: 12/7/2005 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.371 / Virus Database: 267.13.12/194 - Release Date: 12/7/2005
RE: [ActiveDir] Help with VB script to map printers
--- Original Message --- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rich Milburn Sent: Thursday, 8 December 2005 7:17 AM To: ActiveDir@mail.activedir.org Subject: RE: [ActiveDir] Help with VB script to map printers : my WSH doesn't seem to like the double quotes I see some people : use sometimes (i.e. MsgBox I said, Hello. would always give me an error. You'd get an unterminated string constant error if you ran that code snippet :-) MsgBox I said, Hello. would work Cheers Ken List info : http://www.activedir.org/List.aspx List FAQ: http://www.activedir.org/ListFAQ.aspx List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/