Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi guys,
I started playing with powershell this week - I've tried to run the following but getting this:
"the size of the volume is DataONTAP.Types.Volume.SizeInfo"
the script is:
Import-Module dataontap
$filername = Read-Host 'What is the filer hostname?'
$name = Read-Host 'What is your username?'
Connect-NaController -Name $filername -Credential $name
$volname = Read-Host 'What is the volume name?'
$volsize = Get-NaVolSize -Name $volname
Write-Host "the size of the volume is:" $volsize
my debugger is saying that my problem is in this line:
$volsize = Get-NaVolSize -Name $volname
Thank you
Solved! See The Solution
1 ACCEPTED SOLUTION
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am late to the discussion, but this is working for me:
Import-Module dataontap
$filername = Read-Host 'What is the filer hostname?'
$name = Read-Host 'What is your username?'
Connect-NaController -Name $filername -Credential $name
$volname = Read-Host 'What is the volume name?'
$volsize = Get-NaVolSize -Name $volname
Write-Host "the size of the volume is:" ($volsize).volumesize
What is the error that the debugger is throwing out?
-Scott
32 REPLIES 32
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Vinith, that looks awesome! I'll try that later
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
In the below scriptlet you are connecting to the controller only with username, you are not entering the password
$name = Read-Host 'What is your username?'
Connect-NaController -Name $filername -Credential $name
Try with the below method
$name = Read-Host 'What is your username?'
$password = Read-Host 'What is your Password?'
$ControllerPassword = ConvertTo-SecureString -String $password -AsPlainText -force
$credential = New-Object System.Management.Automation.PsCredential($name,$ControllerPassword)
Connect-NaController -Name $filername -Credential $credential
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
this line (Connect-NaController -Name $filername -Credential $name) brings up a popup that asks for a password. I insert the password and the script moves on
Again, my debugger is pointing to this line:
$volsize = Get-NaVolSize -Name $volname
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
what are you giving as input to $volume, can you share an example?
Here's the output when i ran your set of cmdlets.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've tried with a volume I created, called vol7 and also with vol0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Joel -
Do a quick search for a blog post i submitted that will dump out all the filers and volumes sizes etc... You can re-use the code for your liking.
I see from your flurry of posts that you are just getting going on PS which is great. Start with the getting started powerpoint presentation as well.
Also, i'm noticing you are starting everything with import-module. I believe in powershell 3.0 all modules are loaded. you can check that by launching powershell and typing get-module
If you are using 2.x you need to add import-module dataontap to your profile.ps1 file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here, give this a shot
get-navol vol0 | get-navolsize | select @{E={convertto-formattednumber $_.volumesize datasize "0.00"};N="Vol size"}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
sweet!
came out nice
so what does the 'E=' and 'N=' do?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do a man on Select-object, It will show you. It's Expression and Name
Actually, you can also do this.
[ValidateRange(1024,1125899906842624)]
[Int64]$Unit=1GB
$v = get-navol vol0 | get-navolsize
$v.volumesize/$unit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
so is it similar to this:
C:\PS>get-process | select-object -property ProcessName,@{Name="Start Day"; Expression = {$_.StartTime.DayOfWeek}}
E --> Expression
N --> Name
?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
...and here is a good link:
