Solved

GPO Scripts

Posted on 2006-06-29
8
842 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

809 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