Avatar of brandonlapointe
brandonlapointe

asked on 

n00b needs login script for XP clients

Hi all,
I have completely NO experience scripting or creating .vbs files. I need a simple script that I can apply as a login script that will add a new printer to all my clients under group policy. After doing some searcing I cam across the following snippet:

Set WshNetwork = WScript.CreateObject("WScript.Network")
PrinterPath = "\\<Server>\<PrinterShareName>"
WshNetwork.AddWindowsPrinterConnection PrinterPath
WshNetwork.SetDefaultPrinter PrinterPath

Now, I have no clue how to make a script out of that, but I need something fast so I will assign the max points

Thanks!!!
Networking

Avatar of undefined
Last Comment
brandonlapointe
Avatar of snerkel
snerkel

It is actually very easy.

Lets assume PC with printer is called (eg displays in network neighbourhood as)        "DeskTop"

Printer share name is "printer1"

Open notepad and create a text file with the above

Set WshNetwork = WScript.CreateObject("WScript.Network")
PrinterPath = "\\DeskTop\printer1"
WshNetwork.AddWindowsPrinterConnection PrinterPath
WshNetwork.SetDefaultPrinter PrinterPath

Rename the file with a vbs extension

eg:-  Makeprinter.vbs

Avatar of brandonlapointe

ASKER

OK, I did that, and applied it to my user OU. I did a gpupdate /force and it completed successfully, but the printer did not add. I have no errors in my event log.
ASKER CERTIFIED SOLUTION
Avatar of infotrader
infotrader

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of iamgod
iamgod

I suggest download microsoft utility called con2prt.exe from microsoft, place it in the netlogon directory. Use the following example to add printers based on computer name (LABXP is first five characters of computer name). the second example is to add printer to all computers

if %computername:~0,5%==LABXP \\server1\netlogon\con2prt.exe /c "\\server1\hp2200dn"

\\server1\netlogon\con2prt.exe /c "\\server1\hp2200dn"
Avatar of brandonlapointe

ASKER

Thanks, KIX32 was the only thing I could get to work. Good utility to have.
Networking
Networking

Networking is the process of connecting computing devices, peripherals and terminals together through a system that uses wiring, cabling or radio waves that enable their users to communicate, share information and interact over distances. Often associated are issues regarding operating systems, hardware and equipment, cloud and virtual networking, protocols, architecture, storage and management.

102K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo