Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Extraction of Account Expiration to Telephone's Notes (AD)

$
0
0

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


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>