Solved

Powershel script

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

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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…
INTRODUCTION The purpose of this document is to demonstrate the Installation and configuration of the Data Protection Manager product. Note that this demonstration was prepared on the basis of Windows OS is 2008 R2 and DPM 2010. DATA PROTECTI…
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…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

746 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

12 Experts available now in Live!

Get 1:1 Help Now