{"id":2229,"date":"2017-06-21T21:58:52","date_gmt":"2017-06-21T21:58:52","guid":{"rendered":"http:\/\/microsoftgeek.com\/?p=2229"},"modified":"2023-05-12T13:32:31","modified_gmt":"2023-05-12T18:32:31","slug":"powershell-how-to-change-ad-user-description-field","status":"publish","type":"post","link":"https:\/\/microsoftgeek.com\/?p=2229","title":{"rendered":"Powershell \u2013 How to change AD user description field"},"content":{"rendered":"<p>In this article we will be using Powershell to perform this. But be aware that we can do this from Active Directory Users and Computers as well.<\/p>\n<p>Let us say that we have a user Ronnie and the description provided for the user is \u201cRonnie is from the Marketing Team\u201d<\/p>\n<p>You can see the below from the Active Directory Users and Computers.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-855 no-display appear\" src=\"http:\/\/www.enterprisedaddy.com\/wp-content\/uploads\/2015\/06\/Capture2.png\" alt=\"Powershell - How to change AD user description field\" width=\"427\" height=\"340\" \/><\/p>\n<p>Let us say that you want to change that to \u201cMarketing Department User\u201d<\/p>\n<p>We would use a cmdlet called Set-ADUser to perform this action.<\/p>\n<p>This is actually one of the cmdlets which has the ability to modify the largest number of attributes related to a user account in Active Directory.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-848 no-display appear\" src=\"http:\/\/www.enterprisedaddy.com\/wp-content\/uploads\/2015\/06\/Capture.png\" alt=\"Powershell - How to change AD user description field\" width=\"966\" height=\"283\" \/><\/p>\n<p>So the command that will change the description is<\/p>\n<p><strong>Set-ADUser Ronnie -Description\u00a0&#8220;Marketing Department User&#8221;<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-856 no-display appear\" src=\"http:\/\/www.enterprisedaddy.com\/wp-content\/uploads\/2015\/06\/Capture11.png\" alt=\"Powershell - How to change AD user description field\" width=\"869\" height=\"173\" \/><\/p>\n<p>Yes it was as simple as that.<\/p>\n<p>Now this doesn\u2019t make sense for a single account to do this from a Powershell window. You are better off using the Active Directory Users and Computers.<\/p>\n<p>But imagine, you as an Administrator receive request to change 500 user descriptions and your manager just sent that in an excel sheet.<\/p>\n<p>That is when Powershell comes into the picture to make your life simple.<\/p>\n<p>Let us say that you modified the excel file that you received and converted to csv file in the below format.<\/p>\n<p>The first column contains the SamAccountName and the second column you can have the updated description that needs to be applied.<\/p>\n<p>So the way you would write the script will be as seen below.<\/p>\n<p><span style=\"color: #0000ff;\">Import-Module ActiveDirectory<\/span><br \/>\n<span style=\"color: #0000ff;\">$Users = Import-csv c:\\Users.csv<\/span><br \/>\n<span style=\"color: #0000ff;\">foreach($User in $Users){<\/span><br \/>\n<span style=\"color: #0000ff;\">Set-ADUser $User.SamAccountName -Description $User.NewDescription<\/span><br \/>\n<span style=\"color: #0000ff;\">}<\/span><\/p>\n<p>Save it as a .ps1 file and run from a Powershell window.<\/p>\n<p>Boom! You just updated 500 User accounts details that easily.<\/p>\n<p>I hope that this was informative and thank you for reading!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article we will be using Powershell to perform this. But be aware that we can do this from Active Directory Users and Computers as well. Let us say that we have a user Ronnie and the description provided for the user is \u201cRonnie is from the Marketing Team\u201d You can see the below [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[42,59],"tags":[],"class_list":["post-2229","post","type-post","status-publish","format-standard","hentry","category-ad","category-powershell"],"_links":{"self":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/2229","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2229"}],"version-history":[{"count":3,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/2229\/revisions"}],"predecessor-version":[{"id":3361,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/2229\/revisions\/3361"}],"wp:attachment":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2229"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}