Data ONTAP Discussions

Highlighted

Unable to connect to filer due to incorrect credentials for server. have only windowaccess to shares

param([string]$paNetAppHost, [string]$pausername)

Import-module DataOnTap

$PathtoCSV = "C:\NetappTotalVolume.csv"

#Connect to filer

Connect-NAController $pafileshare –cred $pausername

$allvolumesnames = get-navol | Select-Object Name,Available

#set headers of CSV file

"VolumeName,Available Space(GB),Used Space(GB),Total Volume Space(GB)" > $PathtoCSV

foreach ($netapp_vol in $allvolumesnames) {

$CurrentVolname = $netapp_vol.name

$VolumesAvailable = $netapp_vol.available

$VolumeSizeTotal = get-navolsize -name $CurrentVolname | Select-Object -ExpandProperty VolumeSize

#Convert to GB

$VolumeAvailable1GB = ($VolumesAvailable / 1GB)

$VolumeSizeTotal1GB = ($VolumeSizeTotal / 1GB)

#Calc usedspace

$VolumeUsedSpace1GB = $VolumeSizeTotal1GB - $VolumeAvailable1GB

#Create/add to CSV file

$Combine = $CurrentVolname,$VolumeAvailable1GB,$VolumeUsedSpace1GB,$VolumeSizeTotal1GB

$Combine -join "," >> $PathtoCSV

}

4 REPLIES 4

Re: Unable to connect to filer due to incorrect credentials for server. have only windowaccess to sh

we don't have admin access to file server. we just only map the shares. so. iwould like to get the volume of each folder under the file share. 

Thanks in Advance

Re: Unable to connect to filer due to incorrect credentials for server. have only windowaccess to sh

Hi

 

sorry, the question is not clear. can you add any error message or example for the result you want to achieve?

 

Gidi

Re: Unable to connect to filer due to incorrect credentials for server. have only windowaccess to sh

The following error I am getting after running the above code. 

we only have windows access to file shares not admin access to file shares.

 

Thanks in advance


Connect-NaController : Incorrect credentials for usalbfs33-181.am.health.ge.com.
At line:9 char:1
+ Connect-NaController usalbfs33-181.am.health.ge.com –cred $pausername
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidResult: (usalbfs33-181.am.health.ge.com:NaController) [Con
nect-NaController], NaAuthException
+ FullyQualifiedErrorId : HttpConnectionFailed,DataONTAP.PowerShell.SDK.ConnectNaController

get-navol : Value in $global:CurrentNaController is not of type NetApp.Ontapi.Filer.NaController
At line:11 char:20
+ $allvolumesnames = get-navol | Select-Object Name,Available
+ ~~~~~~~~~
+ CategoryInfo : InvalidArgument: (Smiley Happy [Get-NaVol], ArgumentException
+ FullyQualifiedErrorId : ControllerNotSpecified,DataONTAP.PowerShell.SDK.Cmdlets.Volume.Ge
tNaVol

out-file : Access to the path 'C:\NetappTotalVolume.csv' is denied.
At line:15 char:1
+ "VolumeName,Available Space(GB),Used Space(GB),Total Volume Space(GB) ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (Smiley Happy [Out-File], UnauthorizedAccessException
+ FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand

Re: Unable to connect to filer due to incorrect credentials for server. have only windowaccess to sh

You will need access to the system that's running these CIFS shares,  readonly should be enough.   This PS is designed to run netapp ONTAP commands to gather data and output to a CSV.      Volumes to shares don't always have a 1 to 1 ratio either.   There are times when you can have 20 shares off various qtrees map all within a single volume.   

 

Forums