SYMPTOMS
You deploy an agent from the Management Server and in the pop-up deployment windows its listed as Successful however the server remains in Pending Management listed as ‘Install in Progress’.
The OpsMgr Health service fails to start and returns the following error: Error 0×8004005: Unspecified Error
CAUSE
This is caused by the Management Group changing and no longer being contactable but with the agent still being deployed and you try to install over the top into a new Management Group.
You will see the following error when you try to start the OpsMgr Health service:

You will also see the following error listed in the Event Viewer of the destination server:

If you the ablity to run a TraceLogSM and get it analised by Microsoft you will see a log similar to bellow. Not the hightlighted sections show the domain, service account and Management Group. If any of there are incorrect then you have found the issue.
You will need to run the TraceLogSM with the follow parameters:
TraceLogSM -start HSCORE -f hscore.etl -b 8 -ft 30 -guid #417B7AE0-9B8F-4E3F-8FCA-19C706EFF3D4 -flag 0xF -cir 100
To stop use: TraceLogSM -x
Send the file hscore.etl to Microsft for analysis.
67 HealthServiceCommon 23900 8856 2 0 05\17\2007-11:04:12:399 Logging informational event with args MGROUP
68 SecureStorageManager 23900 8856 2 0 05\17\2007-11:04:12:430 SSRef 63745834-3e54-936c-1b47-2d632054a177 resolves to 00BD5E70CBE8C70C8ABA7F843EB0BB42BA1920A05C00000000000000000000000000000000000000 : 0(ERROR_SUCCESS)
69 SecureStorageManager 23900 8856 2 0 05\17\2007-11:04:12:446 Account QBEAU\SCOM_AAA logged on : 1(ERROR_INVALID_FUNCTION)
70 SecureStorageManager 23900 8856 2 0 05\17\2007-11:04:12:446 Unable to create logon token : 1(ERROR_INVALID_FUNCTION)
71 SecureStorageManager 23900 8856 2 0 05\17\2007-11:04:12:446 Unable to log on user : 1(ERROR_INVALID_FUNCTION)
72 SecureStorageManager 23900 8856 2 0 05\17\2007-11:04:12:446 Unable to log on account : 1(ERROR_INVALID_FUNCTION)
73 SecureStorageManager 23900 8856 2 0 05\17\2007-11:04:12:446 Unable to retrieve the action account reference : 1(ERROR_INVALID_FUNCTION)
74 SecureStorageManager 23900 8856 2 0 05\17\2007-11:04:12:446 Unable to add store to store hashtable : 1
75 ConnectorManager 23900 8856 2 0 05\17\2007-11:04:12:446 Secure Storage Manager failed during MG notification : -2147467259(E_FAIL)
76 ConnectorManager 23900 8856 2 0 05\17\2007-11:04:12:446 Unable to inform components about management groups : -2147467259(E_FAIL)
77 HealthServiceExecutive 23900 8856 2 0 05\17\2007-11:04:12:446 Start of 1 manager failed with code -2147467259(E_FAIL).
78 HealthServiceExecutive 23900 8856 2 0 05\17\2007-11:04:12:446 ManagerStartup failed with code -2147467259(E_FAIL).
79 HealthServiceExecutive 23900 8856 2 0 05\17\2007-11:04:12:446 ServiceInitialization failed with code -2147467259(E_FAIL).
80 HealthServiceExecutive 23900 8856 2 0 05\17\2007-11:04:12:446 Health service is stopping.
81 HealthServiceCommon 23900 8856 1 0 05\17\2007-11:04:12:446 “Logging success event with args DOMAIN1, SCOM_AAA, MGROUP“
82 HealthServiceHost 23900 22684 1 0 05\17\2007-11:04:12:868 HealthService.exe exiting.
83 HealthServiceExecutive 23900 8856 2 0 05\17\2007-11:04:12:868 Health service entered the stopped state.
84 HealthServiceExecutive 23900 8856 2 0 05\17\2007-11:04:12:868 Start failed with code -2147467259(E_FAIL).
85 ConnectorManager 23900 15272 3 0 05\17\2007-11:04:12:868 GetHealthStatus called after service shutdown.
86 ConnectorManager 23900 7008 0 05\17\2007-11:04:12:868 OnLocalDataAvailable called after service shutdown.
87 ConnectorManager 23900 7008 0 05\17\2007-11:04:12:868 GetHealthStatus called after service shutdown.
RESOLUTION
1. Manually uninstall the agent from the destination server.
2. Using regedit confirm that the following registry entry doesn’t exist:
HKLM\software\microsoft\microsoft operations manager\3.0\Agent Management Groups\%ManagementGroup%
3. Deploy the agent again either via the Management Server or Manually