Quick 1-liner Code
$accounts=@(
'orange',
'apple',
'pear',
'dog',
'cat',
'dinosaur',
'chicken',
'cow',
'yomama',
'yodada'
)
$accounts|%{try{Set-ADUser -Identity $_ -PasswordNeverExpires $false;write-host "$_ : done"}catch{write-warning "$_ : error"}}
Result:
'orange': done
'apple': done
'pear': done
'dog': done
'cat': done
'dinosaur': done
'chicken': done
'cow': done
'yomama': done
'yodada': done
Categories: