If i query AD and add all the information on variable $ad, the contents are in memory and not a realtime stage.
So, if i do modify properties of an AD user, all those modification are done through $ad via Set-ADUser.
In every property change i prompt "are you sure about the change of this for that?" and give the opportunity of changing more properties of the same user by asking for it.
But, if i typed a wrong last name and the time comes to ask "are you sure about the change of this for that" $ad has the old value not the new value. Is there anyway to query AD in real time?
$ad = Get-ADUser -filter * -Properties sAMAccountName,sn,givenName,department,title,telephoneNumber,employeeID,employeeNumber -SearchBase "OU=ou,DC=domain,DC=com" | Select-Object sAMAccountName,sn,givenName,department,title,telephoneNumber,employeeID,employeeNumber
Thanks for your help,