Microsoft Virtualization Discussions

Problems with Get-NcVol using variables

jmoss
1,569 Views

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
1,487 Views

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?

Public