{"id":1320,"date":"2013-06-27T05:14:17","date_gmt":"2013-06-27T05:14:17","guid":{"rendered":"http:\/\/microsoftgeek.com\/?p=1320"},"modified":"2013-10-08T21:26:59","modified_gmt":"2013-10-08T21:26:59","slug":"how-to-map-network-drives-using-powershell","status":"publish","type":"post","link":"https:\/\/microsoftgeek.com\/?p=1320","title":{"rendered":"How to Map Network Drives Using PowerShell"},"content":{"rendered":"<div>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"image\" alt=\"image\" src=\"http:\/\/cdn.howtogeek.com\/wp-content\/uploads\/2012\/12\/image183.png\" width=\"656\" height=\"306\" border=\"0\" \/><\/p>\n<p>In years past, automating network drive creation required the use of primitive batch files, luckily for us you can now do it through PowerShell.<\/p>\n<h3>How to Map Network Drives Using PowerShell<\/h3>\n<p>Prior to the PowerShell era, we could map networks drives using a batch file that contained a net use command:<\/p>\n<blockquote><p>net use M: \\\\touchsmart\\Share \/Persistent:Yes<\/p><\/blockquote>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"sshot-0\" alt=\"\" src=\"http:\/\/cdn.howtogeek.com\/wp-content\/uploads\/2012\/12\/sshot-0.png\" width=\"656\" height=\"306\" border=\"\" \/><\/p>\n<p>To do it in PowerShell, press the Win + R keyboard combination to bring up a run box, then type powershell and hit enter.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"sshot-1\" alt=\"\" src=\"http:\/\/cdn.howtogeek.com\/wp-content\/uploads\/2012\/12\/sshot-1.png\" width=\"656\" height=\"306\" border=\"\" \/><\/p>\n<p>The Cmdlet we are looking for is New-PSDrive, but most importantly you need use the -Persist switch.<\/p>\n<blockquote><p>&nbsp;<\/p>\n<p><code>New-PSDrive \u2013Name \u201cK\u201d \u2013PSProvider FileSystem \u2013Root \u201c\\\\touchsmart\\share\u201d \u2013Persist<\/code><\/p>\n<p><code> <\/code><\/p><\/blockquote>\n<p>Just change the name to a valid (not in use) drive letter and point the root parameter to a valid network share.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"sshot-2\" alt=\"\" src=\"http:\/\/cdn.howtogeek.com\/wp-content\/uploads\/2012\/12\/sshot-2.png\" width=\"656\" height=\"306\" border=\"\" \/><\/p>\n<p>That\u2019s all there is to it.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In years past, automating network drive creation required the use of primitive batch files, luckily for us you can now do it through PowerShell. How to Map Network Drives Using PowerShell Prior to the PowerShell era, we could map networks drives using a batch file that contained a net use command: net use M: \\\\touchsmart\\Share [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[59],"tags":[],"class_list":["post-1320","post","type-post","status-publish","format-standard","hentry","category-powershell"],"_links":{"self":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/1320","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=1320"}],"version-history":[{"count":3,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/1320\/revisions"}],"predecessor-version":[{"id":1322,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/1320\/revisions\/1322"}],"wp:attachment":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1320"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1320"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1320"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}