Below is how to factory reset a HP 5900. This will remove all configuration.
reset saved-configuration main
reset saved-configuration backup
The saved configuration file will be erased. Are you sure? [Y/N]:y
Configuration file in flash: is being cleared.
Please wait …
Configuration file is cleared.
Start to check configuration with next startup configuration file, please wait………DONE!
Current configuration may be lost after the reboot, save current configuration? [Y/N]:n
This command will reboot the device. Continue? [Y/N]:y
Now rebooting, please wait…
%Dec 31 19:03:00:203 2010 Switch-Dal-Core DEV/5/SYSTEM_REBOOT: System is rebooting now.
Thats it! the main thing to remember is to reset both the saved-configuration main, and backup slots. Then reboot, and make sure not to save the configuration.