How can a mandatory parameter be obsolete?
Which PowerCLI version are you running ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Latest 6.0. R3.
Just checked again, and the warning is not saying that the VM parameter will become obsolete.
It says that passing multiple values to this parameter will become obsolete.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I have seen that one too, but I get this warning when I only pass it one VM:
PS C:\> $vm=get-vm "ThereCanBeOnlyOne"
PS C:\> New-HardDisk -vm $vm -CapacityGB 1
WARNING: Parameter 'VM' is obsolete. Passing multiple values to this parameter is obsolete.
There are other cases where a mandatory parameter is flagged as obsolete. I also see it on -entity when setting advanced config variables on a VM.
PS C:\> New-AdvancedSetting -Entity $vm -Name disk.EnableUUID -value "TRUE" -confirm:$False
WARNING: Parameter 'Entity' is obsolete. This parameter no longer accepts multiple values.
I only get the warning when I actually pass more than one value on the parameters involved (for New-Harddisk and New-AdvancedSetting).
Are you sure there is only one VM in the variable $vm ?
But again, I get a slightly different warning.
WARNING: Passing multiple values to the 'Entity' parameter of 'New-AdvancedSetting' cmdlet is obsolete. The parameter will accept o
nly a single object in future.
Which PowerShell version are you using ?
I just tested under PS v3 and v4, same result.
Both with PowerCLI 6R3
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi
I get the exact same error for the Address and IScsiHba parameter, whenever I run New-IScsiHbaTarget. But only when I manage ESXi 5.5 hosts using PowerCli 6.0. If I manage these hosts using PowerCli 5.5 everything works as expected. Furthermore, if I manage ESXi 5.5 hosts attached to a vCenter 6, and directs the New-IScsiHbaTarget command to the vCenter everything works fine as well.
So to me, this looks like an incompatibility problem with PowerCli 6 towards old hosts.
My only problem: I don't have the time to report this to VMware. :smileyblush:
I also receive this when I specify a single VM as shown below. I am using a module version of VMware.VimAutomation.Core 6.0.0.0 and target VM is hosted on a vSphere 6 environment.
Example
PS C:\Windows> New-HardDisk -VM TSTSVR208 -CapacityGB 10 -StorageFormat Thin
WARNING: Parameter 'VM' is obsolete. Passing multiple values to this parameter is obsolete.
CapacityGB Persistence Filename
---------- ----------- --------
10.000 Persistent ...LUN10] TSTSVR208/TSTSVR208_2.vmdk
More info
PS C:\Windows> $PSVersionTable
Name Value
---- -----
PSVersion 5.0.10586.122
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.10586.122
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
The problem isn't annoying enough to raise a support call so lets hope it gets resolved in future releases.
Rob Longdon.
Just out of curiousity, what happens if you just pipeline to the New-HardDisk:
$vm | New-HardDisk -CapacityGB 1
This warning is not there because you specified multiple values on the VM parameter, but has to do with the value in your $WarningPreference value.
See about_Preference_Variables
And I don't think this will get fixed, it's a design decision that was taken.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I'm having this problem too with New-AdvancedSetting and I'm certain my Entity object is a single VM.
$vmobj.count
1
$vmobj.gettype()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False UniversalVirtualMachineImpl VMware.VimAutomation.ViCore.Impl.V1.Inventory....
$vmobj.name
<vmname shown>
Refreshing the object to make sure it's just one.
$vmobj = get-vm $vmobj.name
Yes it's still one
$vmobj.count
1
$vmobj.gettype()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False UniversalVirtualMachineImpl VMware.VimAutomation.ViCore.Impl.V1.Inventory....
New-AdvancedSetting -Entity $vmobj -Name "bios.bootdeviceclasses" -Value "allow:net,cd" -Confirm:$false -Force
Parameter 'Entity' is obsolete. This parameter no longer accepts multiple values.
Results are the same whether I pass it with -Entity or pipeline.
Like I tried to explain in my previous reply, this is a warning, not an error.
Did you check the setting afterwards?
It should contain the value you set.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes, the command does work, I forgot to mention that in the post. My concern wasn't about the command itself but more over the warning. While I agree it is just a warning that can be ignored and hidden, I feel that it should only be displayed when you actually do pass multiple values.
I see your point, but I'm afraid the warning mechanism doesn't go that far.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD, I guess I'm not clear on the reason for the warning. It's saying two things - don't use the VM parameter and don't pass in multiple values for the VM parameter. That would indicate that this parameter is being replaced by something else. If so, then what? If not, then there shouldn't be a warning. Please clarify. Thanks.
I'll give it one more try.
The warning says that the possibility to specify multiple values (an array) on the VM parameter is deprecated.
That option, specifying multiple values on the VM parameter, will ultimately go away.
And no, there is no other cmdlet, the New-HardDisk cmdlet will stay, just the option to specify an array on the VM parameter will ultimately go away.
Also note that this a warning, this doesn't mean that you actually specified an array on the VM parameter.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference