Solved

GPO Scripts

Posted on 2006-06-29
8
835 Views
Last Modified: 2008-02-26
I have a login script that maps our drives in a GPO.  It's a .bat.  Is there any difference between .bat and .cmd files?  Is one better than the other?

Thanks
0
Comment
Question by:mchristo63
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 20

Expert Comment

by:DVation191
ID: 17008529
mchristo63,
Nothing, really. For Win 9x environments scripts need to use the .bat extension. For any NT based OS like 2000 or XP, either one works the same. cmd files are associated with cmd.exe while bat files are associated with command.exe. Since cmd.exe is a 32bit app versus the 16bit command.exe, bat files tend to run faster...though I'm not sure you're running any scripts complicated enough to realized the difference.

0
 
LVL 2

Accepted Solution

by:
lbbcsg earned 500 total points
ID: 17008549
.bat == .cmd, according to the REGISTRY
they both mean plain text
now for the other part... cmd is cmdfile and bat is batfile, but looking at where it points to, it is clearly exactly the same... .cmd is just name NT command line program or something, while .bat is a batch script (it's just a name, they both do exactly the same

If you have 2k or XP clients you may consider using .vbs login script to map drives.

Here's a sample:

' 1 Map Drive X All Users
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "X:", "\\server1\images"
0
 

Author Comment

by:mchristo63
ID: 17009105
I am not good at .vbs, so hince the .cmd files.  I would like to move toward .vbs, but my mappings are not just X: for all.  I have to map drives based on which AD group they belong.  
0
 
LVL 6

Expert Comment

by:darkeryu
ID: 17009953
hi:

you can find all sample in Microsoft script center..

http://www.microsoft.com/technet/scriptcenter/scripts/default.mspx

all sample easy to use...

thanks
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 2

Expert Comment

by:lbbcsg
ID: 17011884
Here's how it would look it .bat format:

IF MEMBER OF "TESTERS" THEN

MAP X:=INPUT:STATUS\UPDATES

END
0
 

Author Comment

by:mchristo63
ID: 17011962
Thanks, but I already have a batch file that is mapping based on AD groups.  I just don't kno how to stream line that in a .vbs.  Here is an example of my batch file:

@echo off
REM ##       Sets Variables for Default Server ##

Set Dserver=\\Server
Set D1=U
Set D2=T
Set D3=S

Set S1=%Dserver%\%username%$
Set S2=%Dserver%\applications

REM ##       Deletes S:, T: and U: Mappings. Maps the user home directory and application share ##

net use /persistent:NO
net use %D1%: /delete /y
net use %D2%: /delete /y
net use %D3%: /delete /y

net use %D1%: %S1%
net use %D2%: %S2%

REM ##########       Mapping by Group      ###############################

:DEPT1
\\DC\SysVol\ifmember "Domain\Department 1"
if %errorlevel%==0 goto DEPT2
net use S: \\server\DEPT1 /persistent:no

:DEPT2
\\DC\SysVol\ifmember "Domain\Department 2"
if %errorlevel%==0 goto DEPT3
net use S: \\server\DEPT2 /persistent:no

:DEPT3 ...etc

:End
0
 
LVL 20

Expert Comment

by:DVation191
ID: 17012006
The question posted was about the differences between cmd and bat files. Questions about converting these scripts to vbc or wmi are on another topic and should probably be posted in a new thread.
0
 

Author Comment

by:mchristo63
ID: 17012074
Yes Sir!
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Sometimes a user will call me frantically, explaining that something has gone wrong and they have tried everything (read - they have messed it up more and now need someone to clean up) and it still does no good, can I help them?!  Usually the standa…
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
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.

705 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

16 Experts available now in Live!

Get 1:1 Help Now