Skip to content

Instantly share code, notes, and snippets.

View Sarafian's full-sized avatar

Alex Sarafian Sarafian

View GitHub Profile
@Sarafian
Sarafian / Invoke-CommandWrap.ps1
Last active December 18, 2016 16:32
PowerShell - InvokeCommand local or remote
<#
.SYNOPSIS
Wraps the Invoke-Command to seamlessy execute script blocks remote or local
.DESCRIPTION
Invoke-Command does not provide a transparent method to execute script blocks locally or remotely without conditions. This limited wrapper commandlet does this.
Every blocked is wrapped with logging statements
.PARAMETER ScriptBlock
The script block
.PARAMETER BlockName
Name of the block. This is for logging purposes.