Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista Tutorial - Setting share permissions on a files server that does not support

Reply
 
Old 06-12-2008   #1 (permalink)
Géry
Guest


 
 

Setting share permissions on a files server that does not support

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$"



My System SpecsSystem Spec
Old 06-12-2008   #2 (permalink)
Marco Shaw [MVP]
Guest


 
 

Re: Setting share permissions on a files server that does not support

Géry wrote:
Quote:

> 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 !
I can't find anything else that doesn't depend on WMI.

Now, I wonder... Can you:
1. Create the share with your scripts.
2. Mount it locally.
3. Copy a script to the share.
4. Run the script (and it makes the share perm changes).

This link indicates that these permissions are apparently also listed in
the registry:
http://www.tek-tips.com/viewthread.c...1158235&page=1

Marco

--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
My System SpecsSystem Spec
Old 06-12-2008   #3 (permalink)
Géry
Guest


 
 

Re: Setting share permissions on a files server that does not supp

Thx Marco for you fast reply.
But on these Netapp filers (NAS) you can not run any script to change the
share permissions.
I can create the share and set the permissions using the standard
"shrpubw.exe" 'Create a Shared folder wizard.' This EXE does not use WMI and
it is able to create set security on remote NAS devices

Géry

"Marco Shaw [MVP]" wrote:
Quote:

> Géry wrote:
Quote:

> > 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 !
>
> I can't find anything else that doesn't depend on WMI.
>
> Now, I wonder... Can you:
> 1. Create the share with your scripts.
> 2. Mount it locally.
> 3. Copy a script to the share.
> 4. Run the script (and it makes the share perm changes).
>
> This link indicates that these permissions are apparently also listed in
> the registry:
> http://www.tek-tips.com/viewthread.c...1158235&page=1
>
> Marco
>
> --
> Microsoft MVP - Windows PowerShell
> http://www.microsoft.com/mvp
>
> PowerGadgets MVP
> http://www.powergadgets.com/mvp
>
> Blog:
> http://marcoshaw.blogspot.com
>
My System SpecsSystem Spec
Old 06-12-2008   #4 (permalink)
Marco Shaw [MVP]
Guest


 
 

Re: Setting share permissions on a files server that does not supp

Géry wrote:
Quote:

> Thx Marco for you fast reply.
> But on these Netapp filers (NAS) you can not run any script to change the
> share permissions.
> I can create the share and set the permissions using the standard
> "shrpubw.exe" 'Create a Shared folder wizard.' This EXE does not use WMI and
> it is able to create set security on remote NAS devices
So you've find something that works for you?

Marco
My System SpecsSystem Spec
Old 06-12-2008   #5 (permalink)
Brandon [MVP]
Guest


 
 

Re: Setting share permissions on a files server that does not supp

You do this via the web interface on the NetApp or SSH. Those are your
options.

You can automate both of those with Powershell, but I think wrapping the EXE
would be faster and way less complicated.

"Géry" <Gry@xxxxxx> wrote in message
news:C4AFE100-A472-4C8F-A4D4-B8F249BAE680@xxxxxx
Quote:

> Thx Marco for you fast reply.
> But on these Netapp filers (NAS) you can not run any script to change the
> share permissions.
> I can create the share and set the permissions using the standard
> "shrpubw.exe" 'Create a Shared folder wizard.' This EXE does not use WMI
> and
> it is able to create set security on remote NAS devices
>
> Géry
>
> "Marco Shaw [MVP]" wrote:
>
Quote:

>> Géry wrote:
Quote:

>> > 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 !
>>
>> I can't find anything else that doesn't depend on WMI.
>>
>> Now, I wonder... Can you:
>> 1. Create the share with your scripts.
>> 2. Mount it locally.
>> 3. Copy a script to the share.
>> 4. Run the script (and it makes the share perm changes).
>>
>> This link indicates that these permissions are apparently also listed in
>> the registry:
>> http://www.tek-tips.com/viewthread.c...1158235&page=1
>>
>> Marco
>>
>> --
>> Microsoft MVP - Windows PowerShell
>> http://www.microsoft.com/mvp
>>
>> PowerGadgets MVP
>> http://www.powergadgets.com/mvp
>>
>> Blog:
>> http://marcoshaw.blogspot.com
>>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Share Permissions For Folders General Discussion
Setting up LAN connection to share files and play AOE II:Conq on vista OSs Vista Games
Setting share permissions from PowerShell? PowerShell
get permissions from share via wmi possible PowerShell
Setting multiple files permissions Vista security


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46