I'm having a tough time getting a PowerShell script working with Copilot. I need to authenticate to a tenant and create an Excel file containing user details and their MFA status. Though I've used Copilot successfully before, today it just kept generating errors, and I got really frustrated. I don't have much scripting experience and thought Copilot would help me out again, but now it feels like it's not as reliable as before. Has anyone else experienced this?
5 Answers
What Copilot are you using? It sounds like you're just copying and pasting the whole code, which isn't the best approach. Try breaking it down into smaller steps. First, ensure you can connect properly. Then focus on getting info for a single user using a command like `get-mguser -identity xxx`. Once that's working, gradually build up to getting all users and then create a loop. It’s not as complicated as it seems if you take it step by step!
For a quick solution, check out this script to export all users' MFA status using Microsoft Graph: https://o365info.com/export-all-microsoft-365-users-mfa-status/. It might save you some hassle!
Honestly, any AI tool can struggle with specifics like this. You might've spent more time trying to make Copilot work than it would take to just learn some basics. It's 2025; you need to know a bit about scripting languages to make AI work for you, not the other way around.
I’ve seen that too. It’s like, if AI can’t even generate a straightforward PowerShell script, how's it going to take all our jobs? I mean, I get the basics of other languages, but PowerShell is new to me.
If you're using AI for scripting, consider investing in a more advanced tool. Copilot is just a basic version of what's out there. For MFA stuff, you'll likely need to work with Microsoft Graph, which is somewhat different from PowerShell. Also, familiarize yourself with PowerShell basics; books like 'PowerShell in a Month of Lunches' can really help speed things up. Trust me, Powershell's worth knowing if you’re in sysadmin roles!
I think the main problem here is that LLMs perform best with well-documented problems. There are probably easier ways to get MFA status through built-in reports. Just a thought, but what's pushing you to create this script instead of using existing tools?
I was using the default Windows 10 Copilot too. I get what you mean about copying and pasting when you're not familiar with PowerShell, but that’s probably why I kept hitting errors. I just wish Copilot could recreate the long script that worked for me before.