Quantcast
Channel: Virtual Machine Manager – General forum
Viewing all articles
Browse latest Browse all 2770

Unable to assign IP address in VM NICs

$
0
0

Hi All,

I am using the following scvmm 2012 r2 powershell commands to assign IP addresses to VM NICs. 

$UpdatedTemplate = Get-SCVMTemplate -VMMServer $SCVMMServer -All | Where-Object { $_.Name -eq $TemporaryTemplateID } -ErrorAction Stop

$virtualMachineConfiguration = New-SCVMConfiguration -VMTemplate $UpdatedTemplate -Name $VMName -ErrorAction Stop

Set-SCVMConfiguration -VMConfiguration $virtualMachineConfiguration -Cloud $SCCloud -ComputerName $osComputerName -ErrorAction Stop

$NICconfigurations = Get-SCVirtualNetworkAdapterConfiguration -VMMServer $SCVMMServer -VMConfiguration $virtualMachineConfiguration -ErrorAction Stop

       $k=0
         foreach($keyVlan in $dicIPPools.Keys)
         {
            if($k -le $NICconfigurations.Count-1)
            {
                 $nicConfig1=$NICconfigurations[$k]
                 $arg = 'Executing command: Set-SCVirtualNetworkAdapterConfiguration -VirtualNetworkAdapterConfiguration "' + $nicConfig1 + '" -IPv4AddressPool "' + $dicIPPools[$keyVlan]+ '" -ErrorAction Stop'
                 WriteToLogFile('DEBUG') ($arg)
                 $SetSCVitNW =  Set-SCVirtualNetworkAdapterConfiguration -VirtualNetworkAdapterConfiguration $nicConfig1 -IPv4AddressPool $dicIPPools[$keyVlan] -ErrorAction Stop
                 $k++
            }
        }

In my development setup this is running fine. However the same is not working on our QA setup. There, I saw that $NICconfigurations is null.

Any help?

Thanks  in advance.
Mohak Mahato


Viewing all articles
Browse latest Browse all 2770

Trending Articles



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