The other day I showed you how you can use ENUMs.  I showed an example of how you can find all the SPECIALFOLDERs on a system.  Here is a script that I call Mount-SpecialFolders.ps1 which mounts all your special folders as PowerShell drives.


# Mount-SpecialFolders.ps1
param($Folder="*", [SWITCH]$Verbose, [SWITCH]$PassThru)
foreach ($f in [Enum]::GetValues([System.Environment+SpecialFolder]) |where {$_ -like $Folder}) {
    $drive = New-PSDrive -Name $f -PSProvider FileSystem -Root ([Environment]::GetFolderPath($f)) -Scope Global -ErrorAction SilentlyContinue -Verbose:$verbose
    if ($PassThru)
        Write-Output $drive


Jeffrey Snover [MSFT]
Windows Management Partner Architect
Visit the Windows PowerShell Team blog at:
Visit the Windows PowerShell ScriptCenter at: