Update check-cpu.ps1, check-os.ps1, and install-powershell.ps1

This commit is contained in:
Markus Fleschutz 2022-12-28 12:21:15 +01:00
parent 141a867b06
commit 17d4839150
3 changed files with 33 additions and 5 deletions

View File

@ -46,7 +46,17 @@ try {
} }
if ($IsLinux) { if ($IsLinux) {
"$Status CPU has $Temp" $Name = $PSVersionTable.OS
if ($Name -like "*-generic *") {
$Arch = "x86"
} elseif ($Name -like "*-raspi *") {
$Arch = "ARM"
} else {
$Arch = ""
}
if ([System.Environment]::Is64BitOperatingSystem) { $Bits = "64-bit" } else { $Bits = "32-bit" }
$Cores = [System.Environment]::ProcessorCount
"$Status $Arch CPU $Bits ($Cores cores, $Temp)"
} else { } else {
$Details = Get-WmiObject -Class Win32_Processor $Details = Get-WmiObject -Class Win32_Processor
$CPUName = $Details.Name.trim() $CPUName = $Details.Name.trim()

View File

@ -13,7 +13,9 @@
try { try {
if ($IsLinux) { if ($IsLinux) {
"$(uname -sr)" $Name = $PSVersionTable.OS
if ([System.Environment]::Is64BitOperatingSystem) { $Bits = "64-bit" } else { $Bits = "32-bit" }
"$Name ($Bits)"
} else { } else {
$OS = Get-WmiObject -class Win32_OperatingSystem $OS = Get-WmiObject -class Win32_OperatingSystem
$Name = $OS.Caption -Replace "Microsoft Windows","Windows" $Name = $OS.Caption -Replace "Microsoft Windows","Windows"

View File

@ -113,7 +113,7 @@ function Expand-ArchiveInternal {
} }
} }
Function Remove-Destination([string] $Destination) { function Remove-Destination([string] $Destination) {
if (Test-Path -Path $Destination) { if (Test-Path -Path $Destination) {
if ($DoNotOverwrite) { if ($DoNotOverwrite) {
throw "Destination folder '$Destination' already exist. Use a different path or omit '-DoNotOverwrite' to overwrite." throw "Destination folder '$Destination' already exist. Use a different path or omit '-DoNotOverwrite' to overwrite."
@ -196,7 +196,8 @@ function Test-PathNotInSettings($Path) {
Must be either User or Machine Must be either User or Machine
Defaults to User Defaults to User
#> #>
Function Add-PathTToSettings {
function Add-PathTToSettings {
[CmdletBinding()] [CmdletBinding()]
param( param(
[Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] [Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)]
@ -246,7 +247,22 @@ Function Add-PathTToSettings {
$Key.SetValue("PATH", $NewPathValue, $PathValueKind) $Key.SetValue("PATH", $NewPathValue, $PathValueKind)
} }
if (-not $IsWinEnv) { if ($IsLinux) {
$Name = $PSVersionTable.OS
if ($Name -like "*-generic *") {
if ([System.Environment]::Is64BitOperatingSystem) {
$architecture = "x64"
} else {
$architecture = "x86"
}
} elseif ($Name -like "*-raspi *") {
if ([System.Environment]::Is64BitOperatingSystem) {
$architecture = "arm64"
} else {
$architecture = "arm32"
}
}
} elseif (-not $IsWinEnv) {
$architecture = "x64" $architecture = "x64"
} elseif ($(Get-ComputerInfo -Property OsArchitecture).OsArchitecture -eq "ARM 64-bit Processor") { } elseif ($(Get-ComputerInfo -Property OsArchitecture).OsArchitecture -eq "ARM 64-bit Processor") {
$architecture = "arm64" $architecture = "arm64"