mirror of
https://gitlab.com/JKANetwork/powerfulcomputermanager.git
synced 2026-12-06 02:58:17 +01:00
Latest version we had of PCM
This commit is contained in:
1 parent
e8e0b269cf
commit
2bf1f3312f
7 files changed
+185
-54
No files matched your search
+27
-10
@@ -12,7 +12,7 @@ from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
||||
|
||||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||
|
||||
BUILD=2
|
||||
BUILD=3
|
||||
APIC_VER=2
|
||||
|
||||
# Load config to comunicate with API or use default
|
||||
@@ -127,13 +127,19 @@ def pAdminComputer(): #Admin see one group
|
||||
|
||||
computerid=request.args.get('ID_C')
|
||||
if computerid is not None and computerid.isnumeric():
|
||||
computername = returnvalueapi('/get/computers?ComputerID='+str(computerid),"Name")
|
||||
compdata = returnTable("/get/computers?ComputerID="+str(computerid),['ID_C','Name','RAM','CPUName','SOVersion','SOCaption','HDD','InstalledSoftware','RAMFree'])[0]
|
||||
groups = returnTable("/get/groups?ComputerID="+str(computerid),['ID_G','Name'])
|
||||
for key in range(len(groups)): #Cookgs of every group
|
||||
groups[key].append(returnTable("/get/cookgrp?GroupID="+groups[key][0],['CookName']))
|
||||
|
||||
allgroups = returnTable("/get/groups",['ID_G','Name']) #All groups, for adding one
|
||||
return render_template('/admincomputer.tmpl', title="Computer "+computername,computerid=computerid,computername=computername,groups=groups,allgroups=allgroups)
|
||||
|
||||
try:
|
||||
instsoftware=json.loads(base64.b64decode(compdata[7]).decode('UTF-8'))
|
||||
except:
|
||||
instsoftware=json.loads(str("{}"))
|
||||
|
||||
return render_template('/admincomputer.tmpl', title="Computer "+compdata[1],computerid=computerid,computername=compdata[1],groups=groups,allgroups=allgroups,instsoftware=instsoftware)
|
||||
return redirect('/admin')
|
||||
|
||||
|
||||
@@ -191,17 +197,17 @@ def pAdminGroup(): #Admin see one group
|
||||
if groupid is not None and str(groupid).isnumeric():
|
||||
groupname=returnvalueapi('/get/groups?GroupID='+str(groupid),"Name")
|
||||
computers = returnTable("/get/computers",['ID_C','Name'])
|
||||
datagroup = (returnTable("/get/computersgrp?GroupID="+groupid,['ID_C','Name'])) #lista[0]¿
|
||||
tem = (returnTable("/get/cookgrp?GroupID="+groupid,['CookName'])) #lista[1]¿
|
||||
datagroup = (returnTable("/get/computersgrp?GroupID="+str(groupid),['ID_C','Name'])) #lista[0]¿
|
||||
tem = (returnTable("/get/cookgrp?GroupID="+str(groupid),['CookName'])) #lista[1]¿
|
||||
cooksdata = []
|
||||
for cook in tem:
|
||||
to = []
|
||||
to.append(cook[0])
|
||||
to.append(int(returnvalueapi('/get/lastrevisioncook?CookName='+cook[0],"Revision"))) # Has to be a number
|
||||
tabletemp = returnTable("/get/statuscook?CookName="+cook[0],'ASIS')
|
||||
print (tabletemp)
|
||||
to.append(int(returnvalueapi('/get/lastrevisioncook?CookName='+str(cook[0]),"Revision"))) # Has to be a number
|
||||
tabletemp = returnTable("/get/statuscook?CookName="+str(cook[0]),'ASIS')
|
||||
#print (tabletemp)
|
||||
for x in range(len(tabletemp)):
|
||||
print(type(tabletemp[x]['Revision']))
|
||||
#print(type(tabletemp[x]['Revision']))
|
||||
if type(tabletemp[x]['Revision']) != int: # Si no es un número, cambiar.
|
||||
tabletemp[x]['Revision'] = 0
|
||||
to.append(tabletemp)
|
||||
@@ -258,6 +264,17 @@ def pAdminGroupDelcomputer(): #Add computer form enter
|
||||
else:
|
||||
return redirect('/admin/group?ID_G='+groupid)
|
||||
|
||||
@app.route("/admin/group/delgroup",methods=['GET'])
|
||||
def pAdminGroupDelgroup(): #Delete group
|
||||
groupid=request.args.get('groupid')
|
||||
if groupid != None:
|
||||
r = returnvalueapi("/del/group?GroupID="+groupid,field="RESULT")
|
||||
if r == "OK":
|
||||
return redirect('/admin/groups')
|
||||
else:
|
||||
return redirect('/admin/group?ID_G='+groupid)
|
||||
else:
|
||||
return redirect('/admin/group?ID_G='+groupid)
|
||||
|
||||
@app.route("/admin/cook",methods=['GET'])
|
||||
def pAdminCook(): #Admin Index groups
|
||||
@@ -340,4 +357,4 @@ def pLogin(): #Login
|
||||
print("Build: "+str(BUILD))
|
||||
print("API Client Compatible Version: "+str(APIC_VER))
|
||||
|
||||
app.run(debug=True,port=3434,ssl_context='adhoc',host='0.0.0.0',threaded=True) #Default is port 3434
|
||||
app.run(debug=False,port=3434,ssl_context='adhoc',host='0.0.0.0',threaded=True) #Default is port 3434
|
||||
@@ -91,6 +91,30 @@
|
||||
</table>
|
||||
<br>
|
||||
|
||||
<h2>Installed software in {{computername}}</h2>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Application Name</th>
|
||||
<th>Version</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in instsoftware %} {#['Name','Version']#}
|
||||
<tr>
|
||||
<td>X</a></td>
|
||||
<td style='width:75%;'>{{item.0}}</td>
|
||||
<td style='width:15%;'>{{item.1}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<tr>
|
||||
<td>#</td>
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
|
||||
|
||||
<script>
|
||||
$('#delGroup').on('show.bs.modal', function (event) {
|
||||
|
||||
@@ -2,6 +2,29 @@
|
||||
{% extends 'baseadmin.tmpl' %}
|
||||
{% block content %}
|
||||
|
||||
<!-- Modal Delete Group -->
|
||||
<div class="modal fade" id="deleteGroup" tabindex="-1" role="dialog" aria-labelledby="deleteGroupLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<form method="get" action="/admin/group/delgroup">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="deleteGroupLabel">Delete Group {{groupname}}</h5>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<input type="text" readonly="readonly" class="form-control" hidden="hidden" name="groupid" id="groupid" value="{{groupid}}"/>
|
||||
<p>Are you sure? Is not reversible<br>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="submit" class="btn btn-danger">Delete {{groupname}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal Delete Computer From Group -->
|
||||
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
@@ -87,6 +110,7 @@
|
||||
|
||||
|
||||
<h2>Computers of group {{groupname}}</h2>
|
||||
<p><a class="btn btn-outline-danger btn-sm" data-toggle="modal" data-target="#deleteGroup">Delete group {{groupname}}</a></p>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-sm">
|
||||
<thead>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/python3
|
||||
BUILD = 29
|
||||
BUILD = 31
|
||||
API_VER = 2
|
||||
from flask import Flask, request
|
||||
import random
|
||||
@@ -9,10 +9,12 @@ import sql # SQL work file
|
||||
import json,yaml
|
||||
from datetime import datetime
|
||||
import base64
|
||||
from itertools import repeat
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
sqlAddComputers = sql.retOption('AddComputers')
|
||||
sqlUpdateUUID = sql.retOption('UpdateUUID')
|
||||
|
||||
def logit(text):
|
||||
text = str(text)
|
||||
@@ -29,6 +31,15 @@ def retPassword():
|
||||
except:
|
||||
return ""
|
||||
|
||||
def reqitemstovars(requestres, arglist):
|
||||
argsres=dict(zip(arglist, repeat(None)))
|
||||
for key, value in requestres.args.to_dict().items():
|
||||
#key = key.lower()
|
||||
if key in arglist:
|
||||
argsres[key] = str(value).upper().strip()
|
||||
|
||||
return argsres
|
||||
|
||||
|
||||
##
|
||||
# getComputerExists: Know if computer exists and matches UUID
|
||||
@@ -43,26 +54,28 @@ def retPassword():
|
||||
@app.route("/get/computerexists",methods=['POST'])
|
||||
def getComputerExists():
|
||||
logit(request.base_url)
|
||||
ComputerName,UUID = None, None
|
||||
for key, value in request.args.to_dict().items():
|
||||
if key == "ComputerName":
|
||||
ComputerName = value
|
||||
if key == "UUID":
|
||||
UUID = value
|
||||
valreq=reqitemstovars(request, ('ComputerName','UUID'))
|
||||
|
||||
if ComputerName is None:
|
||||
if valreq['ComputerName'] is None:
|
||||
return str({'TEXT':'No params','RESULT': 'ERROR','EXITCODE':'1'})
|
||||
else:
|
||||
result = sql.select("SELECT COUNT(*) 'RESULT' FROM COMPUTERS WHERE Name='"+ComputerName+"' AND UUID='"+UUID+"'")
|
||||
|
||||
result = sql.select("SELECT COUNT(*) 'RESULT' FROM COMPUTERS WHERE Name='"+valreq['ComputerName']+"' AND UUID='"+valreq['UUID']+"'")
|
||||
|
||||
if result[0]['RESULT'] == 0: # 0 or 1
|
||||
if sql.select("SELECT COUNT(*) 'RESULT' FROM COMPUTERS WHERE Name='"+ComputerName+"' AND UUID IS NULL")[0]['RESULT'] != 0: #UUID doesn't in database, insert it
|
||||
sql.insert("UPDATE COMPUTERS SET UUID='"+UUID+"' WHERE Name='"+ComputerName+"'")
|
||||
if sql.select("SELECT COUNT(*) 'RESULT' FROM COMPUTERS WHERE Name='"+valreq['ComputerName']+"'")[0]['RESULT'] != 0: # Computer in database, uuid not equal:
|
||||
if sql.retOption('UpdateUUID') == 'True': # Only if true.
|
||||
sql.insert("UPDATE COMPUTERS SET UUID='"+valreq['UUID']+"' WHERE Name='"+valreq['ComputerName']+"'")
|
||||
return str({'RESULT': '1'})
|
||||
elif sql.select("SELECT COUNT(*) 'RESULT' FROM COMPUTERS WHERE Name='"+ComputerName+"'")[0]['RESULT'] != 0: #Not UUID match, but computer exists
|
||||
elif sql.select("SELECT COUNT(*) 'RESULT' FROM COMPUTERS WHERE Name='"+valreq['ComputerName']+"' AND UUID IS NULL")[0]['RESULT'] != 0: #UUID doesn't in database, insert it
|
||||
sql.insert("UPDATE COMPUTERS SET UUID='"+valreq['UUID']+"' WHERE Name='"+valreq['ComputerName']+"'")
|
||||
return str({'RESULT': '1'})
|
||||
else:
|
||||
return str({'TEXT':'Error: Computer exists but bad UUID in database (MITM??)', 'RESULT': 'ERROR','EXITCODE':'3'})
|
||||
elif sql.select("SELECT COUNT(*) 'RESULT' FROM COMPUTERS WHERE Name='"+valreq['ComputerName']+"'")[0]['RESULT'] != 0: #Not UUID match, but computer exists
|
||||
return str({'TEXT': 'Error, computer and UUID doesn\'t match in database', 'RESULT': 'ERROR','EXITCODE':'2'})
|
||||
if sqlAddComputers == 'True': #Computer doesn't exist, but you have enabled add all computers
|
||||
sql.insert("INSERT INTO COMPUTERS (`Name`,`UUID`) VALUES('"+ComputerName+"','"+UUID+"')")
|
||||
sql.insert("INSERT INTO COMPUTERS (`Name`,`UUID`) VALUES('"+valreq['ComputerName']+"','"+valreq['UUID']+"')")
|
||||
return str({'RESULT': '1'})
|
||||
else: #Computer doesn't exist and you don't want to be added
|
||||
return str({'TEXT':'Error: Computer not exists in database', 'RESULT': 'ERROR','EXITCODE':'3'})
|
||||
@@ -668,25 +681,29 @@ def updComputer():
|
||||
if Count == "0":
|
||||
return str({'TEXT': 'Error, computer and UUID doesn\'t match in database','RESULT':'ERROR','EXITCODE':'2'})
|
||||
else:
|
||||
for key, value in request.args.to_dict().items():
|
||||
if key == "SOVersion":
|
||||
str(sql.insert("UPDATE COMPUTERS SET SOVersion ='"+value+"' WHERE ID_C='"+ComputerID+"'"))
|
||||
if key == "SOBit":
|
||||
str(sql.insert("UPDATE COMPUTERS SET SOBit ='"+value+"' WHERE ID_C='"+ComputerID+"'"))
|
||||
if key == "SOCaption":
|
||||
str(sql.insert("UPDATE COMPUTERS SET SOCaption ='"+value+"' WHERE ID_C='"+ComputerID+"'"))
|
||||
if key == "LastConnection":
|
||||
str(sql.insert("UPDATE COMPUTERS SET LastConnection ='"+value+"' WHERE ID_C='"+ComputerID+"'") )
|
||||
if key == "LastUser":
|
||||
str(sql.insert("UPDATE COMPUTERS SET LastUser='"+value+"' WHERE ID_C='"+ComputerID+"'"))
|
||||
if key == "RAM":
|
||||
str(sql.insert("UPDATE COMPUTERS SET RAM='"+value+"' WHERE ID_C='"+ComputerID+"'"))
|
||||
if key == "CPUName":
|
||||
str(sql.insert("UPDATE COMPUTERS SET CPUName='"+value+"' WHERE ID_C='"+ComputerID+"'"))
|
||||
if key == "RAMFree":
|
||||
str(sql.insert("UPDATE COMPUTERS SET RAMFree='"+str(value)+"' WHERE ID_C='"+ComputerID+"'"))
|
||||
if key == "HDD":
|
||||
str(sql.insert("UPDATE COMPUTERS SET HDD='"+str(value)+"' WHERE ID_C='"+ComputerID+"'"))
|
||||
jsondata=request.get_json(silent=True,force=True)
|
||||
jsondata = {str(k).upper():v for k,v in jsondata.items()}
|
||||
if 'SOVERSION' in jsondata:
|
||||
str(sql.insert("UPDATE COMPUTERS SET SOVersion ='"+str(jsondata['SOVERSION'])+"' WHERE ID_C='"+ComputerID+"'"))
|
||||
if "SOBIT" in jsondata:
|
||||
str(sql.insert("UPDATE COMPUTERS SET SOBit ='"+str(jsondata['SOBIT'])+"' WHERE ID_C='"+ComputerID+"'"))
|
||||
if "SOCAPTION" in jsondata:
|
||||
str(sql.insert("UPDATE COMPUTERS SET SOCaption ='"+str(jsondata['SOCAPTION'])+"' WHERE ID_C='"+ComputerID+"'"))
|
||||
if "LASTCONNECTION" in jsondata:
|
||||
str(sql.insert("UPDATE COMPUTERS SET LastConnection ='"+str(jsondata['LASTCONNECTION'])+"' WHERE ID_C='"+ComputerID+"'") )
|
||||
if "LASTUSER" in jsondata:
|
||||
str(sql.insert("UPDATE COMPUTERS SET LastUser='"+str(jsondata['LASTUSER'])+"' WHERE ID_C='"+ComputerID+"'"))
|
||||
if "RAM" in jsondata:
|
||||
str(sql.insert("UPDATE COMPUTERS SET RAM='"+str(jsondata['RAM'])+"' WHERE ID_C='"+ComputerID+"'"))
|
||||
if "CPUNAME" in jsondata:
|
||||
str(sql.insert("UPDATE COMPUTERS SET CPUName='"+str(jsondata['CPUNAME'])+"' WHERE ID_C='"+ComputerID+"'"))
|
||||
if "RAMFREE" in jsondata:
|
||||
str(sql.insert("UPDATE COMPUTERS SET RAMFree='"+str(jsondata['RAMFREE'])+"' WHERE ID_C='"+ComputerID+"'"))
|
||||
if "HDD" in jsondata:
|
||||
str(sql.insert("UPDATE COMPUTERS SET HDD='"+str(jsondata['HDD'])+"' WHERE ID_C='"+ComputerID+"'"))
|
||||
if "INSTALLEDSOFTWARE" in jsondata:
|
||||
str(sql.insert("UPDATE COMPUTERS SET InstalledSoftware='"+str(jsondata['INSTALLEDSOFTWARE'])+"' WHERE ID_C='"+ComputerID+"'"))
|
||||
|
||||
return str({'RESULT':'1','TEXT':'OK','EXITCODE':'0'})
|
||||
|
||||
##
|
||||
|
||||
+56
-10
@@ -1,4 +1,4 @@
|
||||
# Build 21. Using API 2
|
||||
# Build 25. Using API 2
|
||||
param([Int32]$startup=0)
|
||||
|
||||
$host.UI.RawUI.WindowTitle = "Powerful Computer Manager - Do Not Close"
|
||||
@@ -7,6 +7,9 @@ Write-Host "Starting Powerful Computer Manager..."
|
||||
$srcdir = $PSCommandPath | Split-Path -Parent
|
||||
$server = (Get-Content "$srcdir\configpcm.ini" | select -Skip 1 | ConvertFrom-StringData).server
|
||||
$resources = (Get-Content "$srcdir\configpcm.ini" | select -Skip 1 | ConvertFrom-StringData).resources
|
||||
if ($resources -match '\\$'){ # Si acaba así, quitar ese caracter.
|
||||
$resources = $resources -replace ".$"
|
||||
}
|
||||
$64bit = [Environment]::Is64BitOperatingSystem
|
||||
|
||||
$computerName = [System.Net.Dns]::GetHostName()
|
||||
@@ -42,7 +45,7 @@ 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"
|
||||
Write-Host "Computer and UUID of $computerName doesn't match. UUID: " $UUID
|
||||
}
|
||||
exit
|
||||
}
|
||||
@@ -51,7 +54,7 @@ $Timestamp = [int64](([datetime]::UtcNow)-(get-date "1/1/1970")).TotalSeconds
|
||||
# Hardware Data
|
||||
$SOData = Get-CimInstance Win32_OperatingSystem
|
||||
$SOVersion = $SOData.Version
|
||||
if ($SOVersion -match "^10.0."){ #If its Windows 10, add revision number for knowing hotfix installed
|
||||
if ($SOVersion -match "^10.0."){ #If its Windows 10/11, 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
|
||||
}
|
||||
@@ -77,9 +80,40 @@ $diskResults = @()
|
||||
$DisksData = ConvertTo-Json -Depth 4 $DiskResults
|
||||
$DisksData = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($DisksData)) #I can't enter to database all without encode
|
||||
$lastUser = (Get-CimInstance -ClassName Win32_ComputerSystem -Property UserName -ComputerName .).UserName
|
||||
|
||||
$ISRegistry = Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall", "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
|
||||
$InstalledSoftware = @()
|
||||
foreach($obj in $ISRegistry){
|
||||
$ThisS= "" | Select-Object Name,Version
|
||||
if ($obj.GetValue('DisplayName') -eq $null){
|
||||
$ThisS.Name = $obj.PSChildName;
|
||||
}else{
|
||||
$ThisS.Name = $obj.GetValue('DisplayName')
|
||||
$ThisS.Version = $obj.GetValue('DisplayVersion')
|
||||
}
|
||||
$InstalledSoftware += $ThisS
|
||||
}
|
||||
$InstalledSoftware = ConvertTo-Json -Depth 4 $InstalledSoftware
|
||||
$InstalledSoftwareData = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($InstalledSoftware)) #I can't enter to database all without encode
|
||||
|
||||
# Send it
|
||||
$paramInvoke = -join("$server/upd/computer?ComputerName=$computerName&UUID=",$UUID,"&SOVersion=",$SOVersion,"&SOCaption=",$SOData.Caption,"&SOBit=",$SOData.OsArchitecture.Substring(0,2),"&LastConnection=",$Timestamp,"&RAM=",$RAMInstalled,"&RAMFree=",$RAMFree,"&CPUName=",$CPUName,"&LastUser=",$lastUser,"&HDD=",$DisksData)
|
||||
Invoke-RestMethod -Method Post -Uri $paramInvoke | out-null
|
||||
|
||||
$JSON = @{
|
||||
'UUID'=$UUID;
|
||||
'SOVersion'=$SOVersion;
|
||||
'SOCaption'=$SOData.Caption;
|
||||
'SOBit'=$SOData.OsArchitecture.Substring(0,2);
|
||||
'LastConnection'=$Timestamp;
|
||||
'RAM'=$RAMInstalled;
|
||||
'RAMFree'=$RAMFree;
|
||||
'CPUName'=$CPUName;
|
||||
'LastUser'=$lastUser;
|
||||
'HDD'=$DisksData;
|
||||
'InstalledSoftware'=$InstalledSoftwareData
|
||||
}
|
||||
|
||||
|
||||
Invoke-RestMethod -Uri "$server/upd/computer?ComputerName=$computerName&UUID=$UUID" -Method POST -Body ($JSON|ConvertTo-Json) -ContentType "application/json" | out-null
|
||||
|
||||
|
||||
# Load Cooks of computer
|
||||
@@ -92,10 +126,14 @@ foreach ($CookName in $cooks){
|
||||
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..
|
||||
if ($atstartup -eq 1 -and $startup -eq 0){ # 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
|
||||
}
|
||||
if ($atstartup -eq 0 -and $startup -eq 1){ # If script hasn't to run at startup of computer, and there is starting up..
|
||||
Write-Host "Se salta ya que se esta arrancando/apagandose el equipo..."
|
||||
continue # Go for next
|
||||
}
|
||||
if ($cook.only64bit -eq 1 -and $64bit -eq $False) { # If script is only for 64 bit and system is 32 bit..
|
||||
Write-Host "Se salta ya que es esta receta es solo para 64 bits..."
|
||||
continue # Go for next
|
||||
@@ -191,13 +229,18 @@ foreach ($CookName in $cooks){
|
||||
}
|
||||
}
|
||||
"REPOTOLOCAL" { # Copy file from repo location to local ($env:temp) for use in cmd or other things
|
||||
Copy-Item "$resources\$param" $env:temp -ErrorVariable errvar -Recurse -Force
|
||||
Write-Host "$resources\$param"
|
||||
$topath=$env:temp
|
||||
if ($param -match '\\$'){
|
||||
$topath+='\\'+($param -replace '.$')
|
||||
}
|
||||
Copy-Item "$resources\$param" $topath -ErrorVariable errvar -Recurse -Force -Verbose
|
||||
if ($? -eq $false){ # Error in Copy
|
||||
$err = 1
|
||||
}
|
||||
$filesCopied.Add($param) > $null #Add to list
|
||||
}
|
||||
"COPY" { # Copy file from repo location to some folder
|
||||
"COPY" { # Copy file from folder to other folder
|
||||
$parts = $param.Split(";")
|
||||
if ($parts[1] -ne ""){ #Exists orig and dest
|
||||
$orig=$parts[0]
|
||||
@@ -229,6 +272,9 @@ foreach ($CookName in $cooks){
|
||||
"MSG" { # Display a message
|
||||
msg * "$param"
|
||||
}
|
||||
{$_ -in "REM","COMMENT"} { # Comentario sin más, mostrado en Powershell sin más
|
||||
Write-Host "$param"
|
||||
}
|
||||
{$_ -in "SLEEP","PAUSE"}{ # Pause exec some seconds
|
||||
[int]$secs = $param
|
||||
Start-Sleep -Seconds $secs
|
||||
@@ -277,11 +323,11 @@ foreach ($CookName in $cooks){
|
||||
Invoke-Expression $param #Executes powershell command
|
||||
$if=$? # True -> Exists ; False -> Not exists
|
||||
}
|
||||
"IF64BIT" { # If 64 bit computer
|
||||
{$_ -in "IF64BIT","IF64BITS"} { # If 64 bit computer
|
||||
$inif = $True
|
||||
$if = $64bit # Its true if 64 bit computer
|
||||
}
|
||||
"IF32BIT" { # If 32 bit computer
|
||||
{$_ -in "IF32BIT","IF32BITS"} { # If 32 bit computer
|
||||
$inif = $True
|
||||
$if = !$64bit # Its true if 32 bit computer, flipped boolean
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
# Changelog
|
||||
|
||||
## 2022/03/05
|
||||
- Add delete group option in GUI
|
||||
|
||||
## 2021/12/15
|
||||
- Some fixes in code
|
||||
- NuGet try to avoid stuck on a question
|
||||
|
||||
@@ -61,8 +61,8 @@ Inside of a Cook, you can use a simple IF query:
|
||||
| W/L | IFSOFTWAREVER | When program is installed and has X version (Name;Version) |
|
||||
| W/L | IFPATHEXISTS | When if file exists |
|
||||
| W/L | IFPWCMD | When powershell command returns True (Beware of command executed if using Linux) |
|
||||
| W/L | IF64BIT | When computer is running a 64 Bit operating system |
|
||||
| W/L | IF32BIT | When computer is running a 32 Bit operating system |
|
||||
| W/L | IF64BIT/IF64BITS | When computer is running a 64 Bit operating system |
|
||||
| W/L | IF32BIT/IF32BITS | When computer is running a 32 Bit operating system |
|
||||
| W/L | IFWINDOWS | When computer is running Windows |
|
||||
| W/L | IFCOMPUTERNAME | When computer name is Name |
|
||||
| W/L | IFLINUX | When computer is running Linux |
|
||||
|
||||
Reference in new issue
Block a user