 G'day viewers, my name is Oren Thomas. I'm a Principal Hybrid Cloud Advocate at Microsoft. In this video, we'll talk about how IT Pros can use generative AI to decipher and document administrative scripts in their environment. The job of the IT Pro or Systems Administrator is to keep the servers and systems running that host the solutions that keep the organization functional. One of the perennial challenges we face in doing so is comprehending the solutions that predecessors in our role put in place. In this video, I'll talk about the challenges of maintaining administrative scripts written by your predecessors and how you can use generative AI such as Microsoft Copilot, GitHub Copilot or ChatGPT to assist you in this process. Administrative scripts in Windows Server environments are typically used for automating routine tasks such as system configuration, user management, software updates and more. These scripts are often written in PowerShell as batch files in Vibiscript, Python, Perl or any other language that can be used to administrate Windows operating systems. These scripts are often written at some point to solve or automate particular solutions. Once the problem is solved by the script, the script's contents are unlikely to be revisited unless something goes wrong. Anyone who has gone to work as an IT Pro or Server Administrator in an established environment at some point comes across automation or scripts whose provenance is a mystery. You won't be the first person who can not figure out who wrote the script, why they wrote the script and you may be somewhat mystified as to what the script actually does. If you've been an IT Pro for any length of time, you also know that just because you don't understand and can not figure out why something is present in your environment does not mean that it's a good idea to alter it. Chesterton's Fence is a philosophical concept that you shouldn't remove or change a thing until you know the reasons it was put there in the first place. You likely have enough exciting things to do at work without playing infrastructure jenga by removing or modifying stuff that currently works. Mysterious automation would be less mysterious if it was properly documented. The reality though is that a lot of things in many existing environments are poorly documented. Administrative scripts written by other IT Pros is a common area where best practice and what actually happens at our place of employment are light years apart. So why aren't scripts often well documented? Here is a non-exhaustive list. Administrators often create scripts in response to immediate needs or problems. The focus is on quickly resolving an issue or automating a task to save time in the future. The urgency or pressure to address these needs can lead to prioritizing functionality over documentation. Once the fire is put out, the IT Pro moves on to putting out the next fire. They don't have time to patiently document how the previous fire was extinguished. The original author might understand the script well enough not to feel the need for documentation, especially if they are the primary or sole user. We operate under the assumption that if we wrote it, we will always understand it. Even if that were always true, the reality is we might not be the next person that needs to understand it and may not even be around to explain it to the person that does. Scripts tend to evolve. What might start as a simple one-liner can grow into a complex set of functions as new requirements emerge. We might understand the bit that we're working on right now, but as the script becomes more complex, it becomes harder to comprehend. IT departments are often under-resourced and face time constraints. Administrators might have to juggle multiple tasks, making it challenging to allocate time for documenting scripts properly. As I alluded to earlier, best practice and resource constraints are often in tension with one another. So why do people find it hard to read other people's scripts or their own if they aren't documented? It's well known that it's harder to read code than to write it. Administrators often overestimate their ability to remember the purpose and functionality of their scripts. Trying to work out the purpose of a script by reading the code is a lot more difficult if there aren't hints written in the code's comments as to what each element does. Whilst it might seem counter-intuitive, it's generally recognized that developers may struggle to read their own source code after a period of time. This phenomenon is often referred to as code blindness or coders block. It happens because developers become so familiar with their own code that they stop seeing its structure and logic clearly. Over time, if the developer of the code doesn't interact with that code, their original intent may be forgotten, making it difficult to understand and modify. If each section of the code was clearly documented, the intent of each section of the code would be clearly stated. The book The Programmer's Brain by F. Eonans, which you can find in your favorite bookshop, discusses some of the cognitive issues developers and IT pros face when trying to read and understand code. There's an old joke that one of the reasons developers tend to prefer writing a solution from scratch rather than updating the existing one is that it's easier to start from the beginning with a project than to comprehend the undocumented source code of another developer. There are some links to some articles about the topic of challenges of reading code and scripts in the video description. So how can AI like Copilot or ChatGPT help me? You can use AI like Copilot or ChatGPT to help you understand what scripts do by having them examine the scripts and explain them to you. Assuming the explanations are correct, you can then use these explanations to document the script so that the next person that comes along to deal with the script doesn't also have to ask AI what it's actually trying to accomplish. When writing your own scripts, you can use AI like Copilot and ChatGPT to create comments for your own code. Not only will this save you time in writing your documentation, but it will also allow you to check how accurate these AI tools are at interpreting the meaning of your code. It might even help you put together the code more quickly and give you debugging suggestions if things do not work exactly as you intended them to. Writing administrative scripts and automation has been part of the profession of IT operations and systems administration since the days of the first digital computers. What's changed today is that there are a suite of generative AI tools that we can use to assist us in the task of documenting existing scripts and automation and going forward, making sure that our future scripts and automation are comprehensible to our future selves or anyone that needs to work with those tools in the future. I hope you found this video useful and informative. My name is Oren Thomas. You can find me at aka.ms slash oren. And if you've got any questions or feedback, drop a comment below.