Whenever Windows detects irregularities with storage drives, it enables an automatic integrity check. For system partitions, on next boot, Windows shows a user prompt and asks for permission to perform the check.

To find out all drives that are enabled for this kind of check, run this:

PS> Get-CimInstance -ClassName Win32_AutochkSetting | Select-Object -Property SettingID, UserInputDelay

SettingID                                                        UserInputDelay
---------                                                        --------------
Microsoft Windows 10 Pro|C:\Windows|\Device\Harddisk0\Partition3              8 

The UserInputDelay property specifies the seconds Windows will wait for the user prompt at boot time. If a user won’t respond by then, the disk integrity check will be performed automatically.

WMI can change this setting. If you’d like to increase the delay to 20 seconds, run this line with Administrator privileges:

Set-CimInstance -Query "Select * From Win32_AutochkSetting" -Property @{UserInputDelay=20}

Note that this command sets the UserInputDelay for all supported disk drives. To set it only for selected drives, refine the submitted query, and add a filter, for example:

Set-CimInstance -Query 'Select * From Win32_AutochkSetting Where SettingID LIKE "%\\Device\\Harddisk0\\Partition3"' -Property @{UserInputDelay=30} 

For more information on WMI queries, visit http://powershell.one/wmi/wql.

PowerShell Conference Europe (psconf.eu) opens June 2, 2020, in Hannover, Germany, and you can be part of it! 4 days, 3 tracks, 80 PowerShell sessions, and 40 renown speakers from around the world (including PowerShell inventor Jeffrey Snover, the PowerShell team with Steve Lee, the Amazon AWS team, and many more) are waiting for questions and discussions, providing authoritative firsthand information, tips and guidance for professional PowerShell scripters.

Find out more at http://powershell.one/psconfeu/psconf.eu-2020/about, download the mobile app with sessions and speakers at http://psconfeu.sessionize.com/, and secure your seat at https://psconf.eu/register.html.

Twitter This Tip! ReTweet this Tip!