Home > Active Directory, Microsoft, Powershell, Scripts > Active Directory Import Export Groups scripts

Active Directory Import Export Groups scripts

PowerShell one liner to export Active Directory groups

Get-ADGroup -filter {GroupScope -eq "DomainLocal"} -SearchBase "OU=Roles,DC=prep,DC=online,DC=local" | ft Name | Out-File ADGroups.txt

Import groups (Active Direcotry 2003 /no powershell)

echo on

for /F "tokens=* delims= " %%G in (D:\ADGroups.txt) do (
dsadd group CN="%%G",OU="Roles",DC=gold,DC=online,DC=local -secgrp yes -scope l
)

Step by Step guide on TechNet

-Eric

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: