Microsoft Virtualization Discussions

RFE: Get-NaCifsShare Add-NaCifsShare parameter passing

sjallabais
3,998 Views

Hi!

I want to do this:

$tmpShares = Get-NaCifsShare | Where-Object {$_.MountPoint -like "/vol/MyVol/*"}

$tmpShares | Remove-NaCifsShare

..

..do some magic with the volume, and then..

..

$tmpShares | Add-NaCifsShare

Remove-NaCifsShare works fine, but Add-NaCifsShare wont take this object as input from the pipe.

It works if I do a lot of "Select-Object @{Name="Path";Expression={$_."MountPoint"}}" stuff, but should

it be necessary to do a lot of parameter renaming on these? (I think not).

I know I also need to preserve and restore the ACL's with Get-NaCifsShareAcl, Set-NaCifsShareAcl, but they seems

to be "compatible" (I'll be happy if someone has a more elegant way of doing this procedure:)

/Sjalla

3 REPLIES 3

sjallabais
3,998 Views

On second thoughts, the most elegant would be that Get-NaCifsShare and Add-NaCifsShare also (optionally?) could handle the ACL's..

vinith
3,998 Views

Hello,

Add-NaCifsShare accepts values only by property by pipeline, hence you need to convert mountpoint to hashtable property of "path" and pass the values.

Thanks,

Vinith

vinith
3,998 Views

Hello,

Add-NaCifsShare accepts values only by property by pipeline, hence you need to convert mountpoint to hashtable property of "path" and pass the values.

Thanks,

Vinith

Public