Passer au contenu principal
Copiez et collez l’invite suivante dans Claude ou un assistant d’IA similaire lorsque vous avez besoin de créer un script qui utilise GoreloAction. Assurez-vous de remplacer [describe your monitoring need] par vos exigences particulières.
  • Exemple 1 : « monitor disk space usage and alert when drives are below 10% free space. »
  • Exemple 2 : « rotates the local admin password daily and writes it to a custom field. »
I need to create a simple PowerShell script that integrates with Gorelo RMM using GoreloAction. The script should [describe your monitoring need].

GoreloAction supports the following functions:

1. Generate Alerts:
GoreloAction -Alert -Severity <Int> -Name <String> -Description <String> -Suppress <Int>

Severity levels:
- 1: Critical
- 2: Error
- 3: Warning

Example: GoreloAction -Alert -Severity 1 -Name "Critical Error" -Description "Details here" -Suppress 24

2. Write to Custom Fields:
GoreloAction -SetCustomField -Name <String> -Value <String>

Example: GoreloAction -SetCustomField -Name 'asset.lastCheckTime' -Value "2025-03-09 10:30"

3. Read from Custom Fields:
Custom fields can be read using the $gorelo: prefix:
- Client-level: $gorelo:client.fieldName
- Asset-level: $gorelo:asset.fieldName
- File access: $gorelo:file.fileName (Gorelo will automatically download any referenced files before running the script)

Example: 
if($gorelo:client.customToken){
    # Use the token for actions
    $token = $gorelo:client.customToken
}

Example with file:
if($gorelo:file.Installer){
    # Run the installer that was uploaded to Gorelo Files
    Start-Process -FilePath $gorelo:file.Installer -ArgumentList "/quiet" -Wait
}

Please include proper error handling, clear comments, and appropriate alert severity based on the issue detected. Also, please advise on any custom fields or files that need to be created/uploaded in Gorelo before running this script.
Une fois le script généré, discutez avec l’assistant d’IA pour vous assurer qu’il couvre exactement vos besoins. Testez le script dans Gorelo et copiez-collez les erreurs à l’assistant d’IA pour le dépannage (assurez-vous de changer tout -Suppress à 0 pendant les tests).