Session
Is Your PowerShell Script Safe for an Agent?
An MCP server can expose a PowerShell function to an AI agent in a few minutes. That does not make the function safe to run against production.
In this talk, an agent helps investigate a service problem. It can read health data and logs, then propose a PowerShell action. Before it can make a change, we rebuild that action as something we would trust during an incident. That means explicit, validated parameters, structured output, terminating errors, and safe repeated runs. `SupportsShouldProcess` and `-WhatIf` make the intended change visible before it happens.
The PowerShell function is only part of the boundary. We will separate read actions from write actions, limit permissions, require approval for risky commands, record what the agent did, and plan how to undo it. The same rules help whether the caller is Copilot, an MCP client, a scheduled job, or another engineer.
PowerShell practitioners experimenting with agents can use the final checklist to decide which scripts are ready for an agent and which ones still need work.
Chris Ayers
Principal Software Engineer @ Microsoft
Tampa, Florida, United States
Links
Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.
Jump to top