i need to get the number of vCPUs on a VM and then cast the value into an integer data type.
$cpus = [int]( get-vm sqlvm1 | select NumCPU)
However it is telling me it can’t convert the data type of NumCPU to an int.
any ideas?
Can't convert because you're still pulling an object-type with the select. Try like this:
$cpus = (Get-VM sqlvm1).NumCPU
Can't convert because you're still pulling an object-type with the select. Try like this:
$cpus = (Get-VM sqlvm1).NumCPU
Thanks!