Hardening stage completed with the following script/s failure: AfterHardening
Symptom
During an installation/upgrade you may encounter the following error:
‘Hardening stage completed with the following script’s failure: AfterHardening…..’
- In the PSMInstall.log we see:
- In the PSMHardening-xxxxxx-xxxxxx.log we see errors relating to ‘InstallIt’, ‘AfterHardening’ and ‘IEDevTools’:
Execute-Stage.ps1 ERR - Failed to run After running the hardening script. Error: Failed to block IEDevTools
- Other errors in the logs we see:
'PSM Execute-Stage.ps1 ERR - Step AfterHardening has failed with the following error: The stage InstallIt has returned with failure'
'PSM Execute-Stage.ps1 ERR - Hardening stage completed with the following script/s failure: AfterHardening'
'PSM Execute-Stage.ps1 ERR - Failed to run After running the hardening script. Error: Failed to block IEDevTools'
Environment
10.10;11.1;11;11.2;11.3;11.4;11.5;11.6;11.7;12.0;12.1;12.2;11.9;11.8;12.4;12.3;12.5;12.6 Privileged Access Manager (PAM, self-hosted) PSM;Privileged Session Management (PSM) PSM PSM installation and Hardening
Cause
The root cause for this issue is still unknown but the issue is because the installation has a problem with setting the REG-DWORD value for ‘Disabled’ to ‘1’ for the following registry key:
HKLM:\SOFTWARE\Policies\Microsoft\Internet Explorer\IEDevTools
Resolution
The workaround is to set the value manually although it has also been reported the script has made the change and yet the installer still shows this error. This can be tested if you set the above registry value to ‘0’ and then re-run the installation to check if the error is reported and the value changed to ‘1’.
To complete the installation without error it is possible to comment out the 'Block-IEDevTools' sub-function from the 'AfterRunningTheHardeningScript.psm1' PowerShell module with a '#' symbol so the relevant section of the code appears as below:
Block-IEContextMenu
# Block-IEDevTools
Hide-Drives
DisableViewingLocalFiles
N.B. The 'AfterRunningTheHardeningScript.psm1' PowerShell module can be found in the PSM installation media ‘InstallationAutomation\Hardening’ folder. Re-run the installation again and the installation should complete successfully.
Also, note the series of errors is reported because the script to ‘Block-IEDevTools’ is part of the ‘AfterHardening’ stage which is part of the ‘InstallIt’ function and this is all within the Execute-Stage.ps1 script.