Solved

SCRIPTS CAN I HAVE 2 OF THEM

Posted on 2004-10-07
10
188 Views
Last Modified: 2010-03-18
Hello everyone.

I have a default script that is saved in a .bat file which assigns our typical network folders upon login.

I also have a script that is saved in a vbs format for assigned our printers upon login.

In the Active Directory/Users/  and choose a user and their profile/logon script   Can I place both of these in that line somehow

example

login.bat;printers.vbs

Any help is more than appreciated.
0
Comment
Question by:ghjs
  • 3
  • 3
10 Comments
 
LVL 83

Expert Comment

by:oBdA
ID: 12251004
That won't work; the only way to do that is to call one script from the other.
Add the following line to your logon bat:
start "Logon" /wait printers.vbs
should work.
Or you can switch completely to one scritp language. If you want to keep your batch script, you can use con2prt.exe (still runs fine on XP) to map network printers easily in a batch script. If necessary, you can use ifmember.exe to map according to group membership.
Example:

====8<----[logon.cmd]----
@echo off
:: *** Delete all mapped printers:
con2prt.exe /f
:: *** Map the printers according to group membership:
ifmember.exe YourDomain\Printer01Group
if not errorlevel 1 goto EndPrinter01Group
con2prt.exe /c \\PrintServer\Printer01
:EndPrinter01Group

ifmember.exe YourDomain\Printer02Group
if not errorlevel 1 goto EndPrinter02Group
con2prt.exe /c \\PrintServer\Printer02
:EndPrinter02Group
====8<----[logon.cmd]----

How to Use Con2prt.exe to Connect to a Network Printer
http://support.microsoft.com/?kbid=181663

Zero Administration Kit
http://www.microsoft.com/ntworkstation/downloads/Recommended/Featured/NTZAK.asp

Resource Kits Free Tool Downloads: Ifmember.exe
http://www.microsoft.com/windows2000/techinfo/reskit/tools/new/ifmember-o.asp
0
 

Author Comment

by:ghjs
ID: 12251661
I would like to use the simple script if possible with the wait cmd....tried it ...the login works but not the printers..any help..Thanx so much
0
 

Author Comment

by:ghjs
ID: 12251677
do i need quotes around printers.vbs ?
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 83

Expert Comment

by:oBdA
ID: 12251795
Not if the script is really called printers.vbs.
You might have to add the path, though (the following assumes that printers.vbs is in the netlogon share):
start "Logon" /wait "%Logonserver%\netlogon\printers.vbs"
0
 
LVL 70

Accepted Solution

by:
Chris Dent earned 200 total points
ID: 12251841

There is an alternative, Kixtart can do all those things you have listed in one script (rather than splitting them). Kixtart ships with the Server Resource kits, or you can download the latest version directly from:

 http://www.kixtart.org/

Then to use it, simply copy the kix32.exe file onto the NETLOGON share, and add the following commands to each file (again in the NETLOGON Share):

Logon.bat would contain:

kix32.exe logon.kix

Logon.kix would contain:

use g: \\server\share
use i: \\server2\share

If InGroup("Printer Group 1")
    AddPrinterConnection("\\server\printer1")
EndIf

Use is the equivelent of the Net Use comamnd in DOS.

Simply add logon.bat to the User Account properties and it should work. Personally I think Kix is a lot easier to use (and generally easily as flexible) than VB Script in these instances.
0
 

Author Comment

by:ghjs
ID: 12252001
UGG I would have loved the simple line script to work but its not...I will look into Kixtart and get back with you asap..Thanks for spending time with me.  Take care!!
0
 
LVL 83

Assisted Solution

by:oBdA
oBdA earned 200 total points
ID: 12252047
Assuming that .vbs is associated with wscript (check in the command line with "ftype vbsfile"), the following should work:
%Systemroot%\System32\WScript.exe "%Logonserver%\netlogon\printers.vbs"
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

This article is in response to a question (http://www.experts-exchange.com/Networking/Network_Management/Network_Analysis/Q_28230497.html) here at Experts Exchange. The Original Poster (OP) requires a utility that will accept a list of IP addresses …
Are you one of those front-line IT Service Desk staff fielding calls, replying to emails, all-the-while working to resolve end-user technological nightmares? I am! That's why I have put together this brief overview of tools and techniques I use in o…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

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