Hi,
I am trying to remove and add a group if a user is a member but the IF STATEMENT is not quite there. It does not loop through every user in the spreadsheet. Any assistance would be much appreciated, it's almost there:
$csv = Import-Csv "c:\SCRIPTS\users.csv" Function switch-Office { remove-adgroupmember -Identity "appmsoffice2003" -Member $sam -Confirm:$false Add-ADGroupMember -Identity "appmsoffice2010" -Members $sam -Confirm:$false } Function switch-Outlook { remove-adgroupmember -Identity "appmsoutlook2003" -Member $sam -Confirm:$false Add-ADGroupMember -Identity "appmsoutlook2010" -Members $sam -Confirm:$false } foreach($row in $csv) { $sam = $row.sam GET-QADUSER $SAM IF (get-qaduser $SAM -MEMBEROF 'AppMSOffice2003') {switch-office} IF (get-qaduser $SAM -MEMBEROF 'AppMSOutlook2003') { switch-office } }
I just need the IF loop tweaking, thanks, Matt.