Skip to main content
Glama
basic_script.ps11.45 kB
<# .SYNOPSIS {{SYNOPSIS}} .DESCRIPTION {{DESCRIPTION}} .PARAMETER Param1 {{PARAM1_DESCRIPTION}} .PARAMETER Param2 {{PARAM2_DESCRIPTION}} .EXAMPLE {{EXAMPLE}} .NOTES Author: PowerShell MCP Server Date: {{DATE}} #> param ( [Parameter(Mandatory=${{PARAM1_MANDATORY}})] [string]$Param1 = "{{PARAM1_DEFAULT}}", [Parameter(Mandatory=${{PARAM2_MANDATORY}})] [string]$Param2 = "{{PARAM2_DEFAULT}}" ) # Function to write log messages function Write-Log { param ( [Parameter(Mandatory=$true)] [string]$Message, [Parameter(Mandatory=$false)] [ValidateSet("INFO", "WARNING", "ERROR")] [string]$Level = "INFO" ) $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss" Write-Host "[$timestamp] [$Level] $Message" } # Function to handle errors function Handle-Error { param ( [Parameter(Mandatory=$true)] [System.Management.Automation.ErrorRecord]$ErrorRecord ) Write-Log -Level ERROR -Message "Error occurred: $($ErrorRecord.Exception.Message)" Write-Log -Level ERROR -Message "Error details: $($ErrorRecord | Out-String)" } # Main execution try { Write-Log "Starting script execution..." # Your code here {{MAIN_CODE}} Write-Log "Script completed successfully." } catch { Handle-Error -ErrorRecord $_ exit 1 }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/DynamicEndpoints/PowerShell-Exec-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server