-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
In my Project i ran Get-Help New-nbVirtualMachine -Full to see how i create a VirtualMachine Object
Example says:
PS C:\>$lookup = @{
device_type='dcim/device-types'
device_role='dcim/device-roles'
site='organization/sites'
status='dcim/_choices'
}
$VirtualMachine = @{
name = 'example'
serial = 'aka123457'
device_type = 'dl380-g9'
device_role = 'oracle'
site = 'chicago'
status = 'active'
}
New-nbVirtualMachine -lookup $lookup -object $VirtualMachine
So i did. I created a HashTable describing my virtual Machine and got errors back.
After reviewing your code i saw that it expects a PowershellObject and NOT a HashTable.
So i ended up with something like this to get it work:
$nbVMCluster=Get-nbCluster -Query @{name=($o_vm | Get-Cluster).Name}
$nbVMObject= New-Object -Type PSObject -Property @{
name=$o_vm.Name
status="active"
site=($o_vm | Get-Datacenter).Name
cluster=$nbVMCluster.id
role=(Get-nbRole -Query @{name="Server"}).id
vcpus=$o_vm.NumCpu
memory=$o_vm.MemoryMB
disk=[int]$o_vm.ProvisionedSpaceGB
}
$nbVM=New-nbVirtualMachine -Object $nbVMObject
I think documentation should be edited here to avoiid misleading Cmdlet Users
Metadata
Metadata
Assignees
Labels
No labels