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 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 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 has the following context for the AI:
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, 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.
- On the
page, select Create new job.Can't find the page in the left menu? That's probably because the Devices menu is collapsed. Click the arrow to expand it.
- On the Create job page, choose the platform where you want to run automation steps.
- Under AI assisted steps, add one of the following step to the list on the left:
- PowerShell execution with AI assistance
- Python execution with AI assistance
- Shell script execution with AI assistance (available on Mac only)
- Optional: You can select files to upload that the remote devices can then download.
Note: You can reference the file(s) from the script. You can upload up to three files per job with a maximum size of 1GB each. Any file can be used. When you reference a file from the script, you only have to enter its name. Once the step ends, the file is deleted from the remote computer, unless it is copied somewhere else with the script.
- Type your prompt that tells the AI what you want to achieve with the script.
- If you are new to AI-assisted scripting, test it with a few prompts before using it in production. This way, you'll see how the AI reacts to changing the wording of your prompt.
- Be very specific with wording
- Make sure you verify the content of the script before running it on remove devices
- You can reference an uploaded file in multiple ways:
- by typing 'this file', 'uploaded file', or any generic reference.
- by its name and extension, such as content.txt.
For example, you can tell the AI to "copy this file to c:\temp" to copy your uploaded file to the temp folder.
- Click Generate script.
- Click Next.
- From the list of Devices define the devices or a group of devices that will receive the script.
You can organize your devices by selecting a grouping option from the top of the list.
- Click Next.
- Name the job in a way that is easy to remember later on.
Optionally, you can schedule jobs up to one year in advance. To do so, toggle Schedule this job and set the time and date for the job to run. In the Date and time field, either type a date or click the calendar icon to choose it from a date picker.Remember: You can select offline devices for scheduled jobs, but when a job runs, devices must be online; otherwise, the job will fail on that device. Scheduled jobs run on each remote device's local time.
- Click Run.
Note: A preset timeout pertains to both the job and the step.
A timeout for every step is set to two hours, meaning that GoTo waits two hours for the script to finish on the remote computer. When the script finishes, GoTo starts the next step and waits another two hours for that step to finish. If a step does not finish on a remote computer in two hours, then it times out and the whole job fails.
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.