mirror of
https://gitlab.com/JKANetwork/powerfulcomputermanager.git
synced 2026-02-26 06:53:43 +01:00
Fixed bugs, new options for cooks
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
# Build 7
|
||||
# Build 8
|
||||
param([Int32]$startup=0)
|
||||
Write-Host $startup
|
||||
$root = $PSCommandPath | Split-Path -Parent
|
||||
$server = (Get-Content "$root\configpcm.ini" | select -Skip 1 | ConvertFrom-StringData).server
|
||||
$resources = (Get-Content "$root\configpcm.ini" | select -Skip 1 | ConvertFrom-StringData).resources
|
||||
@@ -9,12 +11,12 @@ $UUID=(get-wmiobject Win32_ComputerSystemProduct).UUID
|
||||
|
||||
$exists = Invoke-RestMethod -Method Get -Uri "$server/get/computerexists?ComputerName=$computerName&UUID=$UUID"
|
||||
if ($exists.Result -eq "ERROR"){
|
||||
if ($exists.EXITCODE -eq '3'){
|
||||
Write-Host "Computer outside database:" $computerName
|
||||
}else{
|
||||
Write-Host "Computer and UUID of $computerName doesn't match"
|
||||
}
|
||||
exit
|
||||
if ($exists.EXITCODE -eq '3'){
|
||||
Write-Host "Computer outside database:" $computerName
|
||||
}else{
|
||||
Write-Host "Computer and UUID of $computerName doesn't match"
|
||||
}
|
||||
exit
|
||||
}
|
||||
|
||||
$Timestamp = [int64](([datetime]::UtcNow)-(get-date "1/1/1970")).TotalSeconds
|
||||
@@ -22,8 +24,8 @@ $Timestamp = [int64](([datetime]::UtcNow)-(get-date "1/1/1970")).TotalSeconds
|
||||
$SOData = Get-CimInstance Win32_OperatingSystem
|
||||
$SOVersion = $SOData.Version
|
||||
if ($SOVersion -match "^10.0."){ #If its Windows 10, add revision number for knowing hotfix installed
|
||||
$revi = -join(".",(Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion' UBR).UBR)
|
||||
$SOVersion += $revi
|
||||
$revi = -join(".",(Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion' UBR).UBR)
|
||||
$SOVersion += $revi
|
||||
}
|
||||
|
||||
# Update Computer Data
|
||||
@@ -44,6 +46,11 @@ foreach ($CookName in $cooks){
|
||||
$cook = Invoke-RestMethod -Method Get -Uri "$server/load/cook?CookName=$CookName&ComputerName=$computerName&UUID=$UUID"
|
||||
Write-Host "Receta:" $cook.name
|
||||
$CookRevision = $cook.revision
|
||||
$atstartup = $cook.atstartup
|
||||
if ($atstartup -eq 1 -and $startup -ne 1){ # If script has to tun at startup of computer, and there is not this moment..
|
||||
Write-Host "Se salta ya que no esta arrancando/apagandose el equipo..."
|
||||
continue # Go for next
|
||||
}
|
||||
$err = 0
|
||||
$exit = 0
|
||||
$inif = $false
|
||||
@@ -119,9 +126,9 @@ foreach ($CookName in $cooks){
|
||||
}
|
||||
$filesCopied.Add($param) > $null #Add to list
|
||||
}
|
||||
"REMOVE" { # Remove files / folders
|
||||
Remove-Item "$param" -Recurse -Force -ErrorAction Continue # They not see errors (Because error will be file not found)
|
||||
}
|
||||
"REMOVE" { # Remove files / folders
|
||||
Remove-Item "$param" -Recurse -Force -ErrorAction Continue # They not see errors (Because error will be file not found)
|
||||
}
|
||||
"INSTALLMSI" { # Installs a .msi file (From $env:temp)
|
||||
Start-Process msiexec.exe -Wait -ArgumentList "/norestart /quiet /I $param" -ErrorVariable errvar
|
||||
if ($? -eq $false){ # Error in MSI
|
||||
@@ -134,8 +141,8 @@ foreach ($CookName in $cooks){
|
||||
$err = 1
|
||||
}
|
||||
}
|
||||
"MSG" { # Display a message
|
||||
msg * "$param"
|
||||
"MSG" { # Display a message
|
||||
msg * "$param"
|
||||
}
|
||||
{$_ -in "SLEEP","PAUSE"}{ # Pause exec some seconds
|
||||
[int]$secs = $param
|
||||
|
||||
Reference in New Issue
Block a user