Solved

Powershel script

Posted on 2014-02-24
4
706 Views
Last Modified: 2014-03-02
Hi buddies,
                   Can anyone help me with the powershell script which can create both servivce account and domain local group in Windows 2K3 environment.

Thanks
  Aj
0
Comment
Question by:aspathak
  • 3
4 Comments
 
LVL 19

Expert Comment

by:Peter Hutchison
ID: 39885005
To create a local group:
param($computer="localhost", $group)
$objOu = [ADSI]"WinNT://$computer"
$objUser = $objOU.Create("Group", $group)
 $objUser.SetInfo()
$objUser.description = "Test Group"
$objUser.SetInfo()

To create a local account:
param($computer="localhost", $user, $password)
$objOu = [ADSI]"WinNT://$computer"
 $objUser = $objOU.Create("User", $user)
 $objUser.setpassword($password)
$objUser.SetInfo()
$objUser.description = "Test user"
$objUser.SetInfo()

To add a user to a local group e.g. Administrators use:
param($computer="localhost", $user, $group)
$objOU = [ADSI]"WinNT://$computer/$group,group"
 $objOU.add("WinNT://$computer/$user")
0
 
LVL 1

Author Comment

by:aspathak
ID: 39885019
I need the bulk AD group creation via script and need the input to be imported frm excel sheet
0
 
LVL 1

Accepted Solution

by:
aspathak earned 0 total points
ID: 39885023
Here is what I was looking for. Anyone can refer the link  :)

http://gallery.technet.microsoft.com/scriptcenter/PowerShell-Bulk-AD-Group-4d873f35
0
 
LVL 1

Author Closing Comment

by:aspathak
ID: 39898376
this script will import the AD group info from .Csv file
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

Welcome to my series of short tips on migrations. Whilst based on Microsoft migrations the same principles can be applied to any type of migration. My first tip Migration Tip #1 – Source Server Health can be found here: http://www.experts-exchang…
When you upgrade from Windows 8 to 8.1 or to Windows 10 or if you are like me you are on the Insider Program you may find yourself with many 450MB recovery partitions.  With a traditional disk that may not be a problem but with relatively smaller SS…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

828 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