Microsoft Virtualization Discussions

Problems with Get-NcVol using variables

jmoss

I'm having a problem and I don't understand why it's not working and I'm now wondering if I'm running into some kind of bug and was looking for some suggestions.  If I try the following:-

 

Get-NcVol -VServer ams4-lb8020svm-01 -Name vol_ams4_lbucs_10
or 
$volName = "vol_ams4_lbucs_10"
Get-NcVol -VServer ams4-lb8020svm-01 -Name $volName
 
Both of these works, however if I use the following it doesn't return anything even though the variable is still of a type string:-
 
$volName = ($Datastores.VolumeName).ToString()
Get-NcVol -VServer ams4-lb8020svm-01 -Name $volName
 
Output of variable details:-
PS D:\Development\$volName
vol_lhr4_lbucs_01 
 
PS D:\Development\$volname.GetType().Name
String
 
Anyone have any ideas?
 
 
1 REPLY 1

donny_lang

What version of the PSTK are you using? I am running 9.7.1.1 and it seems to work for me using the code from your examples. Are you able to duplicate the issue on another machine? Another thing that came to mind was case-sensitivity - is it possible that the volume name contains upper case letters in ONTAP but not in the variable?

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public