Microsoft Virtualization Discussions

Rename CIFS Share




I hope that you can help.


I want to rename a bunch of CIFS shares using the PSTK - I don't think you can technically rename a share so I am creating/deleting. I'm using the following to retrieve the current share properties that I am interested in keeping:


$oldshareproperties = Get-NcCifsShare -Name $oldshare |
    Select-Object ShareName,Acl,Path,Comment,Vserver,OfflineFilesMode,ShareProperties


I'm then creating some variables to create the new share name with the existing properties:


$newshare = "$($oldshareproperties.ShareName)RO$"
$activepath = $oldshareproperties.Path
$newcomment = "READ ONLY $($oldshareproperties.Comment)"
$newofflinemode = $oldshareproperties.OfflineFilesMode
$newproperties = $oldshareproperties.ShareProperties

Add-NcCifsShare -Name $newshare -Path $activepath -Comment $newcomment -OfflineFilesMode $newofflinemode -ShareProperties $newproperties

I can capture the ACL (everyone / read) from the existing share but how do I turn these into arguments for the Set-NcCifsShareAcl, i.e. -UserOrGroup and -Permission?



Earn Rewards for Your Review!
GPI Review Banner
All Community Forums