VMware Cloud Community
cweldon
Contributor
Contributor

HP Server Agents in Guest after Conversion

After you convert a physical HP server (that has HP's SSP installed for that particular hardware...i.e. DL380 G4), you now have VMware's generic drivers for the hardware but the SSP still present. Does anyone have any suggestions on the procedure to "clean up" the virtual machine to make it more like a virtual server built from scratch without all the HP SSP software? I would think you would still want the HP Management Homepage so the virtual machine could still talk to SIM. Is an uninstall of all things HP through add/remove programs and a re-install of the SSP sufficient and safe?

Thanks

0 Kudos
5 Replies
wobbly1
Expert
Expert

yep, that will do it. if your physical server is hp you can install the management agents onto that and use insight with vmm pack to monitor both physical server and its vm's

0 Kudos
sbeaver
Leadership
Leadership

This is exactly what we do

Steve Beaver
VMware Communities User Moderator
VMware vExpert 2009 - 2020
VMware NSX vExpert - 2019 - 2020
====
Co-Author of "VMware ESX Essentials in the Virtual Data Center"
(ISBN:1420070274) from Auerbach
Come check out my blog: [www.virtualizationpractice.com/blog|http://www.virtualizationpractice.com/blog/]
Come follow me on twitter http://www.twitter.com/sbeaver

**The Cloud is a journey, not a project.**
0 Kudos
NJKwork
Enthusiast
Enthusiast

I wrote a simple batch file to take care of the following:

1) Removing all HP/Compaq stuff from "Add/Remove Programs"

2) Remove the HP Teaming software (requires snetconfig tool)

3) Remove some extra registry stuff

4) Delete the left over HP/Compaq directories

5) Remove the VMware Converter Agent (if that is what you used)

This batch file can be found here:

http://www.vmware.com/community/thread.jspa?threadID=70682

The final, hopefully good, version is on the final page (5) of the posts - be sure you grab that copy and not the earlier versions I had posted. SNETCFG can be obtained here: http://www.jsifaq.com/docs/files/76011/snetcfg.zip

Hope it helps

SlickBag

0 Kudos
acr
Champion
Champion

Yep, we remove them all as well..

0 Kudos
glennjbrown
Contributor
Contributor

I have a few vbs scripts that work. One goes through and makes a txt file of all the unused hardware in device manager, most of these items are hidden and you need to run some cmd line script to usually reveal this. The second script imports the txt file and deletes, the devices. Its actually pretty cool. Below are the scripts.

You need microsoft's devcon.exe in the folder you are running this from.

First file - name it ShowPhantomDevices.vbs

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

'Please e-mail me@benherman.com with comments, questions, job offers.

Set oWMI = GetObject("winmgmts:\{impersonationLevel=impersonate}!
.\root\cimv2")

set oShell=createobject("wscript.shell")

sCurrentDir=left(wscript.scriptfullname,instrrev(wscript.scriptfullname,"\"))

set oFS=CreateObject("Scripting.FileSystemObject")

set oOutput=oFS.CreateTextFile(sCurrentDir&"delPhantomDevices.txt",True)

oOutput.writeline "The following phantom devices will be deleted if you run delPhantomDevices.vbs:"&vbcrlf

set oDevices=oWMI.ExecQuery("select * from CIM_LogicalDevice")

set dDevice=createobject("scripting.dictionary")

dDevice.CompareMode=1

for each oDevice in oDevices

if not dDevice.exists(oDevice.deviceID) then dDevice.add oDevice.deviceID,oDevice.path_

next

bFoundAny=False

aCategories=RegEnumKeys(".","hklm\system\currentcontrolset\enum")

for each sCategory in aCategories

aDevices=RegEnumKeys(".","hklm\system\currentcontrolset\enum\"&sCategory)

if IsArray(aDevices) then

for each sDevice in aDevices

aInstances=RegEnumKeys(".","hklm\system\currentcontrolset\enum\"&sCategory&"\"&sDevice)

if IsArray(aInstances) then

for each sInstance in aInstances

if not dDevice.Exists(sCategory&"\"&sDevice&"\"&sInstance) then

sDisplayName=RegGetValue(".","hklm\system\currentcontrolset\enum\"&sCategory&"\"&sDevice&"\"&sInstance&"\DeviceDesc")

sClassGUID=RegGetValue(".","hklm\system\currentcontrolset\enum\"&sCategory&"\"&sDevice&"\"&sInstance&"\ClassGUID")

sClass=RegGetValue(".","hklm\system\currentcontrolset\control\Class\"&sClassGUID&"\")

if instr(lcase(sClass),"not found") then sClass=RegGetValue(".","hklm\system\currentcontrolset\enum\"&sCategory&"\"&sDevice&"\"&sInstance&"\Class")

if instr(lcase(sClass),"not found") then sClass=""

if instr(lcase(sDisplayName),"not found") then sDisplayName="" 'sDisplayName=sInstance

if sClass <> "LegacyDriver" and sCategory <> "HTREE" and sClass <> "Non-Plug and Play Drivers" then

bFoundAny=True

oOutput.writeline sClass&"\"&sDisplayName&" (Device ID="&sCategory&"\"&sDevice&"\"&sInstance&")"

end if

end if

next

end if

next

end if

next

oOutput.close

if bFoundAny then

oShell.Run "notepad """&sCurrentDir&"delPhantomDevices.txt""",1,False

else

msgbox "No devices found.",0,"Show Phantom Devices"

end if

Function RegEnumKeys(sServer,sPath)

'Get Registry Root

sRoot=ucase(left(sPath,instr(sPath,"\")-1))

'Set hRoot and remove registry root from path

select case sRoot

case "HKEY_CLASSES_ROOT","HKCR"

hRoot=&H80000000

sPath=right(sPath,len(sPath)-instr(sPath,"\"))

case "HKEY_CURRENT_USER","HKCU"

hRoot=&H80000001

sPath=right(sPath,len(sPath)-instr(sPath,"\"))

case "HKEY_LOCAL_MACHINE","HKLM"

hRoot=&H80000002

sPath=right(sPath,len(sPath)-instr(sPath,"\"))

case "HKEY_USERS","HKU"

hRoot=&H80000003

sPath=right(sPath,len(sPath)-instr(sPath,"\"))

case "HKEY_CURRENT_CONFIG","HKCC"

hRoot=&H80000005

sPath=right(sPath,len(sPath)-instr(sPath,"\"))

case "HKEY_DYN_DATA","HKDD"

hRoot=&H80000006

sPath=right(sPath,len(sPath)-instr(sPath,"\"))

case else

hRoot=&H80000002

end select

sKeyPath=sPath

'Get Registry object

on error resume next

Set oReg=GetObject("winmgmts:\{impersonationLevel=impersonate}!
" & sServer & "\root\default:StdRegProv")

if err.number <> 0 then

RegEnum=Array("Not found. Error getting to WMI StdRegProv: "&Cstr(Hex(err.number))&" "&err.description)

err.clear

exit function

end if

on error goto 0

'Enumvalues

iReturn=oReg.EnumValues(hRoot, sKeyPath, aValues, iTypes)

if iReturn <> 0 then

if iReturn="2" then

RegEnum=Array("Not Found. WMI Error: "&iReturn&". Key "&sKeyPath&" not found.")

else

RegEnum=Array("Not Found. WMI Error: "&iReturn&". Check http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wbemerrorenum.asp for reason.")

end if

exit function

end if

iReturn=oReg.EnumKey(hRoot, sKeyPath, aKeys)

if iReturn <> 0 then

if iReturn="2" then

RegEnum=Array("Not Found. WMI Error: "&iReturn&". Key "&sKeyPath&" not found.")

else

RegEnum=Array("Not Found. WMI Error: "&iReturn&". Check http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wbemerrorenum.asp for reason.")

end if

exit function

end if

'wscript.echo "Keys: "&TypeName(akeys),ubound(aKeys)

'wscript.echo "Values: "&TypeName(aValues),ubound(aValues)

if IsNull(aKeys) then

RegEnumKeys=Array("No keys found under "&sKeypath)

else

RegEnumKeys=aKeys

end if

End Function

Function RegGetValue(sServer,sPath)

'Get Registry Root

sRoot=ucase(left(sPath,instr(sPath,"\")-1))

'Set hRoot and remove registry root from path

select case sRoot

case "HKEY_CLASSES_ROOT","HKCR"

hRoot=&H80000000

sPath=right(sPath,len(sPath)-instr(sPath,"\"))

case "HKEY_CURRENT_USER","HKCU"

hRoot=&H80000001

sPath=right(sPath,len(sPath)-instr(sPath,"\"))

case "HKEY_LOCAL_MACHINE","HKLM"

hRoot=&H80000002

sPath=right(sPath,len(sPath)-instr(sPath,"\"))

case "HKEY_USERS","HKU"

hRoot=&H80000003

sPath=right(sPath,len(sPath)-instr(sPath,"\"))

case "HKEY_CURRENT_CONFIG","HKCC"

hRoot=&H80000005

sPath=right(sPath,len(sPath)-instr(sPath,"\"))

case "HKEY_DYN_DATA","HKDD"

hRoot=&H80000006

sPath=right(sPath,len(sPath)-instr(sPath,"\"))

case else

hRoot=&H80000002

end select

'Split path into key and value parts

sTargetValue=right(sPath,len(sPath)-instrrev(sPath,"\"))

sKeyPath=left(sPath,instrrev(sPath,"\")-1)

'Get Registry object

on error resume next

Set oReg=GetObject("winmgmts:\{impersonationLevel=impersonate}!
" & sServer & "\root\default:StdRegProv")

if err.number <> 0 then
RegGetValue="Not found. Error: "&Cstr(Hex(err.number))&" "&err.description
err.clear
exit function
end if
on error goto 0

'Enumvalues to get value data type
iReturn=oReg.EnumValues (hRoot, sKeyPath, aValues, iTypes)
if iReturn <> 0 then
if iReturn="2" then
RegGetValue="Not Found. WMI Error: "&iReturn&". Key "&sKeyPath&" not found."
else
RegGetValue="Not Found. WMI Error: "&iReturn&". Check http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wbemerrorenum.asp for reason."
end if

exit function
end if

if TypeName(aValues)="Null" then
RegGetValue="Not found. Error: Couldn't find the "&sTargetValue&" value (or any values) under "&sKeypath&"."
exit function
end if

'Get Data type
for ix=0 to ubound(aValues)
'wscript.echo aValues(ix),iTypes(ix)
if lcase(aValues(ix))=lcase(sTargetValue) then
iType=iTypes(ix)
bFound=True
end if
next

'Return if value not found.
if not bFound then
RegGetValue="Not found. Couldn't find value "&sTargetValue&" under key "&sKeyPath&"."
exit function
end if

'Types: REG_SZ (1), REG_EXPAND_SZ (2), REG_BINARY (3), REG_DWORD (4), REG_MULTI_SZ (7)
select case iType
case 1
iReturn=oReg.GetStringValue(hRoot,sKeyPath,sTargetValue,sValue)
case 2
iReturn=oReg.GetExpandedStringValue(hRoot,sKeyPath,sTargetValue,sValue)
case 3
iReturn=oReg.GetBinaryValue(hRoot,sKeyPath,sTargetValue,bValues)
if iReturn = 0 then
for each bValue in bValues
sDigit=cstr(hex(bValue))
if len(sDigit)<2 then sDigit="0"&sDigit
if len(sValue) = 0 then
sValue=sDigit
else
sValue=sValue&" "&sDigit
end if
next
end if
case 4
iReturn=oReg.GetDWORDValue(hRoot,sKeyPath,sTargetValue,sValue)
case 7
iReturn=oReg.GetMultiStringValue(hRoot,sKeyPath,sTargetValue,aValues)
if iReturn = 0 then
for each sString in aValues
if len(sValue)=0 then
sValue=sString
else
sValue=svalue&","&sString
end if
next
end if
case else
sValue="Not Found. Error: Value is an unrecognized data type: "&iType&"."
end select

if len(sValue)=0 and iReturn <> 0 then
if iReturn="2" then
RegGetValue="Not Found. WMI Error: "&iReturn&". Key "&sKeyPath&" not found."
else
RegGetValue="Not Found. WMI Error: "&iReturn&". Check http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wbemerrorenum.asp for reason."
end if

exit function
end if

RegGetValue=sValue
End Function


Function FiletoString(sFTS)
constForReading = 1 'used for opening files
set oFTS=CreateObject("Scripting.FileSystemObject")
if oFTS.FileExists(sFTS) then
set oFTSFile=oFTS.OpenTextFile(sFTS, constForReading)
FiletoString=oFTSFile.ReadAll
oFTSFile.close
else
FiletoString="File not found"
end if
set oFTS=Nothing
set oFTSFile=Nothing
End Function

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

Second file - name it DelPhantomDevices.vbs

'Please e-mail me@benherman.com with comments, questions, job offers.
iReturn=msgbox("This will permanently delete any non-present devices."&vbcrlf&vbcrlf&"These are greyed out if you ""set devmgr_show_nonpresent_devices=1"" from a "&vbcrlf&"command-prompt and then run devmgmt.msc and choose ""Show Hidden Devices"""&vbcrlf&"from the ""View"" menu.",1,"Delete Phantom Devices")
if iReturn <> 1 then wscript.quit

Set oWMI = GetObject("winmgmts:\{impersonationLevel=impersonate}!
.\root\cimv2")

set oShell=createobject("wscript.shell")

sCurrentDir=left(wscript.scriptfullname,instrrev(wscript.scriptfullname,"\"))

set oFS=CreateObject("Scripting.FileSystemObject")

set oOutput=oFS.CreateTextFile(sCurrentDir&"delPhantomDevices.txt",True)

set oDevices=oWMI.ExecQuery("select * from CIM_LogicalDevice")

set dDevice=createobject("scripting.dictionary")

dDevice.CompareMode=1

for each oDevice in oDevices

if not dDevice.exists(oDevice.deviceID) then dDevice.add oDevice.deviceID,oDevice.path_

next

bFoundAny=False

aCategories=RegEnumKeys(".","hklm\system\currentcontrolset\enum")

for each sCategory in aCategories

aDevices=RegEnumKeys(".","hklm\system\currentcontrolset\enum\"&sCategory)

if IsArray(aDevices) then

for each sDevice in aDevices

aInstances=RegEnumKeys(".","hklm\system\currentcontrolset\enum\"&sCategory&"\"&sDevice)

if IsArray(aInstances) then

for each sInstance in aInstances

if not dDevice.Exists(sCategory&"\"&sDevice&"\"&sInstance) then

sDisplayName=RegGetValue(".","hklm\system\currentcontrolset\enum\"&sCategory&"\"&sDevice&"\"&sInstance&"\DeviceDesc")

sClassGUID=RegGetValue(".","hklm\system\currentcontrolset\enum\"&sCategory&"\"&sDevice&"\"&sInstance&"\ClassGUID")

sClass=RegGetValue(".","hklm\system\currentcontrolset\control\Class\"&sClassGUID&"\")

if instr(lcase(sClass),"not found") then sClass=RegGetValue(".","hklm\system\currentcontrolset\enum\"&sCategory&"\"&sDevice&"\"&sInstance&"\Class")

if instr(lcase(sClass),"not found") then sClass=""

if instr(lcase(sDisplayName),"not found") then sDisplayName="" 'sDisplayName=sInstance

if sClass <> "LegacyDriver" and sCategory <> "HTREE" and sClass <> "Non-Plug and Play Drivers" then

bFoundAny=True

oOutput.writeline "Removing "&sClass&"\"&sDisplayName&"..."

oShell.Run "cmd /c """""&sCurrentDir&"devcon"" remove ""@"&sCategory&"\"&sDevice&"\"&sInstance&""" > """&sCurrentDir&"devcon.out"""" 2>>&1",0,True

oOutput.writeline FiletoString(sCurrentDir&"devcon.out")

end if

end if

next

end if

next

end if

next

oOutput.writeline "Done."

oOutput.close

if bFoundAny then

oShell.Run "notepad """&sCurrentDir&"delPhantomDevices.txt""",1,False

else

msgbox "No devices found or deleted.",0,"Delete Phantom Devices"

end if

Function RegEnumKeys(sServer,sPath)

'Get Registry Root

sRoot=ucase(left(sPath,instr(sPath,"\")-1))

'Set hRoot and remove registry root from path

select case sRoot

case "HKEY_CLASSES_ROOT","HKCR"

hRoot=&H80000000

sPath=right(sPath,len(sPath)-instr(sPath,"\"))

case "HKEY_CURRENT_USER","HKCU"

hRoot=&H80000001

sPath=right(sPath,len(sPath)-instr(sPath,"\"))

case "HKEY_LOCAL_MACHINE","HKLM"

hRoot=&H80000002

sPath=right(sPath,len(sPath)-instr(sPath,"\"))

case "HKEY_USERS","HKU"

hRoot=&H80000003

sPath=right(sPath,len(sPath)-instr(sPath,"\"))

case "HKEY_CURRENT_CONFIG","HKCC"

hRoot=&H80000005

sPath=right(sPath,len(sPath)-instr(sPath,"\"))

case "HKEY_DYN_DATA","HKDD"

hRoot=&H80000006

sPath=right(sPath,len(sPath)-instr(sPath,"\"))

case else

hRoot=&H80000002

end select

sKeyPath=sPath

'Get Registry object

on error resume next

Set oReg=GetObject("winmgmts:\{impersonationLevel=impersonate}!
" & sServer & "\root\default:StdRegProv")

if err.number <> 0 then

RegEnum=Array("Not found. Error getting to WMI StdRegProv: "&Cstr(Hex(err.number))&" "&err.description)

err.clear

exit function

end if

on error goto 0

'Enumvalues

iReturn=oReg.EnumValues(hRoot, sKeyPath, aValues, iTypes)

if iReturn <> 0 then

if iReturn="2" then

RegEnum=Array("Not Found. WMI Error: "&iReturn&". Key "&sKeyPath&" not found.")

else

RegEnum=Array("Not Found. WMI Error: "&iReturn&". Check http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wbemerrorenum.asp for reason.")

end if

exit function

end if

iReturn=oReg.EnumKey(hRoot, sKeyPath, aKeys)

if iReturn <> 0 then

if iReturn="2" then

RegEnum=Array("Not Found. WMI Error: "&iReturn&". Key "&sKeyPath&" not found.")

else

RegEnum=Array("Not Found. WMI Error: "&iReturn&". Check http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wbemerrorenum.asp for reason.")

end if

exit function

end if

'wscript.echo "Keys: "&TypeName(akeys),ubound(aKeys)

'wscript.echo "Values: "&TypeName(aValues),ubound(aValues)

if IsNull(aKeys) then

RegEnumKeys=Array("No keys found under "&sKeypath)

else

RegEnumKeys=aKeys

end if

End Function

Function RegGetValue(sServer,sPath)

'Get Registry Root

sRoot=ucase(left(sPath,instr(sPath,"\")-1))

'Set hRoot and remove registry root from path

select case sRoot

case "HKEY_CLASSES_ROOT","HKCR"

hRoot=&H80000000

sPath=right(sPath,len(sPath)-instr(sPath,"\"))

case "HKEY_CURRENT_USER","HKCU"

hRoot=&H80000001

sPath=right(sPath,len(sPath)-instr(sPath,"\"))

case "HKEY_LOCAL_MACHINE","HKLM"

hRoot=&H80000002

sPath=right(sPath,len(sPath)-instr(sPath,"\"))

case "HKEY_USERS","HKU"

hRoot=&H80000003

sPath=right(sPath,len(sPath)-instr(sPath,"\"))

case "HKEY_CURRENT_CONFIG","HKCC"

hRoot=&H80000005

sPath=right(sPath,len(sPath)-instr(sPath,"\"))

case "HKEY_DYN_DATA","HKDD"

hRoot=&H80000006

sPath=right(sPath,len(sPath)-instr(sPath,"\"))

case else

hRoot=&H80000002

end select

'Split path into key and value parts

sTargetValue=right(sPath,len(sPath)-instrrev(sPath,"\"))

sKeyPath=left(sPath,instrrev(sPath,"\")-1)

'Get Registry object

on error resume next

Set oReg=GetObject("winmgmts:\{impersonationLevel=impersonate}!
" & sServer & "\root\default:StdRegProv")

if err.number <> 0 then
RegGetValue="Not found. Error: "&Cstr(Hex(err.number))&" "&err.description
err.clear
exit function
end if
on error goto 0

'Enumvalues to get value data type
iReturn=oReg.EnumValues (hRoot, sKeyPath, aValues, iTypes)
if iReturn <> 0 then
if iReturn="2" then
RegGetValue="Not Found. WMI Error: "&iReturn&". Key "&sKeyPath&" not found."
else
RegGetValue="Not Found. WMI Error: "&iReturn&". Check http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wbemerrorenum.asp for reason."
end if

exit function
end if

if TypeName(aValues)="Null" then
RegGetValue="Not found. Error: Couldn't find the "&sTargetValue&" value (or any values) under "&sKeypath&"."
exit function
end if

'Get Data type
for ix=0 to ubound(aValues)
'wscript.echo aValues(ix),iTypes(ix)
if lcase(aValues(ix))=lcase(sTargetValue) then
iType=iTypes(ix)
bFound=True
end if
next

'Return if value not found.
if not bFound then
RegGetValue="Not found. Couldn't find value "&sTargetValue&" under key "&sKeyPath&"."
exit function
end if

'Types: REG_SZ (1), REG_EXPAND_SZ (2), REG_BINARY (3), REG_DWORD (4), REG_MULTI_SZ (7)
select case iType
case 1
iReturn=oReg.GetStringValue(hRoot,sKeyPath,sTargetValue,sValue)
case 2
iReturn=oReg.GetExpandedStringValue(hRoot,sKeyPath,sTargetValue,sValue)
case 3
iReturn=oReg.GetBinaryValue(hRoot,sKeyPath,sTargetValue,bValues)
if iReturn = 0 then
for each bValue in bValues
sDigit=cstr(hex(bValue))
if len(sDigit)<2 then sDigit="0"&sDigit
if len(sValue) = 0 then
sValue=sDigit
else
sValue=sValue&" "&sDigit
end if
next
end if
case 4
iReturn=oReg.GetDWORDValue(hRoot,sKeyPath,sTargetValue,sValue)
case 7
iReturn=oReg.GetMultiStringValue(hRoot,sKeyPath,sTargetValue,aValues)
if iReturn = 0 then
for each sString in aValues
if len(sValue)=0 then
sValue=sString
else
sValue=svalue&","&sString
end if
next
end if
case else
sValue="Not Found. Error: Value is an unrecognized data type: "&iType&"."
end select

if len(sValue)=0 and iReturn <> 0 then

if iReturn="2" then

RegGetValue="Not Found. WMI Error: "&iReturn&". Key "&sKeyPath&" not found."

else

RegGetValue="Not Found. WMI Error: "&iReturn&". Check http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wbemerrorenum.asp for reason."

end if

exit function

end if

RegGetValue=sValue

End Function

Function FiletoString(sFTS)

constForReading = 1 'used for opening files

set oFTS=CreateObject("Scripting.FileSystemObject")

if oFTS.FileExists(sFTS) then

set oFTSFile=oFTS.OpenTextFile(sFTS, constForReading)

FiletoString=oFTSFile.ReadAll

oFTSFile.close

else

FiletoString="File not found"

end if

set oFTS=Nothing

set oFTSFile=Nothing

End Function

""""""""""""""""""""""""""""""""""""""""""""""""""""""""

0 Kudos