I currently have a PS script that is used for remediation of breached user accounts in a hybrid O365/On-prem AD environment. The script currently works as intended, enabling MFA, logging, resetting passwords, removing mailbox rules, etc.
There are times when we must remediate more than just a few accounts. That being said I am trying to set up the script to go line by line in a CSV file with headers to pull the users UPN name and execute the script for each UPN name in a csv.
Currently the script cant take and run multiple inputs for each function at once time so the script would need to re-run again. Additionally, the script pulls cmdlets and etc for each time it runs, being able to speed up the script by say keeping the initial session open would be a bonus.
Ideally, the result would be the script continue to run without requiring me to enter another UPN.
foreach ($UserAccnt in (Import-Csv -Path .\yourfilename.csv) ) {# call the script here using $UserAccnt.UPN as a parameter }
?