PS: Windows Server Build PowerCLI Posted byrajwansh02003August 15, 2016Posted inUncategorized ################################################################################################### #List of Variables:NameScript, OSType, FullName, OrgName, ChangeSid, Type, DnsServer, DnsSuffix, # # TimeZone, GuiRunOnce, NamingScheme, NamingPrefix, ProductKey, Description, # # IpMode, IpAddress,SubnetMask, DefaultGateway, AlternateGateway, Dns, Template, # # EsxHost, Datastore, NumCpu,MemoryMB, NetworkName # ################################################################################################### #load PowerCLI snap-in Add-PSSnapin VMware.VimAutomation.Core #Connect the vCenter Connect-VIServer -Server <IP Address> -User <UserName> -Password <Password> #Import the file. Please select the Path Import-Csv <File Path of the Source CSV> | foreach { #New-OSCustomizationSpec Creation of new OS Customization spec New-OSCustomizationSpec -Name $_.NameScript -OSType $_.OSType -Description “$_.Description” -NamingScheme $_.NamingScheme -NamingPrefix $_.NamingPrefix -FullName $_.FullName -OrgName $_.OrgName -ChangeSid -Type $_.type -DnsServer $_.DnsServer -DnsSuffix $_.DnsSuffix -TimeZone $_.TimeZone -Workgroup “Workgroup” -AdminPassword “<Password for Admin>” Get-OSCustomizationSpec $_.NameScript | Get-OSCustomizationNicMapping | Set-OSCustomizationNicMapping -IpMode UseStaticIP -IpAddress $_.IPAddress -SubnetMask $_.SubnetMask -DefaultGateway $_.DefaultGateway -Dns $_.Dns -AlternateGateway $_.AlternateGateway New-VM -Name $_.NamingPrefix -Template $_.Template -VMHost $_.EsxHost -Datastore $_.Datastore -OSCustomizationSpec $_.NameScript -Confirm:$false -Location “<Folder Name>” } Share this: Click to share on X (Opens in new window) X Click to share on Facebook (Opens in new window) Facebook Like Loading... Related