I have a simple script and I'm trying export csv file with only two columns $findUser.Name and $userStatus but I'm not sure why it's not exporting the value for those two.
Any help or suggestion would be really appreciated.
$groupdMember = Get-AdGroupMember -Identity $GroupName
foreach($member in $groupdMember){
$findUser = Get-ADUser -Identity $member.Name
if($findUser.Enabled -eq "False"){
$userStatus = "Disabled"
}else{
$userStatus = "Enabled"
}
Write-Host $findUser.Name, $userStatus
$member | Select-Object $findUser.Name, $userStatus | Export-Csv -Path E:\scripts\aduser-report.csv -Append -notypeinformation -force
}
If I removed the Select-Object then it able to export it but it's not what I wanted. I just wanted to export a csv file that have only $finduser.Name and $userStatus.