AI tools for the practitioner — 2
MCP PowerShell Exec Server is a Model-Context-Protocol (MCP) Server that simplifies the generation and execution of PowerShell scripts using natural language. You can use it to manage your Active Directory using natural language. It was created by Doug Finke.
In this post, I’ll walk you through setting it up step-by-step. You can also check out Doug’s YouTube video on it here.
Pre-Requisites
1. Download and install the latest version of VSCode Insiders, Python, Pip (using Chocolatey)
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
choco install vscode-insiders -y
choco install python -y
python --version
pip --version
2. Install GitHub Copilot Extension
- Open VSCode Insiders → Extensions → “GitHub Copilot”
code-insiders --install-extension GitHub.copilot --pre-release --force
code-insiders --install-extension GitHub.copilot-chat --pre-release --force
code-insiders
Setup
3. Clone the project and open in VS Code Insiders
mkdir mcp-servers
cd mcp-servers
git clone https://github.com/dfinke/mcp-powershell-exec.git
cd mcp-powershell-exec
4. Enable agent mode in VSCode Insiders
cd mcp-powershell-exec
code-insiders .
- Open Copilot chat in VSCode Insiders → Select “Agent” in the lower right corner → Click the refresh button in the chat input to load the available tools
5. Configure MCP Server
- Click on Select Tools… → Add More Tools → Add MCP Server… → Command (stdio)
- Command to run (with optional arguments): py
- Unique identifier for this server: powershell-integration
notepad .vscode/mcp.json
- Modify the value within the args section with the actual path to your
server.py
file.
{
"servers": {
"powershell-integration": {
"command": "py", // Python executable
"args": [
"C:\\Users\\azureadmin\\mcp-servers\\mcp-powershell-exec\\server.py"
],
"env": {}
}
}
}
6. Test and review results
- Select the sales.csv file and run some of the prompts below
sum units by region
- You should see it using the
run_powershell
function which is part of the MCP server that we configured earlier. - Click on Continue to proceed.
- You should see the results
- You can try follow-up prompts like:
price by region
save the script