Solved

SCRIPTS CAN I HAVE 2 OF THEM

Posted on 2004-10-07
10
206 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Greetings, Experts! First let me state that this website is top notch. I thoroughly enjoy the community that is shared here; those seeking help and those willing to sacrifice their time to help. It is fantastic. I am writing this article at th…
Many of us in IT utilize a combination of roaming profiles and folder redirection to ensure user information carries over from one workstation to another; in my environment, it was to enable virtualization without needing a separate desktop for each…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

785 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