New-BluGenieCommand



New-BluGenieCommand

SYNOPSIS

New-BluGenieCommand will take a list of arguments and build out a command line string for [ScriptBlock] execution

SYNTAX

New-BluGenieCommand [[-Name] <String>] [[-BoundParameters] <Object>] [[-Walkthrough]] [<CommonParameters>]

DESCRIPTION

New-BluGenieCommand will take a list of arguments and build out a command line string for [ScriptBlock] execution

The advantage of this script is to take arguments from the parent functions $PSBoundParameters and use them to execute nested cmdlets

EXAMPLES

EXAMPLE 1

$Source = "$ScriptDirectory\Tools\SysinternalsSuite"
$Destination = "C:\Source"
$Container = $true
$Recurse = $false
$Force = $false

$ArrParamList = [PSCustomObject]@{
   'Path' = $Source
   'Destination' = $Destination
   'Filter' = $Filter
   'Container' = $Container
   'Include' = $Include
   'Exclude' = $Exclude
   'Recurse' = $Recurse
   'Force' = $Force
}

New-BluGenieCommand -Name 'Copy-Item' -BoundParameters $ArrParamList -ErrorAction SilentlyContinue

$NewCommand.Invoke()

This will dynamically build out the Copy-Item string from the variables defined (normally $PSBoundParameters from the parent script)
and invoke the command.

PARAMETERS

Name

BoundParameters

Walkthrough

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Last updated