PoshCode Archive  Artifact [033de0cb0f]

Artifact 033de0cb0fc2e9801ee5d0d95d3615dce951744e2a2f5a86c127971ecb0ca6d9:

  • File Deploying-VM-with-static.ps1 — part of check-in [519d09f6d4] at 2018-06-10 13:03:58 on branch trunk — Deploying VM with static IP in 3 lines (user: unknown size: 819)

# encoding: ascii
# api: powershell
# title: Deploying VM with static
# description: Deploying VM with static IP in 3 lines
# version: 0.1
# license: CC0
# x-poshcode-id: 2004
# x-archived: 2010-07-23T17:50:17
#
#
# 1. Create a simple customizations spec
$custSpec = New-OSCustomizationSpec -Type NonPersistent -OSType Windows -OrgName TestOrgName -FullName TestFullName -Workgroup TestWorkgroup
# 2. Modify the default network customization settings
$custSpec | Get-OSCustomizationNicMapping | Set-OSCustomizationNicMapping -IpMode UseStaticIP -IpAddress 10.23.121.228 -SubnetMask 255.255.248.0 -Dns 10.23.108.1 -DefaultGateway 10.23.108.1
# 3. Deploy a VM from template using the newly created customization
New-VM -Name MyDeployedVM -Template $template -VMHost $vmHost -OSCustomizationSpec $custSpec