VMware

This Question is Answered

1 2 Previous Next 29 Replies Last post: Jan 21, 2009 3:07 PM by lberc   Go to original post
Click to view 240Zeus's profile Novice 14 posts since
Jul 2, 2008

I know this goes against the OP's needs, but why not just perform the majority of this in a kickstart file for installation? The only thing I do not perform in my kickstarts is adding the host to a cluster and a few other small(ish) VC-related tasks, but vSwitch setup/port group assignment, enabling vMotion, vmnic speed/duplex settings, licensing, hostname configuration, IP/DNS assignment, etc... can all be done via VIM commands in the post-processing section of the Kickstart file....

Z

Click to view halr9000's profile Master 813 posts since
Jun 7, 2007
Well, there's several reasons. The first and most important (to me) is that I don't know a darn thing about kickstart beyond its purpose. :) While I know other platforms pretty well, I'm only an expert at one, and that's Windows. I'm sure I'm not the only one in this boat.

Second, this will likely prove to be easier to maintain. The tasks you can do in PowerShell will be more consistent than those done without.

It's probably easier to do it via kickstart for someone who knows bash scripting well, as well as the Linux command-line utilities on the COS.






PowerShell MVP, VI Toolkit forum moderator
Author of the upcoming book: Managing VMware Infrastructure with PowerShell
Co-Host, PowerScripting Podcast (http://powerscripting.net)
Click to view 240Zeus's profile Novice 14 posts since
Jul 2, 2008

Fair enough. :8} I came from a Windows background as well but projects in the past 3-4 years have necessitated Linux use. I'm all about automation and the kickstart files are simple text-based files that the ESX installer uses to automate installs.

I simply have a template ks file in the source control repository, check it out, modify IP's, VLAN information, DNS, etc... for the specific host I want to build, add it back to the repository, and deploy it to an internal http server that my ESX servers can see on the service console VLAN. A "ks=" option with the proper information entered at the ESX install screen and ten minutes later I have a fully configured ESX host ready to add to VirtualCenter. If I ever need to rebuild the host as it originally was six months later, I just boot off of that kickstart file again.

Sorry if I've hijacked the thread here. I've been doing VMware for a few years now and am starting to port some of my historical perl scripts over to PS - I'm glad to have found this community.

If you'd like to see a ks file you can use for automated install/configure just let me know!

Z


Click to view halr9000's profile Master 813 posts since
Jun 7, 2007
Why not automate the ks file checkout from revision control and the file modifications as well? :)






PowerShell MVP, VI Toolkit forum moderator
Author of the upcoming book: Managing VMware Infrastructure with PowerShell
Co-Host, PowerScripting Podcast (http://powerscripting.net)
Click to view SCampbell's profile Enthusiast 106 posts since
Apr 18, 2005
I think the main reason I prefer PS to Kickstart customizations is that the PS stuff can also configure ESXi servers; so you can have a very similar/identical customization script no matter which target you are aiming for.

Also there's a lot less infrastructure. No website, kickstart customizations, etc.

I would consider a static kickstart to create a baseline ESX DHCP-based server, then use the PS script to complete the customization of static addresses, root passwords, DNS names, etc.

That's the nice thing about computers: there are 100 good ways to solve any problem, and 100 people with think their way is best. :-)
Click to view 240Zeus's profile Novice 14 posts since
Jul 2, 2008

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!

Click to view 240Zeus's profile Novice 14 posts since
Jul 2, 2008

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? :)

Click to view SCampbell's profile Enthusiast 106 posts since
Apr 18, 2005
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.
Click to view halr9000's profile Master 813 posts since
Jun 7, 2007
Where's the kickstart configurator?





PowerShell MVP, VI Toolkit forum moderator
Author of the upcoming book: Managing VMware Infrastructure with PowerShell
Co-Host, PowerScripting Podcast (http://powerscripting.net)
Click to view LucD's profile Champion 2,430 posts since
Oct 31, 2005
Click to view ChrisRu's profile Enthusiast 36 posts since
Aug 4, 2005

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

Click to view LucD's profile Champion 2,430 posts since
Oct 31, 2005
See Re: HowTo change DNS servers on ESX host? 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)
}
Click to view ChrisRu's profile Enthusiast 36 posts since
Aug 4, 2005
Thanks for that.
Click to view Windspirit's profile Novice 11 posts since
Apr 12, 2005
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)}

VMware Developer

SDKs, APIs, Videos, Learn and much more in the Developer community.

Learn More

Developer Sample Code

Increase your developer productivity with VMware API sample code.

Learn More

VMworld Sessions & Labs

Online access to the latest VMworld Sessions & Labs and online services.

Learn more

Purchase PSO Credits Online

Purchase credits to redeem training and consulting services online.

Buy Now

Community Hardware Software

View reported configurations or report your own.

Learn More

VMware vSphere

Come witness the next giant leap in virtualization.

Register Today

Communities