Functions/commands.ps1
function Execute-Commands( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [object[]]$commands, [string[]]$excludeList) { foreach ($cmd in ($commands | Where-Object {($_.PSObject.Properties.Name -CNotIn $excludeList)})) { $cmdName = $cmd.PSObject.Properties.Name $cmdExec = $cmd.PSObject.Properties.Value Write-Host "Execute command '$cmdName': '$cmdExec'..." -ForegroundColor Cyan Invoke-Expression $cmdExec } } |