Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

GPO Scripts

Posted on 2006-06-29
8
Medium Priority
?
849 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
[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
  • 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 2000 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
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 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

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

Occasionally Windows/Microsoft Updates will fail to update. We have found a code that will delete all temporary files and re-register all dll's related to Windows/Microsoft Updates! This works 99% of the time to get the updates working again! The…
I don't know if many of you have made the great mistake of using the Cisco Thin Client model with the management software VXC. If you have then you are probably more then familiar with the incredibly clunky interface, the numerous work arounds, and …
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.

610 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