Working on a little project that is supposed to place ADusers in ADgroups based on Excel-file.
Got lost in the *.Split-maze and I am sure there is an easy solution I cannot see just now.
USERNAME : PROG-USER-01
USERGROUP-01 : X
USERGROUP-02 :
USERGROUP-03 : X
USERGROUP-04 :
SUITE-ADMINS :
USERNAME : PROG-USER-02
USERGROUP-01 :
USERGROUP-02 :
USERGROUP-03 :
USERGROUP-04 : X
SUITE-ADMINS :
Code:
$ExcelPlaceUsers = @(Import-Excel -Path "C:\users_and_relations.xlsx" -WorksheetName 'USERGROUP')
$ePUsernames = $ExcelPlaceUsers.USERNAME
foreach ($ePuser in $ePUsernames){
#$ePuser #USERNAMES
$targetCell = $ExcelPlaceUsers.$($i)[$ePuser]
if ($targetCell -eq 'x') {
#Output
}
}
Wanted output:
PROG-USER-01
USERGROUP-01
USERGROUP-03
PROG-USER-02
USERGROUP-04