{"id":1867,"date":"2016-09-05T11:30:13","date_gmt":"2016-09-05T16:30:13","guid":{"rendered":"http:\/\/wildow.com\/?p=1867"},"modified":"2016-09-05T11:30:13","modified_gmt":"2016-09-05T16:30:13","slug":"how-to-remove-home-folder-mapping-for-all-ad-users","status":"publish","type":"post","link":"https:\/\/wildow.com\/?p=1867","title":{"rendered":"How to Remove Home Folder Mapping for all AD Users"},"content":{"rendered":"<header class=\"postheader_magnum\">\n<h1 class=\"posttitle_magnum\"><a href=\"https:\/\/chrisreinking.com\/how-to-remove-home-folder-mapping-for-all-ad-users\/#header\" rel=\"bookmark\">How to Remove Home Folder Mapping for all AD Users<\/a><\/h1>\n<p><a title=\"https:\/\/chrisreinking.com\/\" href=\"https:\/\/chrisreinking.com\/\" target=\"_blank\">https:\/\/chrisreinking.com\/<\/a><\/p>\n<\/header>\n<div class=\"postcontent_magnum\">\n<p>With so many businesses adopting Microsoft Office 365 or Google Apps for Work, users are now able to put more of their files in the cloud &#8211; thus replacing on-site server storage and user home directories. The below Powershell script will remove all user home folder mappings in Active Directory:<\/p>\n<ol class=\"linenums\">\n<li class=\"L0\"><code><span class=\"typ\">Get<\/span><span class=\"pun\">-<\/span><span class=\"typ\">AdUser<\/span> <span class=\"pun\">-<\/span><span class=\"typ\">Filter<\/span> <span class=\"pun\">*<\/span> <span class=\"pun\">-<\/span><span class=\"typ\">Properties<\/span> <span class=\"pun\">*<\/span> <span class=\"pun\">|<\/span> <span class=\"typ\">Foreach<\/span> <span class=\"pun\">{<\/span> <\/code><\/li>\n<li class=\"L1\"><code> <span class=\"typ\">Write<\/span><span class=\"pun\">-<\/span><span class=\"typ\">Host<\/span> <span class=\"str\">\"- \"<\/span><span class=\"pln\"> $_<\/span><span class=\"pun\">.<\/span><span class=\"typ\">Name<\/span><\/code><\/li>\n<li class=\"L2\"><code> <span class=\"kwd\">if<\/span> <span class=\"pun\">(<\/span><span class=\"pln\">$_<\/span><span class=\"pun\">.<\/span><span class=\"typ\">HomeDrive<\/span> <span class=\"pun\">-<\/span><span class=\"pln\">ne $null<\/span><span class=\"pun\">)<\/span> <span class=\"pun\">{<\/span><\/code><\/li>\n<li class=\"L3\"><code> <span class=\"typ\">Write<\/span><span class=\"pun\">-<\/span><span class=\"typ\">Host<\/span> <span class=\"pun\">-<\/span><span class=\"typ\">NoNewline<\/span> <span class=\"str\">\"|- Current home:\"<\/span><span class=\"pln\"> $_<\/span><span class=\"pun\">.<\/span><span class=\"typ\">HomeDrive<\/span> <span class=\"str\">\"-&gt;\"<\/span><span class=\"pln\"> $_<\/span><span class=\"pun\">.<\/span><span class=\"typ\">HomeDirectory<\/span><span class=\"str\">\": removing... \"<\/span><\/code><\/li>\n<li class=\"L4\"><code> <span class=\"typ\">Set<\/span><span class=\"pun\">-<\/span><span class=\"typ\">AdUser<\/span> <span class=\"pun\">-<\/span><span class=\"typ\">Identity<\/span><span class=\"pln\"> $_<\/span><span class=\"pun\">.<\/span><span class=\"typ\">DistinguishedName<\/span> <span class=\"pun\">-<\/span><span class=\"typ\">HomeDirectory<\/span><span class=\"pln\"> $null <\/span><span class=\"pun\">-<\/span><span class=\"typ\">HomeDrive<\/span><span class=\"pln\"> $null<\/span><\/code><\/li>\n<li class=\"L5\"><code> <span class=\"typ\">Write<\/span><span class=\"pun\">-<\/span><span class=\"typ\">Host<\/span> <span class=\"str\">\"Done.\"<\/span><\/code><\/li>\n<li class=\"L6\"><code> <span class=\"pun\">}<\/span><\/code><\/li>\n<li class=\"L7\"><code><span class=\"pun\">}<\/span><\/code><\/li>\n<\/ol>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>How to Remove Home Folder Mapping for all AD Users https:\/\/chrisreinking.com\/ With so many businesses adopting Microsoft Office 365 or Google Apps for Work, users are now able to put more of their files in the cloud &#8211; thus replacing &#8230; <a class=\"more-link\" href=\"https:\/\/wildow.com\/?p=1867\">Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38,4],"tags":[],"class_list":["post-1867","post","type-post","status-publish","format-standard","hentry","category-o365","category-windows"],"_links":{"self":[{"href":"https:\/\/wildow.com\/index.php?rest_route=\/wp\/v2\/posts\/1867","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wildow.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wildow.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wildow.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wildow.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1867"}],"version-history":[{"count":1,"href":"https:\/\/wildow.com\/index.php?rest_route=\/wp\/v2\/posts\/1867\/revisions"}],"predecessor-version":[{"id":1868,"href":"https:\/\/wildow.com\/index.php?rest_route=\/wp\/v2\/posts\/1867\/revisions\/1868"}],"wp:attachment":[{"href":"https:\/\/wildow.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1867"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wildow.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1867"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wildow.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1867"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}