Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 207710

cannot get this working..

$
0
0
$VMHostProfile = Get-VMHostProfile -Entity *         
$Cluster = Get-Cluster -Name "cluster"
$array = @()
Import-Csv "C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\scripts\Autodeploy.csv" -UseCulture | %{
$additionalConfiguration = @{
'network.dvsHostNic["key-vim-profile-host-DvsHostVnicProfile-dvS-RW-TESTMGMT-dvPG-RW-MGMT-management"].ipConfig.IpAddressPolicy.address' = $_.mgmt_ip
'network.dvsHostNic["key-vim-profile-host-DvsHostVnicProfile-dvS-RW-TESTMGMT-dvPG-RW-MGMT-management"].ipConfig.IpAddressPolicy.subnetmask' = $_.mgmt_sm
'network.dvsHostNic["key-vim-profile-host-DvsHostVnicProfile-dvS-RW-TestVmotion-dvPG-RW-testvmotion-vmotion"].ipConfig.IpAddressPolicy.address' = $_.vmotion_ip
'network.dvsHostNic["key-vim-profile-host-DvsHostVnicProfile-dvS-RW-TestVmotion-dvPG-RW-testvmotion-vmotion"].ipConfig.IpAddressPolicy.subnetmask' = $_.vmotion_sm
'network.dnsConfig.HostNamePolicy.hostName' = $_.Name
}
Apply-VMHostProfile -ApplyOnly -Profile $VMHostProfile -Entity $_.dhcpip -Variable $additionalConfiguration -Confirm:$false -RunAsync
$array += $_.mgmt_ip
}
Start-Sleep 60
Get-VMHost -Name $array | Set-VMHost -State Disconnected -RunAsync | Remove-VMHost -Confirm:$false
It works all the way up to start-sleep 60 but
get-vmhost gives this error
Remove-VMHost : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not m
atch any of the parameters that take pipeline input.
At C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\apply_host_profile.ps1:19 char:86
+ Get-VMHost -Name $allLines | Set-VMHost -State Disconnected -RunAsync | Remove-VMHost <<<<  -Confirm:$false
    + CategoryInfo          : InvalidArgument: (VMware.VimAutom...entSideTaskImpl:PSObject) [Remove-VMHost], ParameterBindingException
    + FullyQualifiedErrorId : InputObjectNotBound,VMware.VimAutomation.ViCore.Cmdlets.Commands.RemoveVMHost
is there something wrong with the array?

Viewing all articles
Browse latest Browse all 207710

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>