CRIIT
asked on
VBScript to map network printers from XP home edition laptop
Some users in my network use XP home edition laptop and can't joint to the domain to use network printers. I would like to write a VBscript to map the network printers for them by double clicking the VBScript file. I wrote a code as below and it doesn't work. I think I may need to get credential from the print server. Does anyone knows how to do that.
Thanks,
========================== ========== =======
Set WshNetwork = WScript.CreateObject("WScr ipt.Networ k")
Set PrinterShares = GetObject("WinNT://printse rver")
PrinterShares.filter = array("PrintQueue")
For Each queue In PrinterShares
PrinterPath = "\\printserver\" & queue.name
WshNetwork.AddWindowsPrint erConnecti on PrinterPath
Next
========================== ========== =========
Thanks,
==========================
Set WshNetwork = WScript.CreateObject("WScr
Set PrinterShares = GetObject("WinNT://printse
PrinterShares.filter = array("PrintQueue")
For Each queue In PrinterShares
PrinterPath = "\\printserver\" & queue.name
WshNetwork.AddWindowsPrint
Next
==========================
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, Rockiroads.
I have to create a hidden share folder on print server first. Using "MapNetworkDrive" function which accepts username/password arguments to get the authentication. The I can map the network printers bu using "AddWindowsPrinterConnecti on" funtion. I remove the network drive by using "RemoveNetworkDrive" in the end.
I have to create a hidden share folder on print server first. Using "MapNetworkDrive" function which accepts username/password arguments to get the authentication. The I can map the network printers bu using "AddWindowsPrinterConnecti
No probs, what a pain though
ASKER