VirtualMachineManager: set ipv4address and DNS Settings

hi

How can I define an ipv4address and the DNS Settings?

$template = Get-SCVMTemplate -All | where { $_.Name -eq "$TemplateName" }
$virtualMachineConfiguration = New-SCVMConfiguration -VMTemplate $template -Name "$ServerName"
Write-Output $virtualMachineConfiguration
$vmHost = Get-SCVMHost -ID "a86731ad-50e6-4e61-b7e5-263157b940b6"
Set-SCVMConfiguration -VMConfiguration $virtualMachineConfiguration -VMHost $vmHost
Update-SCVMConfiguration -VMConfiguration $virtualMachineConfiguration
Set-SCVMConfiguration -VMConfiguration $virtualMachineConfiguration -VMLocation $VMLocPath -PinVMLocation $true

$AllNICConfigurations = Get-SCVirtualNetworkAdapterConfiguration -VMConfiguration $virtualMachineConfiguration
$AllNICConfigurations | Set-SCVirtualNetworkAdapterConfiguration -IPv4PAAddress $IPAddress

many thanks

Miller


July 14th, 2015 10:18am

YOu should post this to the SCVMM forum as it is specific.

Don't you want to add a NIC before you try to give it an address?

https://technet.microsoft.com/en-us/library/hh801597.aspx?f=255&MSPPError=-2147217396

Free Windows Admin Tool Kit Click here and download it now
July 14th, 2015 10:58am

Hi Miller,

To assign IPv4address, you can just run the cmdlet like below:

$VNAConfig = Get-SCVirtualNetworkAdapterConfiguration -VMConfiguration $VMConfig 
Set-SCVirtualNetworkAdapterConfiguration -VirtualNetworkAdapterConfiguration $VNAConfig -IPv4Address "10.0.0.4" 

I haven't found a good way to set DNS setting when deploy VM in SCVMM, there are only IP address and MAC address setting etc available.

I also recommend you can use IP address pool in VMM to assign the Network related setting automatically.

In addition, if you want to change the DNS setting of vm in powershell, you can also refer to powershell remoting to manage vm from host as a workaround.

As Jrv suggested, please post in VMM forum for more efficient support:

https://social.technet.microsoft.com/Forums/en-US/home?category=virtualmachinemanager

Best Regards,

Anna Wang

July 15th, 2015 5:20am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics