Microsoft Virtualization Discussions

Rename CIFS Share

tyrone_owen_1
1,207 Views

Hi,

 

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?

 

Thanks

0 REPLIES 0
Public