As part of my user on-boarding PowerShell script, I have a list of AD groups that cover the most common groups assigned "by default". The problem is that I have to manually go in and comment or "un-comment" the lines for the groups to which the user should be added as a member. I have excerpted this section of the script to use for role/job changes.
Here is an example:
Import-Module ActiveDirectory
$sAMAccountName = Read-Host -Prompt "Enter sAMAccountName"
#Add-ADGroupMember -Identity Office365Users -Members $sAMAccountName
#Add-ADGroupMember -Identity SmartsheetUsers -Members $sAMAccountName
#Add-ADGroupMember -Identity "Office Users" -Members $sAMAccountName
#Add-ADGroupMember -Identity SlackUsers -Members $sAMAccountName
#Add-ADGroupMember -Identity "Accounting Users" -Members $sAMAccountName
Add-ADGroupMember -Identity SouthWareUsers -Members $sAMAccountName
Add-ADGroupMember -Identity VPNUsers -Members $sAMAccountName
Add-ADGroupMember -Identity OpenVPNUsers -Members $sAMAccountName
Add-ADGroupMember -Identity TerminalServiceUsers -Members $sAMAccountName
Is there a better way to interact with, or even automate, the process of selecting which groups to add the user?