Solved

Powershel script

Posted on 2014-02-24
4
698 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

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…
Remote Apps is a feature in server 2008 which allows users to run applications off Remote Desktop Servers without having to log into them to run the applications.  The user can either have a desktop shortcut installed or go through the web portal to…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
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). …

910 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

21 Experts available now in Live!

Get 1:1 Help Now