Changes to web gui and fixes

This commit is contained in:
2020-07-03 18:37:34 +02:00
parent 609d821501
commit 3deb367e89
9 changed files with 94 additions and 25 deletions

View File

@@ -1,4 +1,4 @@
# Build 14. Using API 2
# Build 15. Using API 2
param([Int32]$startup=0)
#Write-Host $startup
$srcdir = $PSCommandPath | Split-Path -Parent
@@ -48,7 +48,7 @@ if ($SOVersion -match "^10.0."){ #If its Windows 10, add revision number for kno
}
# Update Computer Data
$CPUInfo = (Get-CimInstance Win32_Processor) | Select Name,MaxClockSpeed,ThreadCount
$CPUInfo = (Get-CimInstance Win32_Processor) | Select-Object Name,MaxClockSpeed,ThreadCount
$CPUName = -join($CPUInfo.ThreadCount, " x ",$CPUInfo.Name.Trim()," (",$CPUInfo.MaxClockSpeed," MHz)")
$RAMInstalled = Get-CimInstance CIM_PhysicalMemory | Measure-Object -Property capacity -Sum | ForEach-Object {[math]::round(($_.sum / 1MB),2)}
$RAMFree = [Math]::Round((Get-CimInstance Win32_OperatingSystem).FreePhysicalMemory/1024,0)
@@ -58,7 +58,7 @@ $objDisks = Get-CimInstance -Class win32_LogicalDisk -Filter "DriveType = '3'"
$diskResults = @()
ForEach( $disk in $objDisks )
{
$ThisVolume = "" | select Volume,Capacity,FreeSpace
$ThisVolume = "" | Select-Object Volume,Capacity,FreeSpace
$ThisVolume.Volume = $disk.DeviceID
$ThisVolume.Capacity = $([Math]::Round($disk.Size / 1GB,2))
$ThisVolume.FreeSpace = $([Math]::Round($disk.FreeSpace / 1GB,2))
@@ -104,6 +104,7 @@ foreach ($CookName in $cooks){
if ($err -eq 1 -or $exit -eq 1){break} # Halt if err ocurred (And noerror directive is not active)
$step = $step.Split("|")
$param = $step[1]
$param2 = $step[2]
Write-Host $step[0] "-" $step[1]
if($inif -eq $true -and $if -eq $false){ # Only can see "ENDIF" if is in IF and is not true
if ($step[0] -ne "ENDIF" -and $step[0] -ne "ELSE"){
@@ -168,6 +169,22 @@ foreach ($CookName in $cooks){
$err = 1
}
$filesCopied.Add($param) > $null #Add to list
}
"COPY" { # Copy file from repo location to some folder
$parts = $param.Split(";")
if ($parts[1] -ne ""){ #Exists orig and dest
$orig=$parts[0]
$dest=$parts[1]
Copy-Item "$orig" "$dest" -ErrorVariable errvar -Recurse -Force
if ($? -eq $false){ # Error in Copy
$err = 1
}
}else{ #Doesn't sent right
$err = 1
$errvar = "Param not set right. Exiting..."
}
}
"REMOVE" { # Remove files / folders
Remove-Item "$param" -Recurse -Force -ErrorAction Continue # They not see errors (Because error will be file not found)