This guide is aimed at helping you effectively use the Ask Otto script writing assistant to draft PowerShell and BASH-based Worklets.
For requirements and details, refer to Enabling and Using Ask Otto by Automox.
Things to note when using Ask Otto
When you are creating a new worklet and request assistance from Ask Otto, there are two ways to initiate help.
If you are trying to create an evaluation script, make sure to use to the chatbot assistant within the Evaluation Code section.
Correspondingly, to create a remediation script, make sure to use the chatbot assistant within the Remediation Code section.
Use cases and prompt examples
The following use cases and examples are provided to help you test the functionality.
This example script is designed to find and then fix the Oracle CredSSP remote code execution vulnerability.
Evaluation Prompt Entry:
Create a PowerShell Evaluation script that mitigates CVE-2018-0886. The script should check for a registry key named "AllowEncryptionOracle" under the "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System\CredSSP\Parameters" hive.
If the key does not exist or does not have a value of 1, Write-Output "The device is not compliant" and Exit 1.
If the key exists and has a value of 1, Write-Output "The device is compliant." And Exit 0.
Remediation Prompt Entry:
Create a PowerShell Remediation script that sets the "AllowEncryptionOracle" registry under "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System\CredSSP\Parameters" to a value of 1.
If the key does not exist, create it. If it already exists, but is not a value of 1, set it to 1. Perform this in a Try/Catch block and return error logging.
If the Try is successful, Write-Output "Remediation was successful." And Exit 0
If the Try fails, Write-Output "Remediation failed." Provide the error exception message, and Exit 1.
Audit scripts to check and report on configurations, settings, and status
Write a worklet to validate that Intune auto-enrollment was successful in PowerShell. If the worklet was successful, write-output “Intune auto-enrollment successful.” If the auto-enrollment was unsuccessful, write-output “Intune auto-enrollment is unsuccessful”
Fix a help desk issue
There are many examples of scripts that can fix help desk-related issues such as rebuilding an Outlook profile, printer configurations, clearing a browser cache, etc.
This example checks to see if a specific network printer is installed on a device, if it isn’t, then we will install it.
Write a PowerShell worklet to check if a network printer is installed on a device. If the network printer is installed Exit 0, if it is not installed Exit 1
Write a PowerShell script to install a network printer on a Windows 10 device. If successfully installed, write-output "network printer installed". If the install is not successful, write-output "network printer install failed"
Other use cases
Audit type worklets that report against a state configuration that's unique to their environment.
Specific software installs/uninstalls
homebrew apps or special non-general configurations
larger scale project type worklets such as domain migrations, email alerting, write-backs to other APIs, etc.