Quantcast
Channel: Microsoft System Center Virtual Machine Manager
Viewing all articles
Browse latest Browse all 504

VMM 2012 Tip: How to assign an IP Address using PowerShell during deployment

$
0
0

GrayAndYellowGearsHi everyone, Yuvraj Attarde here and today I ‘d like to pass along a trip on how to easily assign an IP address using PowerShell during deployments in System Center 2012 Virtual Machine Manager. Let’s say for example that you have the requirement to assign an IP address specified as a PowerShell parameter during VM deployment. You could use the cmdlets Grant-SCIpaddress and Set-SCIPAddress to assign the IP address from the IP Pool to the VM, the only problem is that the IP address doesn’t automatically get activated on the VM.  A better alternative is to assign the IP address using the Get-SCVirtualNetworkAdapterConfiguration and Set-SCVirtualNetworkAdapterConfiguration cmdlets and I have an example of this below:

NOTE: Replace the VMtemplate and Testvm3 with the appropriate template and VM names respectively.

#Get lab HostGroup
$HostGroup =Get-VMHostGroup
# Setup Vm Template from lab library
$Template= Get-SCVMTemplate | Where-Object {$_.Name -like "VMtemplate"}
# Build Vm Configuration
$VMConfig = New-SCVMConfiguration -VMHostGroup $HostGroup -VMTemplate $Template -Name VMConfig01
Update-SCVMConfiguration -VMConfiguration $VMConfig
$VNAConfig = Get-SCVirtualNetworkAdapterConfiguration -VMConfiguration $VMConfig
Set-SCVirtualNetworkAdapterConfiguration -VirtualNetworkAdapterConfiguration $VNAConfig -IPv4Address "10.0.0.4"
#submits new VM job to VMM
New-SCVirtualMachine -Name testvm3 -VMConfiguration $VMConfig

You can find more information on Set-SCVirtualNetworkAdapterConfiguration here: http://technet.microsoft.com/en-us/library/hh801707.aspx

Yuvraj Attarde | Senior Support Escalation Engineer | Microsoft CTS Management and Security Division

Get the latest System Center news onFacebookandTwitter:

clip_image001clip_image002

System Center All Up: http://blogs.technet.com/b/systemcenter/
System Center – Configuration Manager Support Team blog: http://blogs.technet.com/configurationmgr/
System Center – Data Protection Manager Team blog: http://blogs.technet.com/dpm/
System Center – Orchestrator Support Team blog: http://blogs.technet.com/b/orchestrator/
System Center – Operations Manager Team blog: http://blogs.technet.com/momteam/
System Center – Service Manager Team blog: http://blogs.technet.com/b/servicemanager
System Center – Virtual Machine Manager Team blog: http://blogs.technet.com/scvmm

Windows Intune: http://blogs.technet.com/b/windowsintune/
WSUS Support Team blog: http://blogs.technet.com/sus/
The AD RMS blog: http://blogs.technet.com/b/rmssupp/

App-V Team blog: http://blogs.technet.com/appv/
MED-V Team blog: http://blogs.technet.com/medv/
Server App-V Team blog: http://blogs.technet.com/b/serverappv

The Forefront Endpoint Protection blog : http://blogs.technet.com/b/clientsecurity/
The Forefront Identity Manager blog : http://blogs.msdn.com/b/ms-identity-support/
The Forefront TMG blog: http://blogs.technet.com/b/isablog/
The Forefront UAG blog: http://blogs.technet.com/b/edgeaccessblog/


Viewing all articles
Browse latest Browse all 504

Trending Articles



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