<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Script needed - Which CIFS shares are also exported to Linux? in ONTAP Discussions</title>
    <link>https://community.netapp.com/t5/ONTAP-Discussions/Script-needed-Which-CIFS-shares-are-also-exported-to-Linux/m-p/127355#M27598</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/27177"&gt;@Livewire18&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't help with an OCUM query, but getting the information using the PowerShell toolkit is relatively easy...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Get-NcVserver | ?{ $_.VserverType -eq "data" } | %{
    $svm = $_.Vserver

    Write-Host "SVM $($svm)"

    Get-NcVol -Vserver $svm | ?{ $_.JunctionPath -ne $null -and $_.VolumeExportAttributes.Policy -ne $null -and $_.VolumeStateAttributes.IsVserverRoot -eq $false } | %{
        $volName = $_.Name

        $share = $false

        Get-NcCifsShare -VserverContext $svm -Query @{ Path = "!/" } | %{
            if (($_.Path -split "/")[1] -eq $volName) {
                $share = $true
            }
        }
        
        $cifs = $false
        $nfs = $false

        Get-NcExportPolicy -Vserver $svm -Name $_.VolumeExportAttributes.Policy | Get-NcExportRule | %{
            if ($_.Protocol -contains "nfs" -or $_.Protocol -contains "any") {
                $nfs = $true
            }

            if ($_.Protocol -contains "cifs" -or $_.Protocol -contains "any") {
                $cifs = $true
            }
        }

        if ($cifs -and $nfs) {
            Write-Host -NoNewline -ForegroundColor Blue "  Volume $($volName) is accessible by CIFS and NFS"
        } elseif ($cifs -and !$nfs) {
            Write-Host -NoNewline -ForegroundColor Yellow "  Volume $($volName) is accessible by CIFS"
        } elseif ($nfs -and !$cifs) {
            Write-Host -NoNewline -ForegroundColor Cyan "  Volume $($volName) is accessible by NFS"
        } else {
            Write-Host -NoNewline -ForegroundColor Red "  Volume $($volName) is junctioned, but has no export rules"
        }

        if ($share) {
            Write-Host -NoNewline -ForegroundColor Magenta " and has a CIFS share configured"
        }

        # add the newline
        Write-Host
    }
}&lt;/PRE&gt;&lt;P&gt;This would change a bit for 7-mode systems, but the principles are the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;</description>
    <pubDate>Thu, 26 Jan 2017 00:06:55 GMT</pubDate>
    <dc:creator>asulliva</dc:creator>
    <dc:date>2017-01-26T00:06:55Z</dc:date>
    <item>
      <title>Script needed - Which CIFS shares are also exported to Linux?</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/Script-needed-Which-CIFS-shares-are-also-exported-to-Linux/m-p/127353#M27597</link>
      <description>&lt;P&gt;We are in the process of upgrading a few hundred SVMs to VFilers to LDAP and part of the project I am being asked to gather a list for our Linux support group. They are wanting to gather a list of all CIFS share that ALSO are exported. I have beeing digging through things for a while and here is what I believe needs to be done.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Cluster Mode&lt;BR /&gt;&lt;BR /&gt;1) Gather All Namepsaces that do not have default export policy (will work for us as we never use default)&lt;/P&gt;&lt;P&gt;2) Gather list of all export policies&lt;/P&gt;&lt;P&gt;3) Gather list of all CIFS Shares&lt;BR /&gt;&lt;BR /&gt;This shouldn't be to bad, but will be time consuming because it is over about 100 Cluster/7 Mode HA Pairs.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, it is really working the data in Excel to determine overlaps.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BUT. We do have OCUM and DFM running, along with WFA so I can connect to the MySQL Database and cross reference also, but this is where I am getting lost.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just so that I am not re-creating the wheel here, does anyone have a script or MySQL select statement already made?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 16:09:24 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/Script-needed-Which-CIFS-shares-are-also-exported-to-Linux/m-p/127353#M27597</guid>
      <dc:creator>Livewire18</dc:creator>
      <dc:date>2025-06-04T16:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: Script needed - Which CIFS shares are also exported to Linux?</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/Script-needed-Which-CIFS-shares-are-also-exported-to-Linux/m-p/127355#M27598</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/27177"&gt;@Livewire18&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't help with an OCUM query, but getting the information using the PowerShell toolkit is relatively easy...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Get-NcVserver | ?{ $_.VserverType -eq "data" } | %{
    $svm = $_.Vserver

    Write-Host "SVM $($svm)"

    Get-NcVol -Vserver $svm | ?{ $_.JunctionPath -ne $null -and $_.VolumeExportAttributes.Policy -ne $null -and $_.VolumeStateAttributes.IsVserverRoot -eq $false } | %{
        $volName = $_.Name

        $share = $false

        Get-NcCifsShare -VserverContext $svm -Query @{ Path = "!/" } | %{
            if (($_.Path -split "/")[1] -eq $volName) {
                $share = $true
            }
        }
        
        $cifs = $false
        $nfs = $false

        Get-NcExportPolicy -Vserver $svm -Name $_.VolumeExportAttributes.Policy | Get-NcExportRule | %{
            if ($_.Protocol -contains "nfs" -or $_.Protocol -contains "any") {
                $nfs = $true
            }

            if ($_.Protocol -contains "cifs" -or $_.Protocol -contains "any") {
                $cifs = $true
            }
        }

        if ($cifs -and $nfs) {
            Write-Host -NoNewline -ForegroundColor Blue "  Volume $($volName) is accessible by CIFS and NFS"
        } elseif ($cifs -and !$nfs) {
            Write-Host -NoNewline -ForegroundColor Yellow "  Volume $($volName) is accessible by CIFS"
        } elseif ($nfs -and !$cifs) {
            Write-Host -NoNewline -ForegroundColor Cyan "  Volume $($volName) is accessible by NFS"
        } else {
            Write-Host -NoNewline -ForegroundColor Red "  Volume $($volName) is junctioned, but has no export rules"
        }

        if ($share) {
            Write-Host -NoNewline -ForegroundColor Magenta " and has a CIFS share configured"
        }

        # add the newline
        Write-Host
    }
}&lt;/PRE&gt;&lt;P&gt;This would change a bit for 7-mode systems, but the principles are the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2017 00:06:55 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/Script-needed-Which-CIFS-shares-are-also-exported-to-Linux/m-p/127355#M27598</guid>
      <dc:creator>asulliva</dc:creator>
      <dc:date>2017-01-26T00:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: Script needed - Which CIFS shares are also exported to Linux?</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/Script-needed-Which-CIFS-shares-are-also-exported-to-Linux/m-p/127377#M27601</link>
      <description>&lt;P&gt;Thanks, this gets me going in the right direction at least.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;There is only one concern though.&amp;nbsp;It does not look like this includes qtree exports. Is that correct?&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2017 13:21:25 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/Script-needed-Which-CIFS-shares-are-also-exported-to-Linux/m-p/127377#M27601</guid>
      <dc:creator>Livewire18</dc:creator>
      <dc:date>2017-01-26T13:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: Script needed - Which CIFS shares are also exported to Linux?</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/Script-needed-Which-CIFS-shares-are-also-exported-to-Linux/m-p/127386#M27604</link>
      <description>&lt;P&gt;Correct, I didn't include anything for qtrees...it only checks to see if the volume is junctioned and there is an export policy with cifs and/or nfs enabled.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2017 15:46:04 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/Script-needed-Which-CIFS-shares-are-also-exported-to-Linux/m-p/127386#M27604</guid>
      <dc:creator>asulliva</dc:creator>
      <dc:date>2017-01-26T15:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: Script needed - Which CIFS shares are also exported to Linux?</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/Script-needed-Which-CIFS-shares-are-also-exported-to-Linux/m-p/127436#M27611</link>
      <description>&lt;P&gt;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/8479"&gt;@asulliva&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;THANKS FOR &amp;nbsp;YOUR HELP!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's getting closer. I have made some changes and added some comments, but I am still lacking a bit. I cannot figure out hot to iterate throught the Namespace qtree's. Currently, it is only showing the volume level Namespaces which doesn't help much.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I am trying to gain.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) If Volume is Exported (but not to default or no_access Export Policies) then list the volume and all qtrees IF they are also CIFS&amp;nbsp;shares.&lt;/P&gt;&lt;P&gt;2) If the Volume is not exported (or is exported to default or no_access), but the qtree's are exported and shared CIFS then list just the qtree's.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I have 90% of it now (THANKS!) but I need the qtree namespaces to be included for a complete list.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;# run - Import-Module DataOntap
# run - Connect-NcController xxx.xxx.xxx.xxx or hostname


#Get all SVM's on a Cluster
Get-NcVserver | ?{ $_.VserverType -eq "data" } | %{
    $svm = $_.Vserver
    
    #Write-Host -ForegroundColor Red "`tSVM $($svm)"

    
    #Get all volumes from SVM
    Get-NcVol -Vserver $svm | ?{ $_.JunctionPath -ne $null -and $_.VolumeExportAttributes.Policy -ne $null -and $_.VolumeStateAttributes.IsVserverRoot -eq $false } | %{
        $volName = $_.Name
        $junctionpath = $_.JunctionPath

        $share = $false

            #Determine if any CIFS shares exist on Volume
            Get-NcCifsShare -VserverContext $svm -Query @{ Path = "!/" } | %{
            
                if (($_.Path -split "/")[1] -eq $volName) {
                   
                    $share = $true
                    }
            }
        
            $nfs_and_cifs = $false

            #Check Export Policy for volume
            Get-NcExportPolicy -Vserver $svm -Name $_.VolumeExportAttributes.Policy | Get-NcExportRule | %{
        
                #If export policy is Default or No_Access, ignore it
                if ($_.PolicyName -ne "default" -and $_.PolicyName -ne "no_access") {
                
                    if (($_.Protocol -contains "nfs" -and "cifs")-or $_.Protocol -contains "any") {
                        $nfs_and_cifs = $true
                    }
                }
            }
        
            Write-Progress -Activity "Scanning Volume $volName"
        
            #Check if accessible by CIFS and NFS and is a share       
            if (($nfs_and_cifs) -and ($share)){
                Write-Host -ForegroundColor Green "`t`t$($svm):$junctionpath `t(Volume $volName)"
                Get-NcCifsShare -VserverContext $svm -Query @{ Path = "!/" } | %{
            
                if (($_.Path -split "/")[1] -eq $volName) {
                    write-host "`t`t`t`t$($svm):$($_.Path)"
                }
         }
        } 


        
    }
}&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Jan 2017 13:56:07 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/Script-needed-Which-CIFS-shares-are-also-exported-to-Linux/m-p/127436#M27611</guid>
      <dc:creator>Livewire18</dc:creator>
      <dc:date>2017-01-27T13:56:07Z</dc:date>
    </item>
  </channel>
</rss>

