Need import a list of users into a group.
Add-groupmember normally has a break down if the user already exists.
so added some checks and balances before adding them.
user account that are written to screen dont exist in AD
#Grab the Users $lolz = Import-Csv .\users0813.csv #locate the Group $group = get-adgroup remoteaccess #get existing members $groupmembers = Get-ADGroupMember $group #go Silent so that can peform the get-aduser without erros $ErrorActionPreference="SilentlyContinue" foreach ($user in $lolz) { #check if user exist in AD $target=get-aduser $user.'default login' if (!$target){ # display missing ppls Write-Host $user.'default login' } Else { # check if already a member of the group If(!($groupmembers.samaccountname -contains $user.'default login')){ #add to group Add-ADGroupMember $group -Members $user.'default login' } } #set back to null for next persome $target=$null } $ErrorActionPreference="Continue"