I'm really sorry if this has been asked before. I have spent some time Googling the question but nothing seems to match my query.
I'm creating new user accounts from a CSV file which is fine, only group membership information is spread over 40 different cells. An example is as below:
USERNAME,Group1,Group2,Group3
User1,Exchange,Office
User2,Office,HTTP,FTP
User3,Office
At the moment the only way I can think of achieving this is:
IF ( $IMPORT.Group1 -ne $NULL ) { Add-AdGroupMember $IMPORT.Group1 -Member $IMPORT.Username }
If there were just a handful of cells I'd go with this, but since there's up to 40 it seems a bit of a long winded way to go about it. Is there an easier way to achieve this?
Thanks