mirror of
https://gitlab.com/JKANetwork/powerfulcomputermanager.git
synced 2026-02-26 23:13:44 +01:00
55 lines
3.5 KiB
Markdown
55 lines
3.5 KiB
Markdown
# 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, if you change to 0 or delete, it will not do it)
|
|
|
|
If the cook has to run when no user is logued in, add:
|
|
"atstartup: 1"
|
|
Be aware that for be able to use this, in task scheduler (Or your favourite method) you have to run client.ps1 with argument "-startup 1" when no users are logued
|
|
|
|
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
|
|
|