I was at my local Salt Lake City VMware User Group (VMUG) last week doing a Q&A when one of the users mentioned it is painful to only be able to upload one Sysprep file at a time to vCenter. I wanted to take the time to address this for him as well as any of you who may have the same issue.
Problem: uploading Sysprep files to vCenter only allows for one file upload at a time. Continue reading
Following our last video where showed you how to get started with PowerCLI we wanted to take it further and address the next most common use of PowerCLI, after you have connected to your infrastructure people generally want to start learning how PowerCLI works. They are aware of how powerful PowerCLI is so are a little bit afraid that they may cause problems if they don’t know how to harness this power in the correct way.
A natural place for people to start gaining familiarity and confidence with PowerCLI is reporting, after all if you are just retrieving information from your infrastructure you can not automate anything hazardous. This is a great starting point and you will soon gain confidence and become familiar with PowerCLI, PowerShell, the way the command line works and the power that is available to you.
To help get you started with the reporting side of PowerCLI we have recorded a quick video to springboard you into this power, please enjoy the below video and let us know what you would like to see next in the comments of this blog post.
PowerCLI has several cmdlets at your disposal for managing OS Customization Specifications. In our first post we showed you how to create new customization specifications, retrieve and change them, in our second post we covered a common use case, being able to work with network interface card mappings and now in this final post we will show you how to clone a customization specification and give you an end-to-end scenario showing you how to use it in a script.
Cloning customization specifications
PowerCLI also gives you the ability to clone a customization specification (which creates an identical copy). You can clone both persistent and non-persistent specifications. Cloning is useful when you want to duplicate your customization specifications across multiple vCenter Servers. Let’s say you are connected to 2 servers – “vc1” and “vc2” and you want to copy all your customization specifications from “vc1” to “vc2”. Here is how to do that:
Get-OSCustomizationSpec –Type Persistent –Server vc1 | New-OSCustomizationSpec –Server vc2 –Type Persistent
You can also clone a customization specification as a non-persistent one. This is useful when you will be applying this specification to multiple VMs and will need to change the NIC mappings for each VM. Here is how to create a non-persistent clone of a customization specification:
$clone = Get-OSCustomizationSpec –Name BasicWindowsSpec | New-OSCustomizationSpec –Type NonPersistent
PowerCLI has several cmdlets at your disposal for managing OS Customization Specifications. In the previous post we showed you how to create new customization specifications, retrieve and change them, in this post we will cover a common use case, being able to work with network interface card mappings.
Managing network interface card (NIC) mappings
One of the common things to use the customization specifications for is to configure the VM’s network adapters (e.g. static IP, DHCP, etc.). The part of the customization specification that handles the network adapters is the OSCustomizationNicMapping. Each OSCustomizationSpec can have zero or more OSCustomizationNicMappings associated with it – and each of them corresponds to a network adapter of the VM. In order for a customization to succeed – you need to have as many OSCustomizationNicMappings as the number of network adapters on the VM you are customizing. You will see an example for this later on.
PowerCLI offers 4 cmdlets for managing the NIC mappings of a customization specification – these are Get-, Set-, New- and Remove-OSCustomizationNicMapping. Creating a new OSCustomizationNicMapping is done through New-OSCustomizationNicMapping cmdlet. Since the NIC mapping is part of a customization specification – when creating one you need to specify the customization specification to which you want to add the new NIC mapping. This is done through the “-OSCustomizationSpec” parameter. With a single OSCustomizationNicMapping you can configure a network adapter to either use DHCP or static IP.