Last active
February 10, 2017 23:48
Revisions
-
davewilson renamed this gist
Jun 25, 2014 . 1 changed file with 15 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -31,4 +31,19 @@ function Mount-CommonShare New-PSDrive -Name "Y" -PSProvider FileSystem -Root "\\server2\share" -Persist -Scope global -Credential $Username New-PSDrive -Name "X" -PSProvider FileSystem -Root "\\server3\share" -Persist -Scope global -Credential $Username } } <# .Synopsis Removes mapped network shares created with Mount-CommonShare. .DESCRIPTION Removes mapped network shares created with Mount-CommonShare. .EXAMPLE Dismount-CommonShare #> function Dismount-CommonShare { Remove-PSDrive -Name "X" Remove-PSDrive -Name "Y" Remove-PSDrive -Name "Z" } -
davewilson renamed this gist
Jun 25, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
davewilson created this gist
Jun 25, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ <# .Synopsis Maps commonly used network shares .DESCRIPTION Maps drives for commonly used network shares. Username parameter will map the drives as a specific user .EXAMPLE Mount-CommonShare .EXAMPLE Mount-CommonShare -Username stcxyz #> function Mount-CommonShare { [CmdletBinding()] [OutputType([int])] Param ( [Parameter(ValueFromPipelineByPropertyName=$true, Position=0)] $Username ) if ($Username -eq $null) { New-PSDrive -Name "Z" -PSProvider FileSystem -Root "\\server1\share" -Persist -Scope global New-PSDrive -Name "Y" -PSProvider FileSystem -Root "\\server2\share" -Persist -Scope global New-PSDrive -Name "X" -PSProvider FileSystem -Root "\\server3\share" -Persist -Scope global } else { New-PSDrive -Name "Z" -PSProvider FileSystem -Root "\\server1\share" -Persist -Scope global -Credential $Username New-PSDrive -Name "Y" -PSProvider FileSystem -Root "\\server2\share" -Persist -Scope global -Credential $Username New-PSDrive -Name "X" -PSProvider FileSystem -Root "\\server3\share" -Persist -Scope global -Credential $Username } }