{"id":17836,"date":"2008-12-15T07:58:34","date_gmt":"2008-12-15T15:58:34","guid":{"rendered":"http:\/\/devblogs.microsoft.com\/powershell\/?p=17836"},"modified":"2019-06-07T08:02:59","modified_gmt":"2019-06-07T16:02:59","slug":"mount-specialfolders-ps1","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/mount-specialfolders-ps1\/","title":{"rendered":"Mount-SpecialFolders.ps1"},"content":{"rendered":"<p>The other day I showed you how you can use ENUMs.&#160; I showed an example of how you can find all the SPECIALFOLDERs on a system.&#160; Here is a script that I call Mount-SpecialFolders.ps1 which mounts all your special folders as PowerShell drives. <\/p>\n<p>&#160;<\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\"># Mount-SpecialFolders.ps1     <br \/>#      <br \/>param($Folder=&quot;*&quot;, [SWITCH]$Verbose, [SWITCH]$PassThru)      <br \/>foreach ($f in [Enum]::GetValues([System.Environment+SpecialFolder]) |where {$_ -like $Folder}) {       <br \/>&#160;&#160;&#160; $drive = New-PSDrive -Name $f -PSProvider FileSystem -Root ([Environment]::GetFolderPath($f)) -Scope Global -ErrorAction SilentlyContinue -Verbose:$verbose      <br \/>&#160;&#160;&#160; if ($PassThru)      <br \/>&#160;&#160;&#160; {      <br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; Write-Output $drive      <br \/>&#160;&#160;&#160; }      <br \/>} <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\"><\/font><\/p>\n<p>Enjoy!<\/p>\n<p>Jeffrey Snover [MSFT]   <br \/>Windows Management Partner Architect    <br \/>Visit the Windows PowerShell Team blog at:&#160;&#160;&#160; <a href=\"http:\/\/blogs.msdn.com\/PowerShell\">http:\/\/blogs.msdn.com\/PowerShell<\/a>    <br \/>Visit the Windows PowerShell ScriptCenter at:&#160; <a href=\"http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx\">http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The other day I showed you how you can use ENUMs.&#160; I showed an example of how you can find all the SPECIALFOLDERs on a system.&#160; Here is a script that I call Mount-SpecialFolders.ps1 which mounts all your special folders as PowerShell drives. &#160; # Mount-SpecialFolders.ps1 # param($Folder=&quot;*&quot;, [SWITCH]$Verbose, [SWITCH]$PassThru) foreach ($f in [Enum]::GetValues([System.Environment+SpecialFolder]) |where [&hellip;]<\/p>\n","protected":false},"author":600,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[218,325],"class_list":["post-17836","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-mount-specialfolders","tag-system-environment"],"acf":[],"blog_post_summary":"<p>The other day I showed you how you can use ENUMs.&#160; I showed an example of how you can find all the SPECIALFOLDERs on a system.&#160; Here is a script that I call Mount-SpecialFolders.ps1 which mounts all your special folders as PowerShell drives. &#160; # Mount-SpecialFolders.ps1 # param($Folder=&quot;*&quot;, [SWITCH]$Verbose, [SWITCH]$PassThru) foreach ($f in [Enum]::GetValues([System.Environment+SpecialFolder]) |where [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/17836","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/600"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=17836"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/17836\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=17836"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=17836"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=17836"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}