AI & automation

20 Claude Prompts for IT Admins: PowerShell, Intune, Microsoft 365 and Troubleshooting

Twenty original, copy-paste Claude prompts for daily IT admin work: PowerShell scripts, Microsoft 365 and Entra reports, Intune checks, troubleshooting and documentation, with safety rules.

By EpiFive Editorial TeamReviewed/updated 13 min readHow we check articles
On this page

These 20 prompts cover the repetitive work most IT admins do every week: drafting PowerShell, building Microsoft 365 and Entra ID reports, checking Intune devices, narrowing down a fault from a log, and writing the documentation nobody wants to write. Each one is original, copy-paste ready and uses placeholders you replace with your own details. Treat every answer as a draft you review and test before it touches production.

Who this is for and what you will have at the end

This is for sysadmins, help desk leads and small-business IT owners who already know the platforms and want to spend less time on first drafts. You do not need a paid API setup; the prompts work in a normal Claude chat. By the end you will have 20 reusable prompts, a short set of rules that make them reliable, a safe-use checklist for scripts that change real data, and a way to adapt any prompt to your environment.

If you want general-purpose prompts for email and spreadsheets instead, see 25 Claude prompts for work you can copy and paste. For the underlying technique, see prompt engineering basics for business users.

The rules behind every prompt below

Anthropic's prompting guide gives the principles these prompts follow. Four of them matter most for admin work.

RuleWhat Anthropic saysHow it shows up in these prompts
Be clear and directBe specific about the output format and constraints; if a colleague with minimal context would be confused, Claude will be tooEvery prompt states the platform, version, output and limits
Add contextExplain the goal behind an instruction so Claude can target the answerPrompts say why, for example "this runs against production"
Use examplesA few well-crafted examples improve accuracy and consistency; Anthropic suggests 3 to 5Prompts that need a fixed format include one sample line
Use XML tagsWrapping each type of content in its own tag, such as <instructions>, <context> and <input>, reduces misinterpretationPasted logs and data go inside tags

One more habit for admins: put long pasted material, such as a log, above your question. Anthropic's long-context guidance says to place long documents and inputs near the top of the prompt, above the query, and that this improves performance.

Placeholders and what to adjust

Replace anything in square brackets. Where a prompt names Microsoft Graph PowerShell, it assumes you have installed the SDK as Microsoft documents it (Install-Module Microsoft.Graph -Scope CurrentUser -Repository PSGallery -Force) and sign in with Connect-MgGraph -Scopes plus the permission you need. Use contoso.com style placeholders instead of real tenant data.

PowerShell prompts

1. Draft a read-only report script

You are helping a Microsoft 365 administrator. Write a PowerShell 7 script using the Microsoft Graph PowerShell SDK that lists all member users with these columns: DisplayName, UserPrincipalName, AccountEnabled, CreatedDateTime. Export to a CSV file at [path].
 
Constraints:
- Read-only. The script must not create, change or delete anything.
- Request only the least-privileged Graph permission that is sufficient, and name it in a comment.
- Use Get-MgUser with the -Property parameter to request only the columns needed.
- Add a comment above each cmdlet saying what it does.
After the script, list every cmdlet and parameter you used so I can verify them on Microsoft Learn.

Why it works: it forces a read-only boundary and asks Claude to list what to verify. Microsoft documents Get-MgUser with -Property, -Filter and -All, so you can check each against the cmdlet page.

2. Add safety switches to an existing script

<existing_code>
[paste your script]
</existing_code>
 
Review this PowerShell script. Rewrite it so that every command that changes data supports -WhatIf and -Confirm through [CmdletBinding(SupportsShouldProcess)], writes a log line for each object touched, and stops on the first terminating error. Show a diff-style summary of what you changed and why. Do not change the script's behavior otherwise.

PowerShell documents -WhatIf as displaying a message that describes the effect of the command instead of executing it, so this is the right habit before any bulk change.

3. Explain a script you inherited

<existing_code>
[paste script]
</existing_code>
 
Explain this script to a new help desk technician. Give: (1) a three-sentence summary, (2) a numbered walkthrough of what each block does, (3) every external system, file path or credential it touches, (4) anything risky or that looks like a bug. Quote line numbers where you can.

4. Turn a manual checklist into a script outline

I do this task by hand every week: [describe steps]. Environment: Windows Server [version], PowerShell [version], [modules].
Produce an outline, not a full script: the functions you would write, their parameters, the order they run in, what each returns and how errors are handled. Ask me up to five clarifying questions first if anything is ambiguous.

Asking for questions first stops Claude from guessing about your environment.

5. Write Pester-style test cases

<function>
[paste PowerShell function]
</function>
 
List ten test cases for this function in a table: input, expected result, and why it matters. Include empty input, null input, a very large input and an input with special characters. Then write the Pester tests for the first five.

Microsoft 365 and Entra ID prompts

6. Plan an access review report

I administer a Microsoft 365 tenant with about [number] users. Design a monthly report that shows: users who have not signed in for [number] days, accounts without multifactor authentication registered, and guest accounts older than [number] days. For each item say which Microsoft Entra or Microsoft 365 admin center page or Microsoft Graph PowerShell cmdlet would supply the data, and mark anything you are not certain exists as "verify". Do not invent portal names.

The last sentence matters: it gives the model permission to say it is unsure, which makes fabricated menu paths easier to spot.

7. Review a Conditional Access policy design

<policy_design>
[describe each policy in words: users, apps, conditions, grant controls, exclusions]
</policy_design>
 
Act as a reviewer. Identify gaps: lockout risks, missing break-glass account exclusions, overlapping or contradictory policies, and legacy authentication coverage. Return a table with Finding, Risk, Suggested change. Flag any suggestion that could lock admins out so I can test it in report-only mode first.

Never paste exported policy JSON that contains tenant IDs without redacting them first.

8. Draft a license cleanup plan

Context: [number] users, license types [list SKUs by friendly name], a goal of reducing spend without removing access anyone needs.
Create a step-by-step plan to find unused licenses (for example users inactive for [number] days), confirm with managers, and reclaim them. Include a template email to managers and a rollback step if someone loses access in error. Keep it to one page.

9. Write a new-hire and leaver checklist

Create a checklist for [onboarding / offboarding] in a Microsoft 365 environment with Entra ID and Intune. Group the steps by system (identity, mailbox, files, devices, apps). For each step include the owner role and whether it can be automated. Mark steps that carry data-loss risk, for example deleting a mailbox, with "confirm with manager first".

Intune and endpoint prompts

10. Design a pilot ring rollout

I need to deploy [app, policy or update setting] to about [number] Windows devices managed by Intune. Propose a three-ring rollout (pilot, broad, everyone) with ring sizes, how long to wait between rings, what to monitor, and the exact conditions under which I should stop. Present it as a table, then a short rollback plan.

11. Draft a compliance policy proposal

Draft a device compliance policy proposal for [Windows / iOS / Android] devices used by [department]. List each setting you recommend, why, and the user impact. Separate "must have" from "nice to have". Tell me which settings commonly cause help desk calls so I can warn users in advance.

12. Query managed devices with Graph PowerShell

Write a read-only PowerShell 7 snippet using the Microsoft Graph PowerShell SDK that lists Intune managed devices and exports DeviceName, OperatingSystem, OSVersion and LastSyncDateTime to CSV. Use Get-MgDeviceManagementManagedDevice with -All. Name the Graph permission it needs. Then give two ways to sort the output so the devices that have not synced the longest appear first. List every cmdlet and parameter used so I can verify them.

Microsoft's cmdlet page documents -All, -Filter, -Property and -Sort for this cmdlet, so the checks are quick.

13. Write end-user instructions for a change

Write instructions for non-technical staff explaining [change, for example "Company Portal will ask you to install an update"]. Reading level: grade 8. Include what they will see on screen in words, how long it takes, what to do if it fails and who to contact. Under 200 words. No jargon.

Troubleshooting prompts

14. Narrow down a fault from a log

<log>
[paste redacted log excerpt]
</log>
 
<context>
Product and version: [..]. What changed recently: [..]. What worked before: [..]. What I already tried: [..].
</context>
 
List the three most likely causes ranked by probability, the single fastest test that would confirm or rule out each one, and what I would see if the test confirms it. Say plainly where the log does not contain enough information.

15. Interpret an error message

I got this error in [product]: "[exact message]". It happens when [action]. Explain in plain language what the error means, the common causes, and a safe order in which to check them, from least to most disruptive. Tell me which fixes change settings so I know what to back up first.

16. Build a troubleshooting decision tree

Build a decision tree for the help desk for the symptom "[symptom]". Use a text diagram with yes/no branches, no more than eight questions, and end every branch with a specific action or an escalation instruction that names what information to collect.

Use a text format request like this when you want something you can paste into a wiki without an image.

17. Write a post-incident review

<timeline>
[paste incident notes with times]
</timeline>
 
Write a blameless post-incident review: summary, timeline, impact, root cause, what went well, what went badly, and action items with an owner role and a due date placeholder. Do not speculate about causes the timeline does not support; list them under "open questions" instead.

Documentation and communication prompts

18. Convert notes into a runbook

<notes>
[paste rough notes]
</notes>
 
Turn these into a runbook with: purpose, prerequisites, numbered steps, expected result for each step, rollback, and a "when to escalate" section. Mark any step where my notes are unclear with [CLARIFY] rather than guessing.

19. Write a change request

Draft a change request for [change]. Include: reason, systems affected, risk level with justification, test evidence placeholder, implementation steps, rollback steps, communication plan and the maintenance window as [date/time]. Keep it under one page.

20. Write an outage notice

Write a status message for [audience] about [issue]. Facts I know: [list]. Facts I do not know yet: [list]. Next update at [time]. Tone: calm and plain. Do not state a cause or an end time unless I gave one. Give a short version for chat and a longer version for email.

Safe-use checklist for admins

Before you run anything Claude produced, work through this list.

  1. Read the whole script; do not run what you cannot explain.
  2. Verify each cmdlet, parameter and permission scope on learn.microsoft.com. A model can produce something that looks right but does not exist.
  3. Run read-only versions first and review the output.
  4. Use -WhatIf on anything that changes data, then run against a test account or pilot group.
  5. Keep secrets, tokens and real user data out of the prompt.
  6. Log what the script changes, and keep a rollback.

If you let Claude read content you do not control, such as tickets or emails, treat that content as untrusted; the prompt injection defense checklist covers why.

Anthropic also notes that, without guidance, a model working with tools might take actions that are hard to reverse or affect shared systems. Its guidance is to tell the model to ask before destructive, hard-to-reverse or externally visible actions. Add a line such as "Ask me before any step that deletes data or changes a shared system" to any prompt used in an agentic tool.

Adapting a prompt to your environment

  1. Replace the placeholders with your versions: PowerShell 5.1 and 7 behave differently, and Microsoft recommends PowerShell 7 or later for the Graph SDK.
  2. Add one example of the output you want if the format matters.
  3. State the boundary: read-only, pilot group only, or no changes outside business hours.
  4. Ask for the verification list: every cmdlet, setting and portal path used.
  5. Save the prompts that work in a Claude Project so your team starts from the same wording; see Claude Projects for a team knowledge base.

What we checked

  • Opened the Claude prompting best practices page on platform.claude.com on 2026-11-18. Confirmed the sections "Be clear and direct", "Add context to improve performance", "Use examples effectively", "Structure prompts with XML tags" and "Long context prompting", and the advice to include 3 to 5 examples and to put long documents above the query.
  • Opened the Get-MgUser reference on learn.microsoft.com on 2026-11-18. Confirmed that -All, -Filter, -Property, -Search, -Sort and -Top exist and that the page's Example 1 uses Connect-MgGraph -Scopes 'User.Read.All'. Its documented output for Get-MgUser -All | Format-List ID, DisplayName, Mail, UserPrincipalName lists Id, DisplayName, Mail and UserPrincipalName fields, for example DisplayName Adele Vance with [email protected].
  • Opened the Get-MgDeviceManagementManagedDevice reference on 2026-11-18. Confirmed it supports -All, -Filter, -Property, -Sort, -Top and -Skip.
  • Opened the Microsoft Graph PowerShell SDK installation page on 2026-11-18. Confirmed the command Install-Module Microsoft.Graph -Scope CurrentUser -Repository PSGallery -Force and the recommendation to use PowerShell 7 or later.
  • Opened about_CommonParameters (PowerShell 7.6) on 2026-11-18. Documented output for Remove-Item Date.csv -WhatIf is What if: Performing operation "Remove File" on Target "C:\ps-test\date.csv".
  • Counted the prompts: 5 PowerShell, 4 Microsoft 365 and Entra ID, 4 Intune, 4 troubleshooting and 3 documentation, which totals 20.
  • Not checked: we did not run any of the 20 prompts against Claude or run any generated script in a tenant, so the example outputs a prompt produces will vary. The prompts are original and general; adjust them to your data.

Last tested: 2026-11-18

References

Questions people ask

Can Claude write PowerShell scripts for Microsoft 365 administration?

Yes, it can draft them, but treat every script as untrusted until you have read it and tested it. Ask for read-only output first, ask Claude to add -WhatIf support to anything that changes data, and check each cmdlet and parameter against Microsoft Learn before you run it in production.

What should I never paste into a Claude prompt as an admin?

Do not paste passwords, client secrets, API keys, access tokens, recovery keys or unredacted user lists. Replace tenant names, user principal names and IP addresses with placeholders such as contoso.com and [email protected], then substitute the real values yourself when you run the result.

How do I get more accurate PowerShell from Claude?

State the PowerShell version, the module (for example the Microsoft Graph PowerShell SDK), the exact output you want and what the script must not change. Anthropic recommends being specific about output format and constraints, and giving examples of the output you expect.

Does Claude replace checking the official documentation?

No. A model can produce a plausible cmdlet or parameter that does not exist. Verify every cmdlet, parameter, permission scope and portal path on learn.microsoft.com, and run new scripts against a test account or a small pilot group first.

ClaudePowerShellMicrosoft GraphIntunePrompt Engineering
  1. Claude Prompts for Small Business Marketing: Posts, Ads, Replies and Offers

    Fifteen original, copy-paste Claude prompts for small business marketing: social posts, ad copy, email offers and review replies, with US email and endorsement rules to check before you publish.

    AI & automation13 min read
  2. Prompt Engineering Basics for Business Users: Role, Context and Format

    Learn the building blocks of a good business prompt, including goal, role, context, source material, examples and output format, with templates for ChatGPT, Claude and Copilot.

    AI & automation8 min read
  3. 25 Claude Prompts for Work You Can Copy and Paste (Emails, Excel, Reports)

    Twenty-five original, copy-paste Claude prompts for emails, Excel, reports and meetings, plus the Anthropic-documented prompting rules that make them work.

    AI & automation13 min read
  4. 12 Claude Tips and Hidden Features Most People Miss (2026)

    Twelve Claude features and habits that are easy to miss: Projects, memory controls, incognito chats, Artifacts, Skills, upload limits and prompting rules, each with its exact menu path.

    AI & automation13 min read
  5. ChatGPT Business vs Claude Team vs Gemini for Workspace: Plans and Pricing

    Compare team AI plan pricing, seat minimums and data-use terms for ChatGPT Business, Claude Team and Gemini in Google Workspace, from official pages checked October 30, 2026.

    AI & automation9 min read
  6. Summarising Contracts with AI: What to Check Before You Trust It

    How to use ChatGPT, Claude or Copilot to summarise a contract safely, covering data handling, quote-based prompts, a clause checklist and the points a human must verify.

    AI & automation8 min read