Struggling with a PowerShell MFA Script and Copilot Help

0
0
Asked By CreativeDragon99 On

Hey everyone,

I've been having a rough time trying to use Copilot to create a PowerShell script that connects to a tenant and generates an Excel file containing user information along with their MFA status.

I spent hours going back and forth with Copilot, but each time I received a script, there were errors that I couldn't resolve, and it just became frustrating. I remember working with Copilot about a month ago, and it actually generated a working script for me, which I didn't save. Now, it seems like Copilot can't replicate that. I'm not very experienced with scripting or using Copilot, so I'd really appreciate any guidance or tips you have!

5 Answers

Answered By TechWizard42 On

It seems like you might be copying and pasting the entire code without fully understanding it. Instead of that, try breaking it down into manageable steps:
1. First, focus on getting the connection to the tenant working.
2. Then, retrieve information for just one user using something like `get-mguser -identity xxx`.
3. Once that’s sorted, look at how to get the MFA info for that individual user, and then move on to listing all users and putting that in a loop with something like `foreach ($Singleuser in $allusers){}`.
Taking it step by step can make this a lot easier, I promise!

PowerUser88 -

I’ve found that approach helps a lot, too! Starting small can really demystify the process and make debugging way simpler.

Answered By HelpMePlease32 On

Here’s a script I used to export MFA for all users using Microsoft Graph—might save you some headache! Check it out here: https://o365info.com/export-all-microsoft-365-users-mfa-status/

Answered By DataDrivenDreamer On

Also, remember that LLMs like Copilot aren't perfect and can mistakenly generate incorrect information. It's worth investing some time in learning the basics of PowerShell; it'll make your life so much easier in the long run!

Answered By ScriptSavvy91 On

Yeah, Copilot isn’t the best for heavy coding tasks. If you’re serious about using AI for coding, consider getting a more robust paid version. Plus, Microsoft Graph is where you’ll find the functions you need for checking MFA status. It’s not always straightforward like PowerShell, but learning those basics will really pay off. If you’re a sysadmin, you really need some PowerShell under your belt—trust me, it’s super powerful!

Answered By FrustratedCoder77 On

Honestly, I think you might just be expecting too much from Copilot. It tends to struggle with less common tasks that aren’t well documented. I’ve heard the built-in MFA reports cover most use cases, so maybe you don’t need to reinvent the wheel? Just a thought!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.