Powershell 3 Cmdlets Hackerrank Solution Apr 2026

# Get a specific process Execute-Cmdlet -cmdlet "Get-Process" -argument "explorer"

.PARAMETER argument An optional argument to pass to the cmdlet. powershell 3 cmdlets hackerrank solution

# Get all services Execute-Cmdlet -cmdlet "Get-Service" [string]$argument ) &lt

function Execute-Cmdlet { param ( [string]$cmdlet, [string]$argument ) powershell 3 cmdlets hackerrank solution

<# .SYNOPSIS Executes a PowerShell cmdlet.

.DESCRIPTION This function executes a PowerShell cmdlet based on the provided parameters.

The function also includes input validation and provides meaningful error messages.