Created
September 16, 2016 17:38
-
-
Save BenjaminArmstrong/d36f5e6980a0b8ad2093eebb7106b467 to your computer and use it in GitHub Desktop.
PowerShell Direct Tips - Functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Logger { | |
# Do pretty logging of information | |
} | |
function cleanupFile { | |
# Do some repetitive file manipulation | |
} | |
function PrepVM { | |
# Setup things inside a VM | |
} | |
$FunctionDefs = "function PrepVM { ${function:PrepVM} }; function cleanupFile { ${function:cleanupFile} }; function logger { ${function:logger} }" | |
Invoke-Command -VMName "Test" { | |
. ([ScriptBlock]::Create($Using:FunctionDefs)) | |
PrepVM | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment