Solved

SCRIPTS CAN I HAVE 2 OF THEM

Posted on 2004-10-07
10
226 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
10 Comments
 
LVL 84

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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 84

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 71

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 84

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We recently endured a series of broadcast storms that caused our ISP to shut us down for brief periods of time. After going through a multitude of tests, we determined that the issue was related to Intel NIC drivers on some new HP desktop computers …
This is the first one of a series of articles I’ll be writing to address technical issues that are always referred to as network problems. The network boundaries have changed, therefore having an understanding of how each piece in the network  puzzl…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

752 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