Skip to content

Instantly share code, notes, and snippets.

@HBIDamian
Last active October 2, 2025 10:30
Show Gist options
  • Select an option

  • Save HBIDamian/ee2d5c0d29e3df8e3d60542f6469dd5d to your computer and use it in GitHub Desktop.

Select an option

Save HBIDamian/ee2d5c0d29e3df8e3d60542f6469dd5d to your computer and use it in GitHub Desktop.
Run Down Installer for PocketMine-MP (PowerShell).
$host.ui.RawUI.WindowTitle = "Run Down PocketMine-MP Installer"
$WebClient = New-Object System.Net.WebClient
# Setting this to true will delete all files in the current directory.
# Setting this to false will replace specific files in the current directory with the latest versions.
$global:FreshInstallMode = $false
# Change this to the version of PHP and PocketMine-MP you want to install.
$global:PHPVer = "8.3"
$global:PMMPVer = "PM5"
if ($global:PMMPVer -eq "PM6") {
$global:PMMPURL = "https://update.pmmp.io/api?channel=alpha"
}
elseif ($global:PMMPVer -eq "PM5") {
$global:PMMPURL = "https://update.pmmp.io/api?channel=5"
}
elseif ($global:PMMPVer -eq "PM4") {
$global:PMMPURL = "https://update.pmmp.io/api?channel=4"
} else {
$global:PMMPURL = "https://update.pmmp.io/api?channel=stable"
}
function Pre-Script {
Splash-Text
Write-Host "Run Down PocketMine-MP Installer:" -foreground "Magenta" -NoNewline; Write-Host " Made by HBIDamian" -foreground "DarkCyan"
Write-Host "This is a very hacky way of installing PocketMine-MP." -foreground "DarkMagenta"
Write-Host "It's not really recommended to use it for production." -foreground "DarkRed"
Write-Host ""
if ($global:FreshInstallMode -eq $true) {
Write-Host "FreshInstallMode:" -foreground "White" -NoNewline; Write-Host " True" -foreground "Yellow"
} else {
Write-Host "FreshInstallMode:" -foreground "White" -NoNewline; Write-Host " False" -foreground "DarkYellow"
}
Read-Host -Prompt "Press Enter to continue"
clear-host
Start-Script
}
function Splash-Text {
Write-Host " _____________________ ________ " -foreground "Red"
Write-Host " | ___ \ _ \ ___ \ \/ |_ _| " -foreground "DarkYellow"
Write-Host " | |_/ / | | | |_/ / . . | | | " -foreground "Yellow"
Write-Host " | /| | | | __/| |\/| | | | " -foreground "Green"
Write-Host " | |\ \| |/ /| | | | | |_| |_ " -foreground "DarkCyan"
Write-Host " \_| \_|___/ \_| \_| |_/\___/ " -foreground "Magenta"
Write-Host ""
}
function Get-Time-Stamp {
Write-Host "[$((Get-Date -Format 'HH:mm:ss:fff'))] " -foreground "White" -NoNewline
}
function Download-File {
param(
[string]$url,
[string]$destination
)
Get-Time-Stamp; Write-Host "[INFO]: Downloading $url..." -foreground "Cyan"
$WebClient.DownloadFile($url, $destination)
if (!(Test-Path $destination)) {
Get-Time-Stamp; Write-Warning "[ERROR]: Absent File: $destination. Aborting." -foreground "Red"
Read-Host -Prompt "Press Enter to exit"
exit
} else {
Get-Time-Stamp; Write-Host "[SUCCESS]: Downloaded $destination" -foreground "Green"
}
}
function Start-Script {
Splash-Text
Get-Time-Stamp; Write-Host "[INFO]: Detecting and killing active PocketMine-MP Servers" -foreground "Cyan"
$PMMPProcess = Get-Process -Name "php" -ErrorAction SilentlyContinue
if ($PMMPProcess) {
$PMMPProcess | Stop-Process -Force -ErrorAction SilentlyContinue
$PMMPProcess.WaitForExit()
Get-Time-Stamp; Write-Host "[SUCCESS]: Killed any running PocketMine-MP servers." -foreground "Green"
} else {
Get-Time-Stamp; Write-Host "[INFO]: No PocketMine-MP servers running." -foreground "Cyan"
}
if ($global:FreshInstallMode -eq $true) {
try {
Get-Time-Stamp; Write-Host "[INFO]: Removing all files in current directory..." -foreground "Cyan"
$ScriptName = $MyInvocation.ScriptName.Split("\")[-1]
Get-ChildItem -Path .\ -Exclude $ScriptName | Remove-Item -Recurse -Force -ErrorAction Stop
Get-Time-Stamp; Write-Host "[SUCCESS]: All Files removed successfully." -foreground "Green"
} catch {
Get-Time-Stamp; Write-Host "[ERROR]: An error occurred: $($_.Exception.Message)" -foreground "Red"
}
} else {
try {
Get-Time-Stamp; Write-Host "[INFO]: Removing specific files in current directory..." -foreground "Cyan"
Remove-Item -Path .\bin -Recurse -Force -ErrorAction Stop
Remove-Item -Path .\vc_redist.x64.exe -Force -ErrorAction Stop
Remove-Item -Path .\PocketMine-MP.phar -Force -ErrorAction Stop
Remove-Item -Path .\start.cmd -Force -ErrorAction Stop
Remove-Item -Path .\start.ps1 -Force -ErrorAction Stop
Get-Time-Stamp; Write-Host "[SUCCESS]: Files removed successfully." -foreground "Green"
} catch {
Get-Time-Stamp; Write-Host "[ERROR]: An error occurred: $($_.Exception.Message)" -foreground "Red"
}
}
Get-Time-Stamp; Write-Host "[INFO]: Downloading Binary files..." -foreground "Cyan"
Download-File -url "https://github.com/pmmp/PHP-Binaries/releases/download/$($global:PMMPVer.toLower())-php-$($global:PHPVer)-latest/PHP-$($global:PHPVer)-Windows-x64-$($global:PMMPVer).zip" -destination "./PHP-$($global:PHPVer)-Windows-x64-$($global:PMMPVer).zip"
Get-Time-Stamp; Write-Host "[INFO]: Expanding the archive..." -foreground "Cyan"
Expand-Archive "./PHP-$($global:PHPVer)-Windows-x64-$($global:PMMPVer).zip" -DestinationPath ./
Get-Time-Stamp; Write-Host "[INFO]: Removing the archive..." -foreground "Cyan"
remove-Item "./PHP-$($global:PHPVer)-Windows-x64-$($global:PMMPVer).zip"
Get-Time-Stamp; Write-Host "[INFO]: Checking if php.exe exists from archive..." -foreground "Cyan"
if (!(Test-Path "./bin/php/php.exe")) {
Write-Warning "[ERROR]: Absent File. Aborting." -foreground "Red"
Read-Host -Prompt "Press Enter to exit"
exit
}
Get-Time-Stamp; Write-Host "[INFO]: Downloading latest PocketMine-MP.phar..." -foreground "Cyan"
$getPhar = Invoke-RestMethod $global:PMMPURL
Download-File -url $getPhar.download_url -destination "./PocketMine-MP.phar"
Download-File -url "https://raw.githubusercontent.com/pmmp/PocketMine-MP/stable/start.cmd" -destination "./start.cmd"
Download-File -url "https://raw.githubusercontent.com/pmmp/PocketMine-MP/stable/start.ps1" -destination "./start.ps1"
Get-Time-Stamp; Write-Host "[SUCCESS]: Install Complete. You may now use 'start.cmd' or 'start.ps1'" -foreground "Green"
Write-Host ""
powershell.exe .\start.ps1
Read-Host -Prompt "Press Enter to exit"
}
Pre-Script
@HBIDamian
Copy link
Copy Markdown
Author

I changed the name, and made it more cancerous. :D
I also realise it doesn't display the "custom errors" properly. Good. :D

@HBIDamian
Copy link
Copy Markdown
Author

Updated.

  • Made it more readable
  • Made it easily editable (with global variables)

Note: When PM5 is released, it may not install the stable version and may require an update to the script.

@HBIDamian
Copy link
Copy Markdown
Author

Updated

  • Rest in piece, Jenkins. Everyone's favourite butler.

@HBIDamian
Copy link
Copy Markdown
Author

Updated

  • Added this.
# Setting this to true will delete all files in the current directory.
# Setting this to false will replace specific files in the current directory with the latest versions.
$global:FreshInstallMode = $false

Makes it easier for testing shit.

  • Less green. Green is for success. Cyan is for info.

@HBIDamian
Copy link
Copy Markdown
Author

Updated again: Changelog:

https://media.tenor.com/GRTXRs7czmcAAAAM/austin-powers-i-am-sexy-and-i-know-it.gif

@HBIDamian
Copy link
Copy Markdown
Author

Updated again to fit the current Bin location

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment