VMware Horizon Community
bigstrat2003
Contributor
Contributor

Shutdown scripts not running

Hey all,

I have been experiencing the issue mentioned at http://paulslager.com/?p=1232, where DHCP is getting cluttered with leases to VMs that have since been deleted. I've been attempting to work around it with a QuickPrep poweroff script or with a shutdown script set via local GPO, but neither is working. The script is simple enough and I'm fairly confident it is not the issue: a batch file with the command "ipconfig /release".

If I use the QuickPrep script option, it runs the script but logs that ipconfig /release failed. It says something along the lines of the adapter not being recognized when it tries to release Local Area Connection, which mystifies me as ipconfig /release works normally when I have the VM up and invoke it manually.

Here's what happens when I test: if I log into my test pool and shut down, the script runs like I'd expect (and the lease is gone from DHCP). If I log off, the VM gets deleted (which is what I have set, but I might change this if I can't get the script to work like I want), but the lease is still in DHCP. If I recompose the pool (this is the critical thing to get right), the lease is also still in DHCP. Because the VMs are getting destroyed (either deleted or by the recompose), I can't check any sort of logs to find out what's going on.

This is really driving me up a wall. Can anyone offer any insight?

0 Kudos
5 Replies
bigstrat2003
Contributor
Contributor

Giving this thread a bump in the hopes that someone will see it and have some insight...

0 Kudos
VMBobster
Contributor
Contributor

I dont think you'll get a reply because there is not a way to do this.  I've researched and contacted VMware and tried several things to get the IPs to release on shutdown to no avail.  I've asked for this capability in View 5 but we'll see.

0 Kudos
admin
Immortal
Immortal

I believe we fix that in 4.5/4.6 so refresh/recompose won't delete/recreate desktops and thus their

MAC would be preserved.

Are we concerning about deleted VMs? Or are you suggesting that there is a bug still that leads to

regeneration of MAC on refresh/recompose w/ View 4.6?

VMBobster
Contributor
Contributor

What the original poster is trying to do is the same thing I wanted to do.  I frequently build parallel pools in a /24 subnet.  When I'm ready to swing entitlements over to the new updated pool of desktops, I want to be able to release the IPs on the old pools so that I free up IPs to build and power on in the new pools.  Our DHCP leases are 4 hours so waiting is not an option.  We resorted to powering on all of the VMs in the stale pool and running a script against them to release their IPs so we'd have enough to build/power on the new pool.  The capability to run startup/shutdown scripts does not exist, even though there are several areas in View, Windows, and in VMWare Tools to place these shutdown scripts (I believe VMWare even calls them startup/shutdown scripts in the VMWare Tools, however releasing the ip addresses does not work properly.  My opinion is that its a defect given that the VMWare Tools provides a location for these types of scripts in their tools.

0 Kudos
bigstrat2003
Contributor
Contributor

I checked after you posted about 4.6 not changing MAC addresses during a recompose, and you seem to be right. I could have swore that the recompose operations I did before deleted and re-created the VMs, but perhaps I remembered wrong.

Currently, I have my pool set to delete VMs on logoff (rather than refresh) because when I was testing a floating assignment pool earlier, the pool would add more VMs with each recompose (in what I assumed was an attempt to meet the minimum requirement for powered-on and available desktops). To counteract that behavior, I set the pool to delete VMs upon logoff. If recompose is working like it should (I will have to test further), I can deal with that myself if need be... it's not like I recompose the pool every day, so I can always delete machines manually or just hold provisioning while the pool is recomposing.

I'm still curious why these scripts are not working properly. I have never before seen ipconfig /release return "the interface is unknown" like it does in the QuickPrep script I set, and can't fathom why that happens. I'm also mystified why a shutdown script set with GPO works upon shutting down Windows by using the normal shut down options, but not when View Composer is deleting or recomposing VMs (unless View Composer isn't gracefully shutting down the guest OS, just shutting the VM off?). VMBobster has a point, DHCP leases should be able to be freed up just like View Composer deletes computer accounts in AD. While I might be able to work around the issue by reconfiguring my pool, not everyone will be able to do this. Smiley Sad

0 Kudos