Skip to content

Instantly share code, notes, and snippets.

@ranadiprony
Created January 30, 2017 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ranadiprony/caa450b6eb3a305a5e223e7badfa6f9b to your computer and use it in GitHub Desktop.
Save ranadiprony/caa450b6eb3a305a5e223e7badfa6f9b to your computer and use it in GitHub Desktop.
Creates New Share with Powershell
function New-Share {
param($Path, $Name)
try {
$ErrorActionPreference = 'Stop'
if ( (Test-Path $Path) -eq $false) {
$null = New-Item -Path $Path -ItemType Directory
}
net share $Name=$Path
}
catch {
Write-Warning "Create a new share: Failed, $_"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment