As part of a larger project I've been working on a set of scripts which configure a freshly-installed ESX (or ESXi) system into Virtual Center (after first attempting to remove previous VC state and clean state from the host). Currently they follow a typical post-boot configuration pattern:
Set ESX password
Add to Virtual Center cluster
Configure Virtual Switches
Configure Port Groups
Add NFS partitions
Add iSCSI partitions
Configure NTP
Configure VMotion
Before trying, modify esx-master.ps1 and esx-profile.ps1 to local conditions (or your password will be set to "CHANGEME").
Command: esx-autoconfigure.ps1 "hostname|ip-address"
As this is my initial foray into PowerShell, please excuse any idiosyncracies.
This is a work-in-progress - feedback welcome. Points awarded for the best suggestions in the next few days.
lance
I'd love to but unfortunately the process at my current employer requires manucal verification of the input parameters for auditing purposes.
I like how you're thinking though!
Exactly, SC!
We're mainly LInux on our VM side so I already have the entire infrastructure setup for kickstarts already. And your point regarding ESXi is spot on.
So when will VMware include a PS configuration script configurator similar to the kickstart configurator?
The DHCP is just to get the thing started. I agree you want to verify the inputs for auditing purposes and use static addresses
If you do have a PS provisioning script, you can pipe the string outputs of the script to a log file using Tee-Object. This can then be your installation record. Also fairly easy to maintain a data store (e.g., CSV file, SQL table) of configuration inputs if you want to retrieve settings from a separate source.
My ESX provisioning example at NAEPS is fairly hands free and fairly complete, however, it doesn't do the DHCP or the static kickstart bits. We had to stop somewhere.
Where's the kickstart configurator?
[PowerShell MVP|https://mvp.support.microsoft.com/profile=5547F213-A069-45F8-B5D1-17E5BD3F362F], VI Toolkit forum moderator
Author of the upcoming book: Managing VMware Infrastructure with PowerShell
Co-Host, PowerScripting Podcast (http://powerscripting.net)
See Appendix B in ESX Server 3 and VirtualCenter Installation Guide
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
great & coll stuff what you are do here
But I search for a way to modify the DNS-Servers and the dns search domains with powershell.
I tried itt with set-VMHostnetwork but this doesn't work.
thanks
Christian
See for changing the DNS servers.
You can use the searchDomain property to define the search domains.
$dnsServers = ("192.168.111.3","192.168.111.4") Get-VMHost | Get-View | %{ $ns = Get-View -Id $esx.configManager.networkSystem $dns = $ns.networkConfig.dnsConfig $dns.Address = @() foreach($server in $dnsServers) { $dns.Address += $server } $dns.searchDomain = ("domain1.xyz","domain2.abc") $ns.UpdateDnsConfig($dns) }
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks for that.
Just a bit improvement: just define an array for the DNS servers instead of filling it form a list. The searchlist is just an char field...
$dnsServers = @("192.168.111.3","192.168.111.4") Get-VMHost | Get-View | %{$ns = Get-View -Id $esx.configManager.networkSystem $dns = $ns.networkConfig.dnsConfig $dns.Address = $dnsservers $dns.searchDomain = "domain1.xyz, domain2.abc" $ns.UpdateDnsConfig($dns)}
These are great ideas to improve configuring the DNS. I will add them to a future version of the scripts.
lance