mirror of
https://gitlab.com/JKANetwork/powerfulcomputermanager.git
synced 2026-02-26 23:13:44 +01:00
First commit, only with CLI tools
This commit is contained in:
5
doc/example_cooks/install_exefile.yaml
Normal file
5
doc/example_cooks/install_exefile.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
name: Install exe file, example with WinSCP
|
||||
revision: 1
|
||||
steps:
|
||||
- REPOTOLOCAL|WinSCP-5.13.4-Setup.exe
|
||||
- CMD|WinSCP-5.13.4-Setup.exe /VERYSILENT /NORESTART
|
||||
6
doc/example_cooks/install_msioptions.yaml
Normal file
6
doc/example_cooks/install_msioptions.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
name: Install MSI with options (Do not put standard silent options!)
|
||||
revision: 2
|
||||
steps:
|
||||
- REPOTOLOCAL|msiwithoptions.msi
|
||||
- INSTALLMSI|msiwithoptions.msi ADDLOCAL=Server SERVER_REGISTER_AS_SERVICE=1 SERVER_ADD_FIREWALL_EXCEPTION=1 SERVER_ALLOW_SAS=1
|
||||
- REMOVE|C:\ProgramData\Microsoft\Windows\Start Menu\Programs\ProgramThatIDoNotWantUserToSee|Delete start menu folder
|
||||
5
doc/example_cooks/install_simplemsi.yaml
Normal file
5
doc/example_cooks/install_simplemsi.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
name: Install MSI File. By default, it is silent
|
||||
revision: 1
|
||||
steps:
|
||||
- REPOTOLOCAL|simplemsi.msi
|
||||
- INSTALLMSI|simplemsi.msi
|
||||
7
doc/example_cooks/remove_program.yaml
Normal file
7
doc/example_cooks/remove_program.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
name: Remove WinRar as Example
|
||||
revision: 4
|
||||
steps:
|
||||
- UNINSTALL|WinRAR|This uninstalls WinRAR from Control Panel directly (Powershell powered uninstall)
|
||||
- NOERROR|Do not fail if this fails
|
||||
- CMD|"C:\Program Files\WinRAR\Uninstall.exe" /S
|
||||
- ENDNOERROR|End of never exit if fail
|
||||
24
doc/file_hierarchy.md
Normal file
24
doc/file_hierarchy.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# File hierarchy
|
||||
|
||||
## Root folder
|
||||
- api.py -> Server file. It manages all requests from clients and connects to database
|
||||
- loadserver.bat -> A helper to run api.py on Windows
|
||||
- sql.py -> Helper for api.py sql sentences
|
||||
- sysopt.py -> Config of api and sql
|
||||
|
||||
## Client folder
|
||||
- client.ps1 -> This file has to run every X time (I suggest every hour) on every client and as NT\SYSTEM or local admin. You can do this with a Task Schedule as SYSTEM in a GPO (Active Directory)
|
||||
- control.ps1 -> This is the cli of the program. With that you manages the client-server program. It has to be in same folder as client.ps1 file
|
||||
|
||||
## BD folder
|
||||
- database.db -> Database file in sqlite3
|
||||
|
||||
## cooks folder
|
||||
It has the cooks in yaml format.
|
||||
Warning: Do not change name of cooks created and assigned directly.
|
||||
|
||||
## Doc folder
|
||||
Documentation...
|
||||
|
||||
## REPO folder (This isn't needeed to be there)
|
||||
You have to have this shared on LAN, this is the folder that cooks use to retrieve your files (As .exe/.msi) to use in scripts.
|
||||
13
doc/how_works.md
Normal file
13
doc/how_works.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Very-Fast instructions
|
||||
You have to create a cook
|
||||
In "Examples" you have Cook Examples
|
||||
|
||||
Then, you have to create a group using the CLI.
|
||||
In the groups is where you assign computers and cooks
|
||||
|
||||
Cooks -> Group
|
||||
Computers -> Group
|
||||
|
||||
You can have more than 1 cook in a group
|
||||
|
||||
You can call the groups equal to cooks and assign this cook to the group and you have a 1<->1
|
||||
48
doc/howto_writecook.md
Normal file
48
doc/howto_writecook.md
Normal file
@@ -0,0 +1,48 @@
|
||||
# How to
|
||||
Cooks are in yaml format, and have this structure.
|
||||
|
||||
First: Name, a line like below, with the name
|
||||
"name: My Super Cook"
|
||||
Then, the revision number, when this number changes, cook will be reapplied
|
||||
"revision: 1"
|
||||
If the cook has to run everytime client is called (And not only one time per new revision), you have to add:
|
||||
"runever: 1" (1-> Everytime; 0 or no line: Run only one time)
|
||||
And then, steps. First a "steps:" line, and then line by line the steps of the cook
|
||||
"steps:
|
||||
- PWCMD|White-Output "Hello World"
|
||||
"
|
||||
Steps are ever put like "Type of step" | "Command"
|
||||
You can put comments in every line putting another "|" and comments at finish, like.. "CMD|WinSCP-5.13.4-Setup.exe /VERYSILENT /NORESTART|Note: Installing WinSCP"
|
||||
|
||||
Cook finishes executing if they had and error (Except in a NOERROR block), or if finishes right.
|
||||
|
||||
Note: Cooks start in directory $env:temp (%TEMP%) from SYSTEM user.
|
||||
|
||||
# Type of commands
|
||||
- CMD and PWCMD: cmd command or Powershell command. Cmd commands can not work properly if has quotes (Because its run as cmd /c ""), if they are a Powershell equivalent, please use it. Normally cmd command uses are for install/uninstall exe programs or some like that, because powershell doesn't wait to exit a exe command
|
||||
- REPOTOLOCAL: Copy a file from REPO folder configured to local in temp folder to use it. You can copy files or folders with same command.
|
||||
- INSTALLMSI: Installs an MSI file silently (Params /quiet /norestart are put, do not repeat). You can add parameters (Like INSTALLMSI|superapp.msi ADDLOCAL=extension SETASDEFAULT=1)
|
||||
- NOERROR and ENDNOERROR: This is for creating a block of instructions that not captures errors, then cook works ever if instruction fails
|
||||
Example:
|
||||
NOERROR|For deleting a file that maybe can not exist
|
||||
PWCMD|Remove-Item C:\Windows\loginstall.txt
|
||||
ENDNOERROR|Finish
|
||||
- SERV_DISABLE and SERV_ENABLE: Enables or disables a Windows Service
|
||||
- MSG|Display a message to user
|
||||
- COMMENT or REM: Makes cook comments (COMMENT|This is a comment)
|
||||
- KILL_PROCESS: Kill a process name if exists
|
||||
- UNINSTALL: Uninstalls a program by name if its installed. It searchs it by Powershell command 'Get-Package -Name "Program*"', take care of it. You can use to see name
|
||||
- REMOVE: Removes a file or folder path from local computer. It's recursive
|
||||
- SLEEP and PAUSE: Pauses execution seconds specified in param
|
||||
- DOWNLOAD: This downloads a file from network/internet to $env:temp/filename. Its *required* to put a filename, that goes this way: DOWNLOAD|http://www.example.org/file.zip;filename.zip. ";" is that separates URL and filename. It seems to be a limit in PowerShell Invoke-WebRequest that limits this downloads to some like 128MB
|
||||
- EXIT: Terminates a cook in this instruction. If a param is specified, exit will be with error code and the param as text of error. (Ej: EXIT|Error at seeking for file)
|
||||
|
||||
## If types
|
||||
Inside a cook, you can use IF/ELSE/ENDIF scheme.
|
||||
- IFSOFTWAREINST: Runs the if, if a program is installed.
|
||||
- IFSOFTWAREVER: Runs the if, if a program is installed and has X version. (Run with two param: "Name;Version")
|
||||
- IFPATHEXISTS: Runs if file exists
|
||||
- IFPWCMD: If powershell command returns $true (Executed succesfully), if is run
|
||||
- ELSE: Else..
|
||||
- ENDIF
|
||||
|
||||
3
doc/naming_limits.md
Normal file
3
doc/naming_limits.md
Normal file
@@ -0,0 +1,3 @@
|
||||
Cooks have to be only alfanumeric caracters and "-","_" and must end with .yaml
|
||||
|
||||
Groups have to be alfanumeric and "-","_"
|
||||
Reference in New Issue
Block a user