Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SCRIPTS CAN I HAVE 2 OF THEM

Posted on 2004-10-07
10
Medium Priority
?
236 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 85

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
Optimum High-Definition Video Viewing and Control

The ATEN VM0404HA 4x4 4K HDMI Matrix Switch supports 4K resolutions of UHD (3840 x 2160) and DCI (4096 x 2160) with refresh rates of 30 Hz (4:4:4) and 60 Hz (4:2:0). It is ideal for applications where the routing of 4K digital signals is required.

 
LVL 85

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 800 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 85

Assisted Solution

by:oBdA
oBdA earned 800 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Downtime reduced, data recovered by utilizing an Experts Exchange Business Account Challenge The United States Marine Corps employs more than 200,000 active-duty Marines with operations in four continents, all requiring complex networking system…
A common practice in small networks is making file sharing easy which works extremely well when intra-network security is not an issue. In essence, everyone, that is "Everyone", is given access to all of the shared files - often the entire C: drive …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

721 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