Hi all,
I am still getting to grips with PowerShell and still learning my way around the various options in PowerShell.
I am working on a script that search for expired accounts in AD and there will be some where my script will take an action, for example if an expired AD user account has not been disabled my script will disable it. Then further down it will check to see if there are more AD groups than Domain Users and remove it there are.
What i would like to know is how do i collate the info from each "action" and and the end of my script if i want to send 1 large email to the IT helpdesk informing of all changes instead of an email per action? I am guessing a need to add things into an array or something and then in my Send-MailMessage command when i define the -Body that i can use a variable like $actionResults that contain all the actions?
If you can guide me to where i need to go search i would really appreciate it. Looking for various options and methods so i can work out which one is better in my situation.
Best regards
Ronnie