generate_bigfix_action_script
Create PowerShell action scripts for IBM BigFix that perform system remediation and configuration changes with proper exit codes, logging, and error handling following enterprise best practices.
Instructions
Generate a BigFix action script to perform remediation or configuration changes.
Creates a PowerShell action script that follows IBM BigFix best practices:
- Proper exit codes (0=success, 1=retryable failure, 2=non-retryable failure)
- BigFix client log integration for monitoring
- System restore point creation before changes
- Comprehensive error handling and logging
- Event log integration for troubleshooting
⚠️ IMPORTANT: For complete BigFix deployments, you need BOTH relevance and action scripts.
Consider using 'generate_bigfix_script_pair' instead to create both scripts together.
IBM BigFix References:
- Action Scripts: https://help.hcltechsw.com/bigfix/11.0/platform/Platform/Console/c_creating_action_scripts.html
- Exit Codes: https://help.hcltechsw.com/bigfix/11.0/platform/Platform/Console/c_action_script_exit_codes.html
- Best Practices: https://help.hcltechsw.com/bigfix/11.0/platform/Platform/Console/c_best_practices_for_creating_fixlets.html
- Client Logging: https://help.hcltechsw.com/bigfix/11.0/platform/Platform/Installation/c_bes_client_logging.html
Args:
description: Clear description of what the script should accomplish (e.g., 'Install Chrome browser', 'Configure Windows firewall')
action_logic: PowerShell code that performs the action. Use 'Complete-Action -Result "Success/RetryableFailure/NonRetryableFailure" -Message "details"' to indicate completion
output_path: Optional file path where the script will be saved. If not provided, returns script content
timeout: Command timeout in seconds (1-300, default 60)
Returns:
Generated script content or path where script was saved
Example:
Generate a script to install Chrome:
```
result = await generate_bigfix_action_script(
description="Install Chrome browser to latest version",
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_path="chrome_action.ps1"
)
```
Tips:
- Always use Complete-Action function to set proper exit codes
- Use "Success" for completed actions
- Use "RetryableFailure" for temporary issues (network, locks, etc.)
- Use "NonRetryableFailure" for permanent issues (unsupported OS, etc.)
- Test action logic in safe environments first
- Consider creating system restore points for major changes
- Use Write-BigFixLog for detailed logging and troubleshooting
- Make actions idempotent (safe to run multiple times)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | Yes | ||
| action_logic | Yes | ||
| output_path | No | ||
| timeout | No |
Input Schema (JSON Schema)
{
"properties": {
"action_logic": {
"title": "Action Logic",
"type": "string"
},
"description": {
"title": "Description",
"type": "string"
},
"output_path": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Output Path"
},
"timeout": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": 60,
"title": "Timeout"
}
},
"required": [
"description",
"action_logic"
],
"type": "object"
}