Try the following:
# Import the Active Directory module
Import-Module ActiveDirectory
# Get all AD users with the necessary properties
$users = Get-ADUser -Filter * -Properties SamAccountName, ChangePasswordAtLogon, DistinguishedName
# Select the desired properties and export to CSV
$users | Select-Object SamAccountName, @{Name='ChangePasswordAtLogon';Expression={($_.ChangePasswordAtLogon -eq $true)}}, DistinguishedName | Export-Csv -Path "ADUsers.csv" -NoTypeInformation
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin