Hi,
I am trying to create a remote share on a server that does not support WMI
(Netapp filer) using powershell.
So far I can create and delete shares but I am unable to set the share
permissions correctly !
Here is my test code
function delete-share {
param (
[string]$Server = $(Throw "you must specify a server"),
[string]$DeleteShare = $(Throw "deleteshare name is mandatory")
)
$ServerObj = [adsi] "WinNT://$Server/lanmanserver"
$ServerObj.delete("fileshare",$DeleteShare)
$dummy = [adsi] "WinNT://$Server/lanmanserver/$DeleteShare"
}
function create-share {
param (
[string]$Server = $(Throw "you must specify a server"),
[string]$NewShare = $(Throw "Newshare name is mandatory"),
[string]$Localpath,
[string]$Description
)
$ServerObj = [adsi] "WinNT://$Server/lanmanserver"
$newshareobj = $ServerObj.create("fileshare",$NewShare)
$newshareobj.put("path",$Localpath)
$newshareobj.put("Description",$Description)
$newshareobj.setinfo()
$dummy = [adsi] "WinNT://$Server/lanmanserver/$NewShare"
}
create-share "servername" "test$" "c:\WINDOWS"
delete-share "servername" "test$"


