Created
September 24, 2019 08:56
-
-
Save divanvisagie/b60d35889d0adb1ba3e468e646f221fd to your computer and use it in GitHub Desktop.
Powershell Script To Install Mountebank
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Write-Host "Mountebank Installer" | |
if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { | |
Write-Warning "This setup needs admin permissions. Please run this file as admin." | |
break | |
} | |
### Version Check | |
if (Get-Command node -ErrorAction SilentlyContinue) { | |
Try | |
{ | |
$current_version = (node -v) | |
} | |
Catch | |
{ | |
Write-Host "No nodejs version found" | |
$current_version = 0 | |
} | |
} | |
Write-Host "Node is installed: $current_version" | |
if ($current_version -eq 0) { | |
Write-Warning "Please install node from https://nodejs.org/en/" | |
} else { | |
Write-Host "Checking for Mountebank" | |
Try | |
{ | |
$mountebank = (mb --version) | |
Write-Host "Mountebank $mountebank is already installed" | |
} | |
Catch | |
{ | |
Write-Host "Install Mountebank" | |
npm i -g mountebank | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment