-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDisable-WindowsFastBoot.ps1
More file actions
53 lines (50 loc) · 1.47 KB
/
Disable-WindowsFastBoot.ps1
File metadata and controls
53 lines (50 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<#
Note: I found this somewhere, not sure where. It was not written by me.
.SYNOPSIS
Disable Windows Fast Boot, also known as Hiberboot or Fast Startup.
.DESCRIPTION
Disable Windows Fast Boot, also known as Hiberboot or Fast Startup.
.EXAMPLE
No parameter needed.
Disables Windows Fast Boot
.OUTPUTS
None
.NOTES
Minimum OS Architecture Supported: Windows 10, Windows Server 2016
Release Notes:
Initial Release
#>
[CmdletBinding()]
param ()
begin {
function Test-IsElevated {
$id = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$p = New-Object System.Security.Principal.WindowsPrincipal($id)
$p.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)
}
}
process {
if (-not (Test-IsElevated)) {
Write-Error -Message "Access Denied. Please run with Administrator privileges."
exit 1
}
$Path = "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power"
$Name = "HiberbootEnabled"
$Value = "0"
try {
if (-not $(Test-Path $Path)) {
New-Item -Path $Path -Force | Out-Null
New-ItemProperty -Path $Path -Name $Name -Value $Value -PropertyType DWord -Force | Out-Null
}
else {
New-ItemProperty -Path $Path -Name $Name -Value $Value -PropertyType DWord -Force | Out-Null
}
}
catch {
Write-Error $_
Write-Host "Failed to disable Fast Boot."
exit 1
}
exit 0
}
end {}