Upload files to "Microsoft"
This commit is contained in:
parent
043ae144d4
commit
c75ba981cf
55
Microsoft/Disable_Fast_Startup.ps1
Normal file
55
Microsoft/Disable_Fast_Startup.ps1
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
# Script by Timur@0x01337.com
|
||||||
|
# Date: 2023-11-24
|
||||||
|
<#
|
||||||
|
.DESCRIPTION
|
||||||
|
Disables the Fast Startup feature.
|
||||||
|
|
||||||
|
Requires administrator privileges.
|
||||||
|
|
||||||
|
.PARAMETER help
|
||||||
|
Displays a detailed usage description of this script.
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
PS> .\Disable-Fast-Startup.ps1
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
PS> .\Disable-Fast-Startup.ps1 -help
|
||||||
|
#>
|
||||||
|
|
||||||
|
# Getting command line parameters
|
||||||
|
param (
|
||||||
|
[parameter(Mandatory = $false)][switch]$help
|
||||||
|
)
|
||||||
|
|
||||||
|
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
|
||||||
|
$isAdmin = $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
|
||||||
|
if (!$isAdmin) {
|
||||||
|
Write-Error "This script requires administrator privileges"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Writing help message
|
||||||
|
if ($help) {
|
||||||
|
get-help $MyInvocation.MyCommand.Path -Full
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
$command = "powercfg"
|
||||||
|
$arguments = "/H off"
|
||||||
|
|
||||||
|
Write-Host "Running $command $arguments"
|
||||||
|
try {
|
||||||
|
$process = Start-Process -Wait -PassThru -NoNewWindow -FilePath $command -ArgumentList $arguments
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Error "Error: $_, exit code: $($process.ExitCode)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$process -or $process.ExitCode -ne 0) {
|
||||||
|
Write-Error "$command $arguments failed, exit code: $($process.ExitCode)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "$command $arguments finish, exit code: $($process.ExitCode)"
|
||||||
|
exit 0
|
||||||
Loading…
Reference in a new issue