This is a small script that makes changes to the registry that will disable the fast startup feature on Windows 10. This feature can cause potential issues as when a user shuts down their computer with this enabled the computer will go into a sleep/hibernation state instead of powering off as expected.
Additionally this script takes advantage of my logging module.
<#
.SYNOPSIS
Changes registry value to disable Windows 10 fast startup
.DESCRIPTION
Developer: Mike Polselli
PSVersion: 5.0
Date: 8-10-2018
Language: PowerShell
Purpose: Windows 10 Fast Startup prevents the computer from fully shutting down when a shutdown is initiated.
.PARAMETER Help
Displays helpful information about the script.
.EXAMPLE
.\DisableWin10FastStartup.ps1 -Help
#>
### Parameters ###
param (
[switch]$Help
)
if ($Help) {
Get-Help $MyInvocation.MyCommand.Definition -Full | more
exit 0
}
### Parameters ###
### Variables ###
$ScriptName = 'DisableWin10FastStartup'
$RegKeyPath = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power'
$RegPropertyName = 'HiberbootEnabled'
$RegKeyValue = 0
Clear-Variable GetValue -ErrorAction SilentlyContinue
### Variables ###
### Functions ###
function CheckRegKey {
try {
$Script:GetValue = Get-ItemPropertyValue -Path $RegKeyPath -Name $RegPropertyName -ErrorAction Stop
}
catch {
Write-Log "Error finding Registry Key Property - $RegKeyPath and $RegPropertyName"
Stop-Log -ScriptName $ScriptName
exit 1
}
}
function CheckHiberboot {
if ($GetValue -eq 0) {
Write-Log "$RegPropertyName is already set to $RegKeyValue. Exiting script."
Stop-Log -ScriptName $ScriptName
exit 0
}
else {
Write-Log "Updating $RegPropertyName to $RegKeyValue."
Set-ItemProperty -Path $RegKeyPath -Name $RegPropertyName -Value $RegKeyValue
}
}
### Functions ###
### Script ###
<# Used for logging, always the first function to run.#>Start-Log -ScriptName $ScriptName
CheckRegKey
CheckHiberboot
<# Used for logging, always the last function to run.#>Stop-Log -ScriptName $ScriptName
### Script ###