< Back

Get-PSFScriptblock

Sun Jan 19, 2020 6:40 pm

NAME Get-PSFScriptblock



SYNOPSIS

Access the scriptblocks stored with Set-PSFScriptblock.





SYNTAX

Get-PSFScriptblock -Name <String[]> [<CommonParameters>]



Get-PSFScriptblock [-Name <String[]>] -List [<CommonParameters>]





DESCRIPTION

Access the scriptblocks stored with Set-PSFScriptblock.



Use this command to access scriptblocks designed for easy, processwide access.





PARAMETERS

-Name <String[]>

The name of the scriptblock to request.

It's mandatory for explicitly requesting a scriptblock, but optional to use with -List as a filter.



Required? true

Position? named

Default value *

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-List [<SwitchParameter>]

Instead of requesting a specific scriptblock, list the available ones.

This can be further filtered by using a wildcard supporting string as -Name.



Required? true

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

PSFramework.Utility.ScriptBlockItem



System.Management.Automation.ScriptBlock





-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Get-PSFScriptblock -Name 'MyModule.TestServer'



Returns the scriptblock stored as 'MyModule.TestServer'









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Get-PSFScriptblock -List



Returns a list of all scriptblocks









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Get-PSFScriptblock -List -Name 'MyModule.TestServer'



Returns scriptblock and meta information for the MyModule.TestServer scriptblock.











RELATED LINKS