HP Insight Server Migration Pack & The memory could not be read

October 27, 2009 in Windows Events, Windows Scripts by MLK

Description/Problem:
Some weeks ago we used the HP Insight Server Migration Pack (HP ProLiant Server) for migration of server from old to new hardware. Migration process finished successfully and everything seems fine. After standard system checks and tests we identify small problem related to execution of some EXE files. Each try to execute EXE file failed with error message: Application error: The instruction at “0×10015026″ referenced memory at “0×00000000″. The memory could not be “read”.

Solution:
Based on our investigation we identify that problem is related to the Windows Management Instrumentation (WMI). We resolved the issue by running below script.

@echo on
cd /d c:\temp
if not exist %windir%\system32\wbem goto TryInstall
cd /d %windir%\system32\wbem
net stop winmgmt
winmgmt /kill
if exist Rep_bak rd Rep_bak /s /q
rename Repository Rep_bak
for %%i in (*.dll) do RegSvr32 -s %%i
for %%i in (*.exe) do call :FixSrv %%i
for %%i in (*.mof,*.mfl) do Mofcomp %%i
net start winmgmt
goto End
:FixSrv
if /I (%1) == (wbemcntl.exe) goto SkipSrv
if /I (%1) == (wbemtest.exe) goto SkipSrv
if /I (%1) == (mofcomp.exe) goto SkipSrv
%1 /RegServer
:SkipSrv
goto End
:TryInstall
if not exist wmicore.exe goto End
wmicore /s
net start winmgmt
:End