001
002 003 004 005 006 007 008 009 010 011 012 013 014 |
$users = Import-Csv c:\temp\users.csv
foreach ($user in $users) { try { $ldap= "LDAP://" + "CN=" + $user.DisplayName + ",OU=Test,dc=riolo,dc=co,dc=uk" $u= [ADSI]$ldap $u.Put("userAccountControl", $u.UserAccountControl.Value -bor 65536) $u.SetInfo() } catch [System.Object] { Write-Output "Could not update user $($user.DisplayName), $_" } } |
And this is an example of users.csv:
DisplayName
Alessandro Riolo
Ale Riolo
Alex Riolo
Alejandro Riolo
Alexander Riolo
Iskandar Riolo
Iskender Riolo
Aleksander Riolo
Sandro Riolo
Sasha Riolo
Alasdair Riolo
Alister Riolo
No comments:
Post a Comment