Microsoft Virtualization Discussions

Getting Share information from 7 mode to map to cmode

peter65
9,011 Views

Greetings -

 

I would like to get all of our share information (path, acl share and vols name) and size of the vols exported to a csv / excel sheet. So I can evaluate and look to where I need to map and create these new shares on our cmode filers. I do not wish to use the 7Mode transition tool as we wish to re-do our shares on the cmode system that are cleaner.

 

Can anyone provide some codde snippets for this as I am somewhat of a newb on the dataontap kit / posh.

 

thanks much. If clarification is neede please advise.. 😉

1 ACCEPTED SOLUTION

Aparajita
8,875 Views

Hello Peter,

 

In case you want to avoid using tools, or really want to keep it simple, a script along the lines of the one given below should get the job done.

 

This script would create a CSV file with the Path, Acl, ShareName, Volume name and VolumeSize of all shares on a 7mode system. If you need any additional data, you need to determine which cmdlet will return the data and then extend the script. You would also need to add error handling.

 

param([String]$output_name)
"Share Name, Mount Point, Volume Name, Volume Size, ACL Information" | Out-File $output_name #Writes the Excel headers
$shares = Get-NaCifsShare #Get a list of all shares in the system
foreach ($share in $shares) {
    $share_name = $share.ShareName
    $vol_name = ($share.MountPoint -split "/")[2] #Since mountpoint will always be of form /vol/vol_name/<possibly something_else> and splitting produces null,vol,vol_name,<something_else>
    if ($vol_name -eq $null) { continue } #Helps skip the admin shares like /etc
    $vol_size = (Get-NaVolSize $vol_name).VolumeSize #If you require any other volume attributes, Get-NaVol should return those
    $acl_information_array = (Get-NaCifsShareAcl $share_name).UserAclInfo
    $acl_information = $acl_information_array -join ';' #Converting the array in to a string and using ; as delimiter since , is used as delimiter in the CSV
    $share_name + "," + $share.MountPoint + "," + $vol_name + "," + $vol_size + "," + $acl_information | Out-File $output_name -Append  #Append the row
}

 

You will probably want to add cases for qtress at the very least before using this (i.e. if a share is a qtree, rather than a volume, do you want the Qtree information as well?). But hopefully this will help you start.

 

Regards,

Aparajita

View solution in original post

7 REPLIES 7

billyd
8,892 Views

Hello Peter,

 

Have you considered using nSANITY and the 7-Mode Parser tool?  nSANITY will pull data from your controllers and the 7-mode Parser tool will create the spreadsheet.

 

nSANITY: https://private-communities.netapp.com/community/netapp_partners_network/ps/service/tools/nsanity

 

 

7-Mode Parser Tool: https://private-communities.netapp.com/docs/DOC-28497

 

 

Aparajita
8,876 Views

Hello Peter,

 

In case you want to avoid using tools, or really want to keep it simple, a script along the lines of the one given below should get the job done.

 

This script would create a CSV file with the Path, Acl, ShareName, Volume name and VolumeSize of all shares on a 7mode system. If you need any additional data, you need to determine which cmdlet will return the data and then extend the script. You would also need to add error handling.

 

param([String]$output_name)
"Share Name, Mount Point, Volume Name, Volume Size, ACL Information" | Out-File $output_name #Writes the Excel headers
$shares = Get-NaCifsShare #Get a list of all shares in the system
foreach ($share in $shares) {
    $share_name = $share.ShareName
    $vol_name = ($share.MountPoint -split "/")[2] #Since mountpoint will always be of form /vol/vol_name/<possibly something_else> and splitting produces null,vol,vol_name,<something_else>
    if ($vol_name -eq $null) { continue } #Helps skip the admin shares like /etc
    $vol_size = (Get-NaVolSize $vol_name).VolumeSize #If you require any other volume attributes, Get-NaVol should return those
    $acl_information_array = (Get-NaCifsShareAcl $share_name).UserAclInfo
    $acl_information = $acl_information_array -join ';' #Converting the array in to a string and using ; as delimiter since , is used as delimiter in the CSV
    $share_name + "," + $share.MountPoint + "," + $vol_name + "," + $vol_size + "," + $acl_information | Out-File $output_name -Append  #Append the row
}

 

You will probably want to add cases for qtress at the very least before using this (i.e. if a share is a qtree, rather than a volume, do you want the Qtree information as well?). But hopefully this will help you start.

 

Regards,

Aparajita

JGPSHNTAP
8,872 Views

^^
This is assuming he's not using vfilers

peter65
8,845 Views
Not able to access either link. I was able to grab nsanity from the utility chest but link is no good for the 7 mode parser and 7 mode parser is not found in the utility chest.

peter65
8,719 Views

Thanks I was able to take this code and add to it. even the ability to output in "GB", "TB" etc..

 

mbeattie
8,793 Views

Hi Peter

 

Assuming you have mulitple controllers and are running OnCommand unified manager (AKA DFM) to montior them all, have you considered running a DFM report to gather this information?

Here is an example of listing the default reports:

 

>dfm report list | find /i "qtree"

>dfm report list | find /i "cifs"

 

Here is an example of running the dfm report and outputting the results to a .csv file:

 

>dfm report view -F csv cifs-shares > cifs-shares.csv

 

Assuming you have added controllers to a DFM group (EG all file serving controllers are in a DFM file serving group) then you can also run the report on the DFM group object ID to filter the results.

See "dfm group list" to find the ID and then run the report on that id to limit the results to a list of controllers in the group. EG "dfm report view -F csv cifs-shares %dfmObjectID% > cifs-shares.csv"

The "qtrees-capacity" report will provide the size of the data in your shares. DFM won't provide the NTFS Permissions of the shares (but this can easy be done by creating a batch file). EG

 

>icacls %uncpath% | find /i ":"  >> ntfs.txt

 

hope that helps

 

/matt

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

peter65
8,716 Views

this also helped me as well.

Public