How can Artificial Intelligence Help You Write Remote Execution Scripts?
Artificial intelligence (AI) helps you turn your ideas into code that you can run on remote devices.
Before you start wondering whether AI would suddenly come to life and take over the world, let's be clear. GoTo Resolve uses AI for one purpose and one purpose only: to help you write new automated scripts or improve existing ones. It won't unexpectedly wake up and steal your job, simply because: it can't.
Having said that, AI also won't do what would be your job in the first place - even if you want it to. It can help you get started with writing a piece of code, but it is your responsibility to fine-tune that script and verify that it does what you want. If you have no experience in writing scripts, AI will certainly be able to assist you, but it may not do exactly what you have in mind. AI is like a genie in a bottle: you can make a wish but you must you be very specific about what you wish for.
Geeking out with AI - a technical background
GoTo Resolve uses Microsoft Azure's OpenAI Service, which is currently based on an upgraded version of GPT-3.5 for natural language processing, and Codex for turning your thoughts into code. With OpenAI, it is possible to provide the AI with a 'context'. Think of a context like a job description that tells someone about the role that the person is about to do. GoTo Resolve has the following context for the AI:
Act as an assistant designed to write JavaScript, Python, PowerShell, or Shell scripts that run either on a Windows or Mac operating system, whichever the user selects. This script runs in context of the LocalSystem account. Add explanation to the generated code as comments.
The AI processes every user request with this context in mind.
Before you begin - a word of advice
- To unlock the full potential of AI-assisted scripting, make sure you are aware of the basics of writing scripts. This way, you will have realistic expectations.
- Even if you have scripting experience, always verify the script that AI generates to make sure that it is secure and operational.
- The AI sometimes 'hallucinates', meaning that it may provide an answer that is not justified by its training data. In GoTo Resolve, this means that the generated script may contain data that is unrelated to your request. Hallucination is rare, but as mentioned above, it is best to avoid it by testing your AI-generated scripts before running those on remote devices.
For more information on Azure OpenAI Service, see the Microsoft website.
How to Run an AI-assisted Automated Script
Create AI-assisted automated scripts that you can run on multiple devices without user interaction.
You upload 'a.txt' file for the job and you would like to copy it into a folder (also known as file distribution). Your script should look something like this:
Copy-Item a.txt C:\Destination
How to explain and audit the content of a script?
Frequently Asked Questions
- Can I write prompts in languages other than English?
- Yes, OpenAI supports almost all languages. In fact, you can mix languages in a prompt: For example, you can start your prompt in English and then switch to Spanish in mid-sentence. For the list of supported languages, see the Microsoft support site.
- Can I edit a script that I have previously run?
- Yes. See How to Rerun a Remote Execution Job. Notice however, that you cannot edit your original prompt, only the content of your script.
- How can I make the AI add logging to a script?
- Simply ask the AI to create log. Seriously, that's all you have to do.
- How can I improve my existing script?
- You can write "Improve this script" and then copy the whole script into the prompt field to let the AI smarten your code.
- Can I run AI-assisted scripts on multiple platforms?
- No, as with any other Remote Execution steps, this is not possible.