Microsoft Virtualization Discussions
Microsoft Virtualization Discussions
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.. 😉
Solved! See The Solution
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
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
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
^^
This is assuming he's not using vfilers
Thanks I was able to take this code and add to it. even the ability to output in "GB", "TB" etc..
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
this also helped me as well.