Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Import ADGroupMember from file

$
0
0

first lets say i work with powershell 3 (csv import )


i have this file lookalike this :


GroupName,GroupID,Members,
root,0,root,
other,1,drorh,
staff,10,a022628,
sm,11,"arika,a004102,a004420,arbiv,admin,a102849,a102132,shahars,shapir,gilanit,a462024,avig,a321620",
sysadmin,14,"galias,mark",
pcsys,15,"arika,machluf,michael,a102132,a102849,shaynis",


the header is GroupName,GroupID,Members
now i created this script that will bulk import the GroupName in to Active Directory
here is the catch i cant use:

Add-ADGroupMember -Identity somegroup user1,user2

if user1 is already at the group user2 will not be added

don't know how to manipulate date in this format "a1,a2,a3,a4"

so i can use some way to add the user one by one for is GroupName
here is the full script :

https://dl.dropboxusercontent.com/u/103434771/Import-NIStoAD.ps1

i try this but no luck:

$Nis_Groups | % {

Add-ADGroupMember -Identity $_.GroupName $_.Members   }

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles