Hi all,
i have a csv file With samaccountname Field and a list of users.
Would like to use this list to Query if users exist and if account is enabled.
I tried this,but its not working:
Import-Csvlistofusers.csv|ForEach-Object{
New-Object-TypeNamePSCustomObject-Property@{
samaccountname
=$_.samaccountname
exist
=[bool]($account=([adsisearcher]"(samaccountname=$($_.samaccountname))").findone())
enabled
=[bool]($account.properties.useraccountcontrol[0]-band2)
}
}
|Export-CsvOutput.csv-NoTypeInformation
Any ideas?
thanks!