I'm trying to log the results of the following script.
The script runs successfully & the Out-File is created, however it is blank. What am I doing wrong?
#first, let's get the DistinguishedName of the group
$grp = get-ADGroup "MI_Exchange_O365"
$grpDN = $grp.DistinguishedName
#Now let's read in the list of users display names.
$list = get-content "C:\AD group remove\userlist.txt"
#Now we can read through the list, find each user's DistinguishedName
foreach ($item in $list)
add-ADGroupMember -identity $grpDN -Members $item -Confirm:$false | Out-File "C:\AD group remove\Add_log.txt" -Append