Good day all,
My objective for the following powershell script needs to satisfy the following requirements,
1) Get-ADUser from an OU
2) Foreach Users whose Accounts are not disabled
3) Replace the "info" attribute, otherwise known as Telephone's Notes with the Accounts' AccountExpirationDate
My powershell script is as follows,
Import-Module ActiveDirectory
Get-ADUser -Filter * -Properties * -Searchbase "OU....DC..." | ForEach {
if ($_.Enabled -eq "True") {Set-ADUser -Identity $_.SamAccountName -Replace @{Info="Account extended till $_.AccountExpirationDate"}
}Although the script passes and there are values entered to the "info" attribute, a.k.a Telephone's notes, it does not input the value in AccountExpirationDate into the Notes.
The result shown in the Telephone's Notes is as follows,
"Account extended till "
>.< please help.
Best regards,
KY