Solved

How to use New-SCVirtualNetworkAdapter cmdlet to set a static IP address

Posted on 2014-09-04
2
1,479 Views
Last Modified: 2014-09-05
Using Hyper-V on 2012R2.

When using New-SCVirtualNetworkAdapter to create a NIC with an static IP address and using the -HardwareProfile option, I assume the IP address is automatically assigned from the static IP pool when the template using the hardware profile is deployed(seems like it, since that seems to work without me specifying an address). But when I am not assigning a new NIC to a hardware profile but to an existing VM that is turned off, it on the other hand does not seem to receive a static IP. The NIC shows up in VMM as for use with static IP, but no IP is assigned.

The code I am using goes like this:

$VMNetwork = Get-SCVMNetwork -VMMServer vmmServerFQDN -Name "VLAN 110 Network" 
$VMSubnet = Get-SCVMSubnet -VMMServer vmmServerFQDN -Name "VLAN 110 Network_Subnet" 

New-SCVirtualNetworkAdapter -VM "VMNameHere" -MACAddress "00:00:00:00:00:00" -MACAddressType Static -Synthetic -EnableVMNetworkOptimization $false -EnableMACAddressSpoofing $false -EnableGuestIPNetworkVirtualizationUpdates $false -IPv4AddressType Static -IPv6AddressType Dynamic -VMSubnet $VMSubnet -VMNetwork $VMNetwork

Open in new window

0
Comment
Question by:itnifl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 40303702
Try with Set-SCVirtualNetworkAdapter
$Adapter = Get-SCVirtualNetworkAdapter -VM "VMNameHere"
Set-SCVirtualNetworkAdapter -IPv4AddressType Static -VirtualNetworkAdapter $Adapter -IPv4Addresses "IPv4Address here"

Open in new window


http://technet.microsoft.com/en-us/library/hh801488.aspx
0
 
LVL 2

Author Closing Comment

by:itnifl
ID: 40305500
Yes, works nice.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Deduplication setup for Veeam Backup repository best practice ? 15 72
DFSRPrivate folder missing 2 20
Extension Change 2 30
TDE for SQL Web Edition 1 42
A procedure for exporting installed hotfix details of remote computers using powershell
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of installing of Data Protection Manager on a server running Windows Server 2012 R2, including the prerequisites. Microsoft .Net 3.5 is required. To install this feature, go to Server Manager…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question