pwsh install script admin & version check
This commit is contained in:
commit
43139557af
1 changed files with 19 additions and 0 deletions
19
bin/install.ps1
Normal file
19
bin/install.ps1
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/usr/bin/pwsh
|
||||||
|
|
||||||
|
# check administration role
|
||||||
|
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
|
||||||
|
$bool_admin = $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
|
||||||
|
if (!$bool_admin) {
|
||||||
|
Write-Warning -Message "require Admin privilage
|
||||||
|
please run as Administrator"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# check pwsh version
|
||||||
|
# ≧ 7
|
||||||
|
if ($PSVersionTable.PSVersion.Major -lt 7) {
|
||||||
|
Write-Warning -Message "pwsh version must be greater than 7
|
||||||
|
please install powershell 7 (Core)
|
||||||
|
you can install via winget"
|
||||||
|
exit 1
|
||||||
|
}
|
Loading…
Reference in a new issue