Read a pretty interesting article by Mike Laverick this morning regarding factory resetting ESXi systems, here is a Perl script that does the same thing. (note, in the current form of the script, it requires ESXi host to be managed by vMA. The reason for this is that additional credentials do not need to be specify)
vCenter 2.5 or vCenter 4.0
ESXi 3.5 or 4.0
[vi-admin@scofield ~]$ ./factoryResetESXi.pl --server reflex.primp-industries.com --username primp --vihost kang.primp-industries.com Enter password: "kang.primp-industries.com" is entering maintenance mode ... "kang.primp-industries.com" has successfully entered maintenance mode! Removing "kang.primp-industries.com" from vCenter ... "kang.primp-industries.com" has successfully been remove from vCenter! Resetting factory settings on "kang.primp-industries.com"!