Powershel script

aspathak
aspathak used Ask the Experts™
on
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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Peter HutchisonSenior Network Systems Specialist

Commented:
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")

Author

Commented:
I need the bulk AD group creation via script and need the input to be imported frm excel sheet
Commented:
Here is what I was looking for. Anyone can refer the link  :)

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

Author

Commented:
this script will import the AD group info from .Csv file

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial