< Back
Get-AstObject
Post
NAME Get-AstObject
SYNOPSIS
Returns all the AST objects in a script that are of a specified type.
SYNTAX
Get-AstObject [-ScriptPath] <String> [-Type] <String> [-ExactType] [<CommonParameters>]
DESCRIPTION
Takes the content of a script, parses it, and returns all the objects in a script that are of that type.
PARAMETERS
-ScriptPath <String>
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Type <String>
Required? true
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ExactType [<SwitchParameter>]
Required? false
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
System.Management.Automation.PSObject[]
NOTES
Author: Thomas Rayner (@MrThomasRayner), workingsysadmin.com
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Get-AstObject -ScriptPath .\\MyScript.ps1 -Type CommandAst
RELATED LINKS
http://workingsysadmin.com
SYNOPSIS
Returns all the AST objects in a script that are of a specified type.
SYNTAX
Get-AstObject [-ScriptPath] <String> [-Type] <String> [-ExactType] [<CommonParameters>]
DESCRIPTION
Takes the content of a script, parses it, and returns all the objects in a script that are of that type.
PARAMETERS
-ScriptPath <String>
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Type <String>
Required? true
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ExactType [<SwitchParameter>]
Required? false
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
System.Management.Automation.PSObject[]
NOTES
Author: Thomas Rayner (@MrThomasRayner), workingsysadmin.com
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Get-AstObject -ScriptPath .\\MyScript.ps1 -Type CommandAst
RELATED LINKS
http://workingsysadmin.com