标签:share powershell
param($folderPath,$shareName,$maxAllowed=5,$description="BY PowerShell!")
if(!$folderPath)
{
Write-Host "缺少需要共享的目录!";exit
}
if(!$shareName)
{
Write-Host "缺少共享名称!";exit
}
$class="win32_share"
$type=0
if(!(Test-Path $folderPath))
{
New-Item -Path $folderpath -ItemType directory
}
$objwmi=[WmiClass]$class
$objwmi.create($folderpath,$shareName,$type,$maxallowed,$description)
本文出自 “加速器” 博客,请务必保留此出处http://3544640.blog.51cto.com/3534640/1649648
标签:share powershell
原文地址:http://3544640.blog.51cto.com/3534640/1649648