generate_bigfix_script_pair
Create BigFix relevance and action script pairs to deploy automated fixes. Generates detection logic to identify affected systems and remediation scripts to apply changes with proper error handling.
Instructions
Generate a complete pair of BigFix relevance and action scripts for deployment.
This is the RECOMMENDED tool for BigFix fixlet creation as it creates both required scripts:
- Relevance script: Determines which computers need the action (TRUE/FALSE output)
- Action script: Performs the necessary changes with proper error handling
Both scripts follow IBM BigFix best practices:
- Proper BigFix output formats and exit codes
- BigFix client log integration for centralized monitoring
- System restore points before changes (action only)
- Comprehensive error handling and logging
- Event log integration for troubleshooting
- No user interaction (silent execution required)
IBM BigFix References:
- Fixlet Development: https://help.hcltechsw.com/bigfix/11.0/platform/Platform/Console/c_creating_fixlets.html
- Relevance Language: https://help.hcltechsw.com/bigfix/11.0/relevance/Relevance/c_relevance_language.html
- Action Scripts: https://help.hcltechsw.com/bigfix/11.0/platform/Platform/Console/c_creating_action_scripts.html
- Best Practices: https://help.hcltechsw.com/bigfix/11.0/platform/Platform/Console/c_best_practices_for_creating_fixlets.html
- Testing Guidelines: https://help.hcltechsw.com/bigfix/11.0/platform/Platform/Console/c_testing_fixlets.html
Args:
description: Clear description of what the scripts should accomplish (e.g., 'Manage Chrome browser installation and updates')
relevance_logic: PowerShell code that determines if action is needed. Use 'Complete-Relevance -Relevant $true/$false -Message "status"' to indicate result
action_logic: PowerShell code that performs the remediation. Use 'Complete-Action -Result "Success/RetryableFailure/NonRetryableFailure" -Message "details"' to indicate completion
output_dir: Optional directory to save both scripts. If not provided, returns script content in response
timeout: Command timeout in seconds (1-300, default 60)
Returns:
Dictionary containing both scripts: {"relevance_script": "content/path", "action_script": "content/path"}
Example:
Generate scripts to manage Chrome browser installation:
```
result = await generate_bigfix_script_pair(
description="Manage Chrome browser installation with version 100.0.0.0 or higher",
relevance_logic=''',
try {
$app = Get-ItemProperty "HKLM:\Software\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe" -ErrorAction Stop
$version = (Get-Item $app.'(Default)').VersionInfo.FileVersion
$needsAction = [version]$version -lt [version]"100.0.0.0"
Complete-Relevance -Relevant $needsAction -Message "Chrome version: $version (Target: 100.0.0.0+)"
} catch {
Complete-Relevance -Relevant $true -Message "Chrome not found - installation needed"
}
''',
action_logic=''',
try {
$installer = "$env:TEMP\ChromeSetup.exe"
Write-BigFixLog "Downloading Chrome installer..."
Invoke-WebRequest -Uri "https://dl.google.com/chrome/install/latest/chrome_installer.exe" -OutFile $installer -UseBasicParsing
Write-BigFixLog "Installing Chrome silently..."
Start-Process -FilePath $installer -Args "/silent /install" -Wait
Remove-Item $installer -Force
Complete-Action -Result "Success" -Message "Chrome installation completed successfully"
} catch {
Complete-Action -Result "RetryableFailure" -Message "Chrome installation failed: $($_.Exception.Message)"
}
''',
output_dir="chrome_bigfix_scripts"
)
```
Tips:
- Always test both scripts in a controlled environment first
- Ensure relevance logic matches the conditions that action script addresses
- Use descriptive logging messages for easier troubleshooting
- Consider the scope and impact of actions (test groups first)
- Make sure relevance logic is efficient (evaluated frequently)
- Ensure action logic is idempotent (safe to run multiple times)
- Use Write-BigFixLog for detailed progress tracking
- Test across different OS versions and configurations
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | Yes | ||
| relevance_logic | Yes | ||
| action_logic | Yes | ||
| output_dir | No | ||
| timeout | No |
Input Schema (JSON Schema)
{
"properties": {
"action_logic": {
"title": "Action Logic",
"type": "string"
},
"description": {
"title": "Description",
"type": "string"
},
"output_dir": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Output Dir"
},
"relevance_logic": {
"title": "Relevance Logic",
"type": "string"
},
"timeout": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": 60,
"title": "Timeout"
}
},
"required": [
"description",
"relevance_logic",
"action_logic"
],
"type": "object"
}