Hi All,
I am adding ip to my network adapter(secondary) of a VM by the following powershell in SCVMM 2012 R2,
#set ip address to virtual network adapter
Grant-SCIPAddress -StaticIPAddressPool $pool -GrantToObjectType VirtualNetworkAdapter -GrantToObjectID $nic2 -Description $VM.Name -JobVariable $JobGroupID -ErrorAction Stop
|Out-Null
When I get it via following powershell, I am able to get the IP address.
$VM=Get-SCVirtualMachine -Name 'mNIC2'
foreach($VMNic in $VM.VirtualNetworkAdapters)
{
Write-Host '********Loop through virtualNetworkAdapters**************'
Write-Host $VMNic.Name
$VMNicID=$VMNic.ID
$VMIPAddress = Get-SCIPAddress -EA stop | where {$_.AssignedToID -eq "$VMNicID"}
if($VMIPAddress)
{
Write-Host $VMIPAddress.Address
}
if($VMIPAddress -eq '')
{
Write-Host 'IP address is blank'
}
}
However, when I connect to VM via SCVMM-->Connect via console, I see that in the virtual machine network adapter has no ip address assigned for IPV4. Also, no subnet mask, default gateway and prefered dns set.
Help appreciated.
Thanks,
Mohak