Forum Discussion
Baseline throws a silent error. Suggestion for a quick fix in BaselineLocalInstall.ps1
Hi,
the BaselineLocalInstall.ps1 in SCT 1.0 for Server 2019 throws a silent error under certain circumstances that is added to the error variable. Responsible is line 147:
if ($null -eq (Get-Command LGPO.exe -ErrorAction SilentlyContinue))
When the script runs successful, this is the only error in $Error. Since $Error is currently the only way to check whether the baseline script ran successful or not, this causes an issue.
The fix is simple, however. Please replace the error action with Ignore.
if ($null -eq (Get-Command LGPO.exe -ErrorAction Ignore))
This acts like SilentlyContinue but does not add the error to the $Error variable, and if the script ran successful $Error will be empty.
11 Replies
- DanielNiccoliIron Contributor
Also pinging Rick_Munck for that to see.
- AaronMargosis_TaniumIron Contributor
DanielNiccoli Rick_Munck - that change makes sense to me. Good idea - thanks.
- Rick_Munck
Microsoft
DanielNiccoli we greatly appreciate the suggestion and will make the change in the Final 20H2 package we are planning to release towards the middle of the month!