moinuddin_sh Posted August 29, 2006 Posted August 29, 2006 (edited) I created a file "abc.bat" to be use as login scrip for network printer and map drive. I copied this file to "sysvol\sysvol\domain.com\script\abc.bat" and under user profile --> Login script typed abc.bat but it is not mapping the drive and not capturing the printer port. Login script net use I:\\computername\Accountnet us LPT1 \\computernam\10.10.30.26Can someone help me to find how can I Map a network drive Capture a network printerThanks Edited August 29, 2006 by moinuddin_sh
valter Posted August 29, 2006 Posted August 29, 2006 Here is an example of a simple VBS logon script. Copy & paste the content, modify it ater your needs, save it as vbs file (filename.vbs), place it under the same folder where your current script is. Don't forget to change the logon script name on the user properties. This script maps user home folder under drive P, should you map user home folder under user properties within AD Users and Computers, remove it either from there or from the script as it will try to overlap the action.' VBScript.' Mapping user home folder on the serverDim oNet, sUserSet oNet = CreateObject("Wscript.Network")sUser =oNet.UserNameoNet.MapNetworkDrive "P:", "\\SUN\" & sUser 'Mapping Network Attached DrivesDim WshNetworkSet WshNetwork = WScript.CreateObject("WScript.Network")WshNetwork.MapNetworkDrive "M:", "\\sun\CMT"WshNetwork.MapNetworkDrive "Q:", "\\sun\Public Folder"WshNetwork.MapNetworkDrive "R:", "\\venus\IT"WshNetwork.MapNetworkDrive "S:", "\\sun\Share"WshNetwork.MapNetworkDrive "W:", "\\sun\Course"WshNetwork.MapNetworkDrive "X:", "\\EARTH\XALWIN"WshNetwork.MapNetworkDrive "Z:", "\\sun\CopyScan"'Mapping Network Attached PrintersDim netSet net = CreateObject("WScript.Network") net.AddWindowsPrinterConnection "\\sun\HPLJ2100", "HPLJ2100"net.AddWindowsPrinterConnection "\\sun\DELLM5200", "DELLM5200"net.AddWindowsPrinterConnection "\\sun\DELLM5300", "DELLM5300"net.AddWindowsPrinterConnection "\\SUN\ScienceCopy", "ScienceCopy"net.AddWindowsPrinterConnection "\\SUN\EducationCopy", "EducationCopy"net.AddWindowsPrinterConnection "\\SUN\HouseCopy", "HouseCopy"'Selecting default printerSet net = CreateObject("WScript.Network") net.SetDefaultPrinter "\\sun\DELLM5300"
moinuddin_sh Posted August 29, 2006 Author Posted August 29, 2006 (edited) Thanks for your usefull reply. Could you please expalin how can I capture a LPT1. I tried following command on the command prompt of a WS and it work fine but through VBscript it gives an error. Error Expected end of statementError Code is 800A0401net use LPT1: \\Hetifhasvrfpr01\HPLaserJetAccount /persistent:yes Edited August 29, 2006 by moinuddin_sh
valter Posted August 29, 2006 Posted August 29, 2006 (edited) Thanks for your usefull reply. Could you please expalin how can I capture a LPT1. I tried following command on the command prompt of a WS and it work fine but through VBscript it gives an error. Error Expected end of statementError Code is 800A0401net use LPT1: \\Hetifhasvrfpr01\HPLaserJetAccount /persistent:yesI see no reason for capturing LPT1 unless you have specific program that can print ONLY on LPT1. When you use net.AddWindowsPrinterConnection you add netowk printer connection, and net.SetDefaultPrinter sets default printer. As far as I can remember, there are very few programs (DOS based) that require LTP port to print.As per your last question, I think you should remove /persistent:yes from your statement Edited August 29, 2006 by klasika
moinuddin_sh Posted August 30, 2006 Author Posted August 30, 2006 Thanks again,Yes, I have one software that needs LPT1.
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