• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 394
  • Last Modified:

bat file

i have window 2008 with AD.
I would like to create a .bat file for users.

How can i do the best way and how?
0
orkinos
Asked:
orkinos
  • 2
  • 2
  • 2
  • +4
3 Solutions
 
Getsum_BloodlustCommented:
What do you want to do with the BAT file?
0
 
orkinosAuthor Commented:
network drive E:  and BGinfo.cmd deploy for all users
0
 
Rob MinersCommented:
orkinos, there are far newer alternatives like VB Scripts cmpared to using batch files to add users and grant permissions but I will give you an example of what I used to use:

I always create a Folder on D:\  to put the Users Home Directories, Profiles and ClientApps. I like to keep the Profiles folder seperate from the Home Directory as it is a lot easier to manage. I normally have the Profiles Folder with a hidden Share EG: Profiles$. You could run XCACLs and give the Administrator and Users Full control of their Profiles Folder.

Adding Single or Bulk Users
save the file to the root directory of the Server.
Create a Batch file and name it MKUser.bat
Copy and Paste between ======== to the new file modifying the contents to reflect your setup.

==============================================
@echo on
net user %1 %2 /add /fullname:"%3 %4" /comment:"User" /homedir:%LOGONSERVER%\%1$ /profilepath:%LOGONSERVER%\Profiles$\%1 /scriptpath:Logon.bat

net group "Staff" %1 /add /Domain

md %LOGONSERVER%\profiles$\%1

echo y| xcacls %LOGONSERVER%\profiles$\%1 /T /G "Administrators":F %1:F

md D:\minero\users\%1

echo y| xcacls D:\minero\users\%1 /T /G "Administrators":F %1:F

net share %1$=D:\minero\users\%1 /y
============================================

Key....

%1 = username
%2 = password
%3 = Firstname
%4 = Lastname
%1$ = Hides the folder. Creates a Hidden Share

To add Multiple Users another Batch file can be created that Calls  the MKUser.bat

Example: AddUser.bat
==========================
Call c:\MKUser.cmd Jack password Jack Jones
Call c:\MKUser.cmd Jill password Jill Jones
==========================
0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

 
orkinosAuthor Commented:
thank for script but its very difficult for me now.i just want to learn basic how to.
0
 
Rob MinersCommented:
Thats cool, we all had to start at the beginning but its always best to use a test environment and not a live system to do your testing.
0
 
chakkoCommented:
use notepad and make a file called logon.bat

put the logon.bat and bginfo files in your netlogon share location.  normally like:  c:\windows\sysvol\domain\domain\scripts

in the AD users account set the logon script setting to:  logon.bat

for a basic file, in the logon.bat file put

net use E: \\yourserver\sharename
\\yourserver\netlogon\bginfo.exe \\yourserver\netlogon\bginfo.bgi /timer:0 /silent
0
 
David Johnson, CD, MVPOwnerCommented:

net use e: \\servername\sharename
if NOT EXIST "c:\programdata\microsoft\windows\start menu\Programs\startup" xcopy e:\bginfo.cmd "c:\programdata\microsoft\windows\start menu\Programs\startup\"

bginfo.cmd
--- start
\\servername\sharename\bginfo.exe /options
-- end

0
 
Craig BowmanCommented:
You seem like you might need to look into the basics first.

You can learn the simple commands by starting here
http://aumha.org/a/batches.php

There is a simple demonstration of writing batch files in this tutorial
http://www.makeuseof.com/tag/write-simple-batch-bat-file/

I hope this helps
0
 
Craig BowmanCommented:
Check out the links I posted above.  You will get a really nice explanation and understanding of batch files.  
0
 
LeeTutorretiredCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
  • 2
  • 2
  • +4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now