Microsoft Virtualization Discussions

Setting "show-previous-versions"


When I originally deployed some sites I would have a powershell script that would set the "show-previous-versions" property of a share using the following line:

Invoke-NcSsh vserver cifs share properties add -share-name sharename$ -share-properties access-based-enumeration show-previous-versions



I have some older sites where this was not done, and I was trying to think of an easy way to loop through each share and set this. I have tried a couple things but have had no luck. Even the latest toolkit documentaion does not even show that as a property of "ShareProperties" on the Set-NcCifsSHare commandlet. I tries many different variations of the below syntax...I feel I am missing something simple. 



Is there an easy way to do this that I am missing to get this done, but avoid doing it to the normal "admin$,c$ and ipc$" shares?


$shares = Get-NcCifsShare

foreach ($share in $shares | where $_.sharename -notmatch "$"){Invoke-NcSsh vserver cifs share properties add -share-name $share.shareName -share-properties access-based-enumeration show-previous-versions}


Re: Setting "show-previous-versions"


You can use the Set-NcCifsShare cmdlet to adjust share properties...


Get-NcCifsShare | %{ 
    if ($_.ShareProperties -notcontains "show_previous_versions" -and $_.ShareName -notin 'admin$','c$','ipc$') {
        $_ | Set-NcCifsShare -ShareProperties ($_.ShareProperties += "show_previous_versions")

Hope that helps!



If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

View solution in original post

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