Solved

n00b needs login script for XP clients

Posted on 2004-03-30
5
381 Views
Last Modified: 2010-04-11
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!!!
0
Comment
Question by:brandonlapointe
5 Comments
 
LVL 10

Expert Comment

by:snerkel
ID: 10714960
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

0
 

Author Comment

by:brandonlapointe
ID: 10715316
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.
0
 
LVL 11

Accepted Solution

by:
infotrader earned 500 total points
ID: 10715363
I just ran across this discussion page.  It looks like it'll do what you ask and more.
http://www.experts-exchange.com/Operating_Systems/Windows_Server_2003/Q_20936760.html

P.S.  KIX32 is great, I've been using it for 4 years now.

- Info
0
 
LVL 1

Expert Comment

by:iamgod
ID: 10723101
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"
0
 

Author Comment

by:brandonlapointe
ID: 10724245
Thanks, KIX32 was the only thing I could get to work. Good utility to have.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Article by: IanTh
Hi Guys After a whole weekend getting wake on lan over the internet working, I thought I would share the experience. Your firewall has to have a port forward for port 9 udp to your local broadcast x.x.x.255 but if that doesnt work, do it to a …
What’s a web proxy server? A proxy server is a server that goes between clients and web servers, used in corporate to enforce corporate browsing policy and ensure security. Proxy servers are commonly used in three modes. A)    Forward proxy …
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now