During one of my latest Windows Health Analysis, I had some systems fail the Boot Optimization Completion task. The specific reason for the rule failure was a registry key the test didn’t understand.
Utilizing iVanti’s Endpoint Manager (formerly LDMS) I added two registry keys to my custom inventory and created reports\queries to show me the output for the health of the enterprise as a whole. The two registry keys I was monitoring are:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Dfrg\BootOptimizeFunction\OptimizeComplete
and
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Dfrg\BootOptimizeFunction\OptimizeError
Overall the environment was healthy, but about 130 devices came back with a “Missing Registry Entries” in the OptimizeError key value. MS didn’t provide any valuable data to me as to what this could mean. Instead they suggested I run xbootmgr.exe -trace Boot -prepSystem and then see if it fixed the issue, which it didn’t.
To resolve the issue, we used iVanti’s Endpoint Manager to push out a distribution task that resolve the issue using the steps below. To simplify, especially for those not fortunate enough to be using Endpoint Manager, I’ve combined the commands in PowerShell below.
<# Step 1: Ensure Superfetch Service is started #> Start-Service "Superfetch" <# Step 2: Force Idle Tasks to run (This normally occurs about every 3 days) #> Start-Process -wait "C:\Windows\System32\Rundll32.exe" "advapi32.dll,ProcessIdleTasks" <# Step 3: Wait for 20 minutes. This is a rough estimation on how long the above will process. It could take anywhere from 10-60 minutes. You can adjust this as needed or simply hit most of the devices and let the normal processes continue to run its course. The time is in seconds. #> Start-Sleep -s 1200 <# Step 4: Run the degrag with the /B option #> Start-Process -wait "C:\Windows\System32\defrag.exe" "/B"