{"id":84,"date":"2007-12-19T10:22:22","date_gmt":"2007-12-19T10:22:22","guid":{"rendered":"https:\/\/www.wapshere.com\/missmiis\/?p=84"},"modified":"2009-04-05T08:01:32","modified_gmt":"2009-04-05T08:01:32","slug":"updating-ad-attributes-from-an-excel-spreadsheet","status":"publish","type":"post","link":"https:\/\/www.wapshere.com\/missmiis\/updating-ad-attributes-from-an-excel-spreadsheet","title":{"rendered":"Updating AD attributes from an Excel spreadsheet"},"content":{"rendered":"<p>You don&#8217;t always have access to a proper IdM system. At the moment I&#8217;m at an organisation which still uses the old, manual ways of updating AD. I was asked if I knew an easy way to update the mobile phone numbers of a list of users, the data having been sent to Helpdesk in a spreadsheet. I knew that a long list of departments were shortly to be changed as well, so I figured I&#8217;d make a general solution, where you could also specify the attribute name in the spreadsheet.<\/p>\n<p>I actually ended up writing the script twice.<\/p>\n<p><!--more--><\/p>\n<ol>\n<li>First I used DNs as the search criteria, which makes the script quite simple, and also means it will work with any object type. You can see that script <a href=\"https:\/\/www.wapshere.com\/missmiis\/?page_id=81\" target=\"_blank\">here<\/a>.<\/li>\n<li>Then, after seeing that the source spreadsheet contained usernames rather than DNs, I modified the script to use the CN instead. The restriction is that now the script only works with user objects (though there&#8217;s actually no reason why you couldn&#8217;t make a column for the object type in the spreadsheet as well). That script is <a href=\"https:\/\/www.wapshere.com\/missmiis\/?page_id=83\" target=\"_blank\">here<\/a>.<\/li>\n<\/ol>\n<p>It needs to be noted that these scripts should only be used for updating single-valued attributes. I have included <em>no back-out<\/em> &#8211; so if you have the wrong data in your spreadsheet I accept no responsibility for you putting rubbish in your AD.<\/p>\n<p>You also need to make sure your spreadsheet is tidy, with even column lengths, and no blank row in the middle (the script stops at the first blank cell).<\/p>\n<p>For the CN script your spreadsheet should look something like this:<\/p>\n<table border=\"1\">\n<tbody>\n<tr>\n<td>jbloggs<\/td>\n<td>department<\/td>\n<td>IT Helpdesk<\/td>\n<\/tr>\n<tr>\n<td>jbloggs<\/td>\n<td>mobile<\/td>\n<td>0123456789<\/td>\n<\/tr>\n<tr>\n<td>hzhen<\/td>\n<td>description<\/td>\n<td>Administrative Assistant<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>You don&#8217;t always have access to a proper IdM system. At the moment I&#8217;m at an organisation which still uses the old, manual ways of updating AD. I was asked if I knew an easy way to update the mobile phone numbers of a list of users, the data having been sent to Helpdesk in&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":[]},"categories":[24,38,10],"tags":[],"class_list":["post-84","post","type-post","status-publish","format-standard","hentry","category-ad","category-excel","category-vbscript"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pkp1o-1m","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/84","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/comments?post=84"}],"version-history":[{"count":1,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/84\/revisions"}],"predecessor-version":[{"id":464,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/84\/revisions\/464"}],"wp:attachment":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/media?parent=84"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/categories?post=84"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/tags?post=84"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}