PoshCode Archive  Artifact [a668889506]

Artifact a668889506f9168e1148a793dd6846c565836c3da86b0afe270f9a6b54c7485e:

  • File More-PSDrives.ps1 — part of check-in [21461c37d8] at 2018-06-10 13:33:57 on branch trunk — Two functions for create and remove additional drives. (user: greg zakharov size: 1102)

# encoding: ascii
# api: powershell
# title: More PSDrives
# description: Two functions for create and remove additional drives.
# version: 0.1
# type: function
# author: greg zakharov
# license: CC0
# function: Mount-UserDrives
# x-poshcode-id: 3983
# x-archived: 2013-02-27T05:27:24
# x-published: 2013-02-21T14:10:00
#
#
function Mount-UserDrives {
  <#
    .Synopsis
        Create additional user drives.
    .Description
        To remove drives created with this function use Remove-UserDrives.
    .Link
        New-PSDrive
        Remove-UserDrives
  #>
  [Enum]::GetNames([Environment+SpecialFolder]) | % {
    New-PSDrive -n $_ -ps FileSystem -r $([Environment]::GetFolderPath($_)) -s Global | Out-Null
  }
}

function Remove-UserDrives {
  <#
    .Synopsis
        Remove additional user drives.
    .Description
        Dismount drives which mounted with Mount-UserDrives.
    .Link
        Remove-PSDrive
        Mount-UserDrives
  #>
  [Enum]::GetNames([Environment+SpecialFolder]) | % {
    Remove-PSDrive -n $_ -ps FileSystem -s Global
  }
}