P2V Post Migration Cleanup

I’ve been doing a lot of P2V migrations over the last few months and wanted to share a couple of lessons learned. Our environment uses McAfee ePO to centrally manage our desktops and servers. We noticed that after a P2V migration the agent would no longer be able to communicate with the ePO server. After doing some searching we located several registry keys that contain Agent keys unique to a specific piece of hardware. If we delete these keys and restart the framework service clients are again able to communicate. Additionally, I look through the device manager and remove old devices — such as network cards that are no longer installed. Since these steps are repetitive, and I have a large quantity of P2V’s, I created this simple batch file to help me out:

[cc lang=”dos”]
@echo off
echo This tool fixes keys after a major hardware change – such as a P2V migration

if %PROCESSOR_ARCHITECTURE% == x86 reg delete “HKLM\SOFTWARE\Network Associates\ePolicy Orchestrator\Agent\Keys” /v binap /f
if %PROCESSOR_ARCHITECTURE% == x86 reg delete “HKLM\SOFTWARE\Network Associates\ePolicy Orchestrator\Agent\Keys” /v binas /f
if %PROCESSOR_ARCHITECTURE% == x86 reg delete “HKLM\SOFTWARE\Network Associates\ePolicy Orchestrator\Agent\Keys” /v binrs /f
if %PROCESSOR_ARCHITECTURE% == x86 reg delete “HKLM\SOFTWARE\Network Associates\ePolicy Orchestrator\Agent\Keys” /v binsp /f

if %PROCESSOR_ARCHITECTURE% == AMD64 reg delete “HKLM\SOFTWARE\Wow6432Node\Network Associates\ePolicy Orchestrator\Agent\Keys” /v binap /f
if %PROCESSOR_ARCHITECTURE% == AMD64 reg delete “HKLM\SOFTWARE\Wow6432Node\Network Associates\ePolicy Orchestrator\Agent\Keys” /v binas /f
if %PROCESSOR_ARCHITECTURE% == AMD64 reg delete “HKLM\SOFTWARE\Wow6432Node\Network Associates\ePolicy Orchestrator\Agent\Keys” /v binrs /f
if %PROCESSOR_ARCHITECTURE% == AMD64 reg delete “HKLM\SOFTWARE\Wow6432Node\Network Associates\ePolicy Orchestrator\Agent\Keys” /v binsp /f

net stop McAfeeFramework
net start McAfeeFramework

if %PROCESSOR_ARCHITECTURE% == x86 “%ProgramFiles%\McAfee\Common Framework\CmdAgent.exe” -s -p
if %PROCESSOR_ARCHITECTURE% == AMD64 “%ProgramFiles(x86)%\McAfee\Common Framework\CmdAgent.exe” -s -p

reg delete “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run” /v CPQTEAM /f

set devmgr_show_nonpresent_devices=1
start devmgmt.msc
[/cc]

To make things even easier, I have placed this script in an ISO image on my desktop. I can easily connect this ISO to the VM and access utilities even if my network connection is not connected.

Other utilities I keep in this ISO image are:

This entry was posted in Scripting, Virtualization. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Notify me of followup comments via e-mail. You can also subscribe without commenting.