Skip to content

Instantly share code, notes, and snippets.

@RafPe
Last active May 2, 2017 15:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RafPe/f16e471ea47a248a8a0a to your computer and use it in GitHub Desktop.
Save RafPe/f16e471ea47a248a8a0a to your computer and use it in GitHub Desktop.
function Export-FunctionRemote
{
<#
.SYNOPSIS
Exports function to String ScriptBlock
.PARAMETER functionName
this is object type data coming via pipeline
.DESCRIPTION
This cmdlet compares generic property names and values and return data if they match parameters passed.
Be aware that it lowers the characters for being compliant with all remaining functions
.EXAMPLE
$mtFunction = Export-FunctionRemote
#>
param
(
$name
)
$function = $(Get-Content function:\$name)
$result = "Function $name {"
$result += $function
$result += '}'
return $result
}
@ward0
Copy link

ward0 commented Feb 5, 2016

Where is the new stored please?

I'm calling your script like so at the moment but not finding the new function ?

PS C:\Users> Export-FunctionRemote -name WebAdministration
Function WebAdministration {
if(-Not(Get-Module -ListAvailable -Name 'WebAdministration'))
{
Write-Logging -level Error "MODULE : WebAdministration CANNOT be imported on $env:computername"
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment