Server Management - Systems Insight Manager
1748255 Members
3939 Online
108760 Solutions
New Discussion юеВ

Re: Helpful script for P2V cleanup

 
NJK-Work
Honored Contributor

Helpful script for P2V cleanup

For those of you that use HP SIM to manage VMs and do P2Vs, I wrote a batch file that extensively cleans out all the old HP drivers and agents after the P2V.

I originally posted this on the VMware forums, and I personally don't use HP to do P2Vs, but I thought some of you might find this useful:

@ECHO OFF
ECHO HP Physcial to Virtual Cleaner Utility (Version 02-14-2007)
ECHO Author: Nelson Kaeppel
ECHO.
ECHO ************************************************************
ECHO * This batch file semi-automates the removal of management *
ECHO * agents and drivers from a virtual server that has been *
ECHO * virtualized from an HP or Compaq physical server using *
ECHO * P2V Helper, VMware Converter, or similar software. This *
ECHO * batch file assumes relatively newer versions of the HP *
ECHO * support software, and may not completely remove all the *
ECHO * software for older versions. *
ECHO ************************************************************
ECHO.
ECHO Note - The VMware Converter may leave some HP files corrupt.
ECHO You may want to run a "chkdisk" on the system drive
ECHO to fix any bad files before running this batch file.
ECHO.
ECHO USE AT YOUR OWN RISK!!!
ECHO.
ECHO *****************************
ECHO Type "ctrl-c" to quit now!!!
ECHO *****************************
ECHO.
ECHO USE AT YOUR OWN RISK!!!
Pause
cls

ECHO Removing the "HP Array Configuration Utility"...
"%PROGRAMFILES%\Compaq\Cpqacuxe\hpuninst.exe" /s

ECHO Removing the "HP Array Configuration Utility CLI"...
"%PROGRAMFILES%\Compaq\Hpacucli\hpuninst.exe" /s

ECHO Removing the "HP Array Diagnostic Utility"...
"%PROGRAMFILES%\Compaq\hpadu\hpuninst.exe" /s

ECHO Removing the "HP Insight Diagnostics Online Edition for Windows"...
If NOT Exist "%PROGRAMFILES%\InstallShield Installation Information\{3754251E-100C-47D4-AB86-DC34047EE3C4}\setup.exe" GOTO NEWDIAG
RunDll32 C:\PROGRA~1\COMMON~1\INSTAL~1\engine\6\INTEL3~1\Ctor.dll,LaunchSetup "C:\Program Files\InstallShield Installation Information\{3754251E-100C-47D4-AB86-DC34047EE3C4}\setup.exe" -l0x9 UNINSTALL
GOTO HPAGENTS
:NEWDIAG
MsiExec.exe /X{04DDF575-93A4-4682-A4F1-ABD29ECDFE04} /quiet

:HPAGENTS
ECHO Removing the "HP Insight Management Agents"...
IF NOT Exist %SYSTEMROOT%\system32\CPQMgmt\aguninst.exe GOTO NEWAGENTS
%SYSTEMROOT%\system32\CPQMgmt\aguninst.exe /s
GOTO CHECKMP
:NEWAGENTS
MsiExec.exe /X{DFB7A687-8111-4CC2-B175-9431708F7902} /quiet

:CHECKMP
ECHO Removing the "HP Lights-Out Online Configuration Utility"...
If NOT Exist "%PROGRAMFILES%\HP\hponcfg" GOTO CHECKIML
If NOT Exist "%PROGRAMFILES%\HP\hponcfg\hpuninst.exe" GOTO NEWMP
"%PROGRAMFILES%\HP\hponcfg\hpuninst.exe" /s
GOTO CHECKIML
:NEWMP
MsiExec.exe /X{F8C40C34-FF8A-4A4D-8FA4-8DFF4503A61C} /quiet

:CHECKIML
ECHO Removing the "HP ProLiant Integrated Management Log Viewer"...
If NOT Exist "%PROGRAMFILES%\Compaq\Cpqimlv\hpuninst.exe" GOTO NEWIML
"%PROGRAMFILES%\Compaq\Cpqimlv\hpuninst.exe" /s
GOTO CHECKLPC
:NEWIML
MsiExec.exe /X{B03AAFA3-07B7-4D93-8ECD-12B977BF861E} /quiet

:CHECKLPC
IF NOT Exist "%PROGRAMFILES%\Compaq\CpqLpcc\hpuninst.exe" GOTO NOLPC
ECHO Removing the "HP ProLiant Legacy Port Configuration Component"...
"%PROGRAMFILES%\Compaq\CpqLpcc\hpuninst.exe" /s

:NOLPC
If NOT Exist "%PROGRAMFILEs%\HPWBEM\IPMI" GOTO NOIPMI
ECHO Removing the "HP ProLiant IPMI WMI Provider"...
MsiExec.exe /X{DF6412FA-0E25-4B23-9E80-116C061B4FD1} /quiet
MsiExec.exe /X{6BD49497-AFE5-43D4-9B7B-AAD7B405E110} /quiet

:NOIPMI
ECHO Removing the "HP ProLiant Remote Monitor Service"...
If NOT Exist %SYSTEMROOT%\system32\hpuninst.exe GOTO NEWRMS
%SYSTEMROOT%\system32\hpuninst.exe /s
GOTO CHECKDP
:NEWRMS
MsiExec.exe /X{0DEE841C-14D1-4497-8204-31B04370FDB7} /quiet

:CHECKDP
If NOT Exist C:\hp\hpsmh\data\htdocs\DataProtection\UnInstall.exe GOTO NODATAPROTECT
ECHO Removing the "HP Protect Your Data"...
C:\hp\hpsmh\data\htdocs\DataProtection\UnInstall.exe >Nul: 2>&1

:NODATAPROTECT
ECHO Removing the "HP Version Control Agent"...
IF NOT Exist C:\hp\hpsmh\data\cgi-bin\vcagent\vcaremov.exe GOTO NEWVCA
C:\hp\hpsmh\data\cgi-bin\vcagent\vcaremov.exe /silent C:\hp\hpsmh\data\cgi-bin\vcagent\vcagent.inf
GOTO CHECKSMH
:NEWVCA
MsiExec.exe /X{5A5F45AE-0250-4C34-9D89-F10BDDEE665F} /quiet

:CHECKSMH
ECHO Removing the "HP System Management Homepage"...
RunDll32 C:\PROGRA~1\COMMON~1\INSTAL~1\PROFES~1\RunTime\11\00\Intel32\Ctor.dll,LaunchSetup "C:\Program Files\InstallShield Installation Information\{3C4DF0FD-95CF-4F7B-A816-97CEF616948F}\setup.exe" -l0x9 -removeonly

If NOT Exist "%PROGRAMFILES%\VMware\VMware Converter\InstMsi.exe" GOTO NOCONVERTER
ECHO Removing the "VMware Converter"...
MsiExec.exe /X{A4D04B1A-DCF1-4C8C-8FFE-07D145812742} /quiet

:NOCONVERTER
ECHO Removing the "HP Network Congifuration Utility"...
snetcfg.exe -v -u cq_cpqteam >Nul: 2>&1

ECHO Removing registry keys for services without a "Removal Option"...
regedit /s p2vcleaner.reg

ECHO Deleting old HP and Compaq directories that are not needed...
rd /s/q c:\hp >Nul: 2>&1
rd /s/q c:\compaq >Nul: 2>&1
rd /s/q c:\cpqsystem >Nul: 2>&1
rd /s/q "%PROGRAMFILES%\compaq" >Nul: 2>&1
rd /s/q "%PROGRAMFILES%\hp" >Nul: 2>&1
rd /s/q %SYSTEMROOT%\system32\CPQMgmt >Nul: 2>&1

ECHO.
ECHO All software has been removed...please reboot.
PAUSE




You will also need to create a REG file that must be in the same directory and called "p2vcleaner.reg":

Windows Registry Editor Version 5.00

[-HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\sysdown\]
[-HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\sysmgmt\]

Finally, also in the same directory, you will need the snetcfg.exe utility. This can be downloaded from http://www.jsifaq.com/docs/files/76011/snetcfg.zip

So what I do is copy all three files (batch file, reg file, and snetcfg) to a temp location on the server. Run the P2V, and then after the conversion run this batch file on the new VM to clean all the HP junk off the VM. I do this AFTER the P2V instead of before (on the physical server) so that if I need to go back to the physical server, it will still have all the HP stuff on it.

Hope this helps some folks out there.
Nelson
10 REPLIES 10
David Claypool
Honored Contributor

Re: Helpful script for P2V cleanup

It may be helpful to know that this is an unnecessary step when using the HP Server Migration Pack which does this automatically...
NJK-Work
Honored Contributor

Re: Helpful script for P2V cleanup

Cool - I did not know that (since I don't use the tool) :)

Thanks for the update.
Rob Buxton
Honored Contributor

Re: Helpful script for P2V cleanup

Nelson,
What do you use to do the P2V's?
I've tried the new VMware Converter but that seemed to leave a lot of services from the agents.
I might give this a go along with vmware convertor.
NJK-Work
Honored Contributor

Re: Helpful script for P2V cleanup

Correct - the VMware converter does not remove any HP/Compaq management agents or directories (and some reg keys too).

My script takes care of "automating" the removal of these. You can always remove this stuff by hand, but this script automates it.

Apparently HP has this built into the tool they sell - but I have never used it, so I was not aware of that.

Nelson
Rob Buxton
Honored Contributor

Re: Helpful script for P2V cleanup

Thanks,
I have used HP's P2V up until now, but on the most recent Server I tried it would just BSOD and reboot at startup - it's W2K3 so it's not the know W2K BSOD issue with the ntoskrnl. Also it would BSOD and then immediately reboot so I had no way of catching the error.
But, the VMware Converter plus your script gave me a nice clean conversion.
I'd like to award points for it but...
NJK-Work
Honored Contributor

Re: Helpful script for P2V cleanup

Glad to help!

Nelson
Rob Buxton
Honored Contributor

Re: Helpful script for P2V cleanup

Just a followup, the script does a lot more tidying up of the utilities than HP's P2V.
After that your still left with the SMH and various other utilities, so running it after an HP P2V gave me an even cleaner virtual server.

With the servers I converted using VMware Converter and then using the script there's a remaining advanced ilo management driver that's been left behind. I'll dig a bit deeper when I'm back in the office and if I can enhance the script I'll post the updates.
NJK-Work
Honored Contributor

Re: Helpful script for P2V cleanup

That would be great. I am always looking for ways to improve this.

Thanks
Nelson
Todd Schelin
Valued Contributor

Re: Helpful script for P2V cleanup

I have done many P2V's with HP's utility and it does not remove any of the HP utilities from the OS instance. In fact it doesn't do much at all. I wrote my own script as well to remove the services and utlities, but didn't care about removing the drivers as they don't get loaded anyways.
Great script Nelson, there are many that could use this.