ChatGPT and scripting
Hey Awesome Community!
I am following many people using ChatGPT for all the things but what I wanted to see is how many of you have used it for scripting? I thought about using it for Automations but then I keep getting worried that if it goes wrong then it’s going to be a huge headache to fix. Not that I have Skynet level trust issues with it, but wanted to garner your opinions on it.
Thank you in advance!
Kim
Comments
-
@kim the AI tools are pretty good at writing scripts, even Atera's does a good job at this. I would highly recommend to you or anyone else that you take some time to learn what it is that's being developed for you. You should be able to understand what the script is doing so you can make changes or tune for your own needs.
Writing scripts to do most basic things (like anything Atera's built in script generator can produce) is really not challenging (if you want help PM me). The AI tools will get you there far faster than even a knowledgable developer. The benefit to understanding the language and syntax is that you can customize it to fit your needs - often times improving the script!
Treat the AI tools like you would an intern. You probably wouldn't take code written by an intern and run it on your endpoints without review - treat the AI code the same way. If you don't understand what your intern is doing or how they're doing it, you might want to learn that first 😀
Not understanding what's happening in your scripts is a liability to you and your customers.
Any code that you didn't write may introduce changes or actions you did not expect. Here's an example: create a new Powershell script in Atera using the AI generator and ask it to restart the computer in Safe Mode. It will probably produce code that results in the computer restarting twice. Now switch the script format to a batch file and generate the script again using the same prompt - this time it will likely result in a single restart. This is probably a poor example, but you get the idea - unexpected/unintended actions.
2 -
I love the AI scripting help. I have yet to be able to use the output out of the box, but I still think it is a huge time saver. Being able to get 60-80% of a script and then fine tune it is amazing imo.
I generally use it as a starting place for my scripts, but never trust it off the bat.
In general with AI or some scriptlet you find online, if you don't know what it is doing, you shouldn't be running it.4 -
0
-
I want to know too! 😉
0 -
I have a recent example.
I just switched our company over to a new phone system and needed a script to iteratively factory reset all of the phones in multiple locations based on IP ranges (Poke each IP in a range, try to login with a password, factory reset, move on). The system generated a script for me, and I am actually pretty sure it would have worked if the phones had API access turned on. Ended up doing it manually due to time constraints, but the script was a great start to something that I had no idea how to complete without a lot of up front research.
Prompt: iteratively factory reset polycom vvx 250 phones within an ip range of 192.168.5.1/24 using a password "1234"
Set the IP range to scan $ipRange = "192.168.5." Set the password for the factory reset $password = "1234" Loop through each IP address in the range for ($i=1; $i -le 254; $i++) {
$ipAddress = $ipRange + $i.ToString() } # Ping the IP address to check if it's online
$ping = New-Object System.Net.NetworkInformation.Ping
$pingReply = $ping.Send($ipAddress)
if ($pingReply.Status -eq "Success") {
# If the phone is online, send the factory reset command with the password
$webRequest = [System.Net.WebRequest]::Create("http://$ipAddress/cgi-bin/api-sys_operation?operation=factory_reset")
$webRequest.Method = "POST"
$webRequest.ContentType = "application/x-www-form-urlencoded"
$webRequest.Headers.Add("Authorization", "Basic " + [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("admin:$password")))
$webRequest.GetResponse()
}2 -
@kim I don't use AI for script development at all. That's not to say I don't think it's useful - it certainly is. It just isn't in my workflow yet, and I don't really have a burning need for it anywhere.
One thing I did find very useful when playing around with Atera's AI script generator was to end the prompt with something like "make the script compatible with powershell 2.0" or something to that effect. This is really useful and I may end up trying to convert some of my existing scripts to become completely Powershell 2.0 compliant. This is certainly not a major issue, but it's one that I've been working towards for a few years now but the cost is so high and the payoff is so low, I just can't throw time at it. So for me this is a great spot for AI to assist. But in all honesty, probably won't use Atera's generator. I already develop all my scripts in VS Code, so it would be much faster for me to just use a Code extension.
I'm not quite sure how I would use the AI script generator to assist with tickets. I feel like the process of generating the script, fixing it, then running it on the endpoint would take longer than just working the request.
2 -
I totally missed this response! @mjones thank you for sharing your script! Looking through the code it looks like it would be super helpful in that scenario. I actually have a few clients going through this phone update as well and this could be very useful for giving me quick network information if I am unable to get into my network monitoring system. Thank you for your response!
2
Topics
- All Topics
- 41 Getting started
- 25 Read before posting
- 8 Meet and greet
- 246 General
- 67 News and announcements
- 2 Swag
- 1 Roadmap updates
- 81 Resources
- 12 Knowledge Base
- 17 Webinars
- 1 Shared Script Library
- 2 Blog
- 20 Pro Tips
- 27 Got an idea?
- 3 Atera Academy
- 2 ActionAI
- 1 Copilot
- 141 Remote Monitoring and Management
- 85 Remote Monitoring
- 27 Patch Management
- 106 Professional Services Automation
- 65 Helpdesk
- 17 Billing
- 21 Reporting
- 40 Integrations & add-ons
- 22 Integrations
- 11 Add-ons
- 105 Scripting and automations
- 62 Scripts
- 30 Automations