Skip to content

Commit

Permalink
Added if to prevent it from running on non-windows systems
Browse files Browse the repository at this point in the history
  • Loading branch information
herrwinfried committed May 30, 2024
1 parent 4cc6214 commit a14cc28
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions installer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,27 @@ param(
$GetScriptDir = $PSScriptRoot
[string]$GetScriptName = [System.IO.Path]::GetFileNameWithoutExtension($MyInvocation.MyCommand.Name)

Function Test-CommandExists {
Param ($command)
$oldPreference = $ErrorActionPreference

$ErrorActionPreference = "stop"
try { if (Get-Command $command) { return $True } }

Catch { return $False }

Finally { $ErrorActionPreference = $oldPreference }
}

function Test-isWindows {
if ((-Not (Test-CommandExists Get-WmiObject)) -or ($IsLinux) -or ($IsMacOS)) {
Write-Host -ForegroundColor Red "This powershell script is designed to be used on windows. Please check your operating system."
Exit 1;
}
}

Test-isWindows

# Language support
if (-Not ($Lang)) { $Lang = $PSUICulture }
$GetLanguageFile = "$PSScriptRoot/lang/$Lang/$GetScriptName.psd1"
Expand Down

0 comments on commit a14cc28

Please sign in to comment.