
A long time ago I manually cobbled together a PowerShell script to update the M365 required PowerShell modules on a Windows device. You can find that now ‘ancient’ version here:
https://github.com/directorcia/Office365/blob/30c6d020f48a7c8ed8ff7abeb64f4e30803d7c4b/o365-update.ps1
It worked well but it was growing stale and needed and refresh and update. Having been working with Github Copilot’s agent capabilities on new scripts like:
https://blog.ciaops.com/2025/05/27/powershell-script-for-analyzing-exchange-online-email-headers/
I decided it was perhaps time to make seismic shift in how I thought about the code I write thanks to AI.
Being a trained engineer, to me code is simply a tool that I can use to make my job easier and quicker. In short, I understand code but I am not a developer. This allows me to use languages like PowerShell to create automations. However, these attempts have never been ideal in my books and always suffer from limitations, especially when it comes to error handling. Also, I know enough about PowerShell to get by, but I also know there is a hell of a lot more it can do. However, I knew I would never get the time to get to any mastery level.
Then along came AI. Now I was able to create the scripts that I wanted in a much shorter time and utilising far more of the full capabilities available in PowerShell. This made me realise that, thanks to AI, I have moved up the ladder from an unskilled PowerShell ‘hack’ to more of a software architect/engineer with an very capable programming employee being AI. Now, I don’t need to write every line of code as I did with my original module update script, all I needed to do is now tell my new digital coding employee what needs to be done and monitor the result
So, starting with the original 200 lines of code I asked Github Copilot to ‘improve’ the script. This started a journey of almost 2 full days of getting to a script of around 2400 lines but with far more functionality. Best of all, I didn’t write a single line of additional code, my AI coding employee did it for me.
That journey also taught me some important lessons about what is now termed ‘vibe’ coding. You can’t simply expect AI to get it right the first time. It took me many iterations and prompting to get what I wanted and fix the many, many errors that manifested along the way. Perhaps the most interesting was when the AI just didn’t seem to fix an error that manifested itself with constrained mode PowerShell. The lesson I learned is that I had to dig in a bit and help the AI focus on the parts of the code where the problem was. Without doing that it seemed to only take a high level view of the code, overlooking the obscure error. Thus, I still needed my PowerShell and ‘engineering’ skills to direct my AI employee to the solution.
It dawned on me that I needed to do more than just be a ‘manager’ and sit back and give commands (prompts) and expect a perfect output every time. in fact, I needed to be an ‘architect’ and get more involved and help my AI employee solve the problem, just like you would any junior or entry level resource. Only then, did I really start making headway of solving problems as they arose and drive to the 2400 lines of coded solution that is available to you today for free.
Github Copilot and I have continue to refine the code to the point now were it does so many things I simply could not have done myself without investing probably thousands of hours into. Yes, I ‘could’ have but I have now learned ‘why’ would i? Creating a 2400 line free script on my own is simply not an economically viable investment of my time. Thanks to AI, I have been able to achieve the same, if not better result, in a much, much shorter time frame.
I can now take my new found knowledge of using AI to code and position myself as an ‘architect’ to solve many of the automation challenges I have wanted to solve with PowerShell. By removing the need to code and debug every line of code I achieve a far more effective and efficient result, without the need of involving anyone else but me. I remember hearing the saying that ‘your job won’t be replaced by AI alone, but it will be replaced by someone using AI’ and to me, my recent experience confirms exactly that.
If you have managed to get this far, the the good news is that my revamped o365-update.ps1 script has now been improved to include such features as:
– removal of depreciated modules
– removal of previous module versions
– supports multi-threading
– supports constrained language mode
– and more.
The documentation which is here:
https://github.com/directorcia/Office365/wiki/Update-all-Microsoft-Cloud-PowerShell-modules
which was also totally Ai generated! And of the course the code is at:
https://github.com/directorcia/Office365/blob/master/o365-update.ps1
The leverage that Github Copilot has already provided me and what I now envision it will allow me to, I could of only dreamed of as a single person ‘hack’ only a short time ago! My AI employee and I are now off to solve the next challenge. Stay tuned.