< Back
Register-AutonanceExtension
Post
NAME Register-AutonanceExtension
SYNOPSIS
Register an Autonance extension.
SYNTAX
Register-AutonanceExtension [-Name] <String> [-ScriptBlock] <ScriptBlock> [<CommonParameters>]
DESCRIPTION
This function will register a new Autonance extension, by creating a global
function with the specified extension name. The function can be called like
all other DSL tasks in the Maintenance block.
The script block can contain a parameter block, to specify the parameters
provided to the cmdlet. If a parameter $Credential is used, the credentials
will automatically be passed to the sub task, if specified. The function
Write-AutonanceMessage can be used to return status messages. The Autonance
module will take care of the formatting.
PARAMETERS
-Name <String>
Extension function name.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ScriptBlock <ScriptBlock>
Script block to execute for the extension.
Required? true
Position? 2
Default value
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
NOTES
Author : Claudio Spizzi
License : MIT License
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>
Register-AutonanceExtension -Name 'WsusReport' -ScriptBlock {
[CmdletBinding()]
param
(
[Parameter(Mandatory = $true, Position = 0)]
[System.String]
$ComputerName,
[Parameter(Mandatory = $false)]
[System.Management.Automation.PSCredential]
[System.Management.Automation.Credential()]
$Credential,
)
if ($null -eq $Credential)
{
Invoke-Command -ComputerName $ComputerName -ScriptBlock { wuauclt.exe /ReportNow }
}
else
{
Invoke-Command -ComputerName $ComputerName -Credential $Credential -ScriptBlock { wuauclt.exe /ReportNow }
}
}
Register an Autonance extension to invoke the report now command for WSUS.
RELATED LINKS
https://github.com/claudiospizzi/Autonance
SYNOPSIS
Register an Autonance extension.
SYNTAX
Register-AutonanceExtension [-Name] <String> [-ScriptBlock] <ScriptBlock> [<CommonParameters>]
DESCRIPTION
This function will register a new Autonance extension, by creating a global
function with the specified extension name. The function can be called like
all other DSL tasks in the Maintenance block.
The script block can contain a parameter block, to specify the parameters
provided to the cmdlet. If a parameter $Credential is used, the credentials
will automatically be passed to the sub task, if specified. The function
Write-AutonanceMessage can be used to return status messages. The Autonance
module will take care of the formatting.
PARAMETERS
-Name <String>
Extension function name.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ScriptBlock <ScriptBlock>
Script block to execute for the extension.
Required? true
Position? 2
Default value
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
NOTES
Author : Claudio Spizzi
License : MIT License
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>
Register-AutonanceExtension -Name 'WsusReport' -ScriptBlock {
[CmdletBinding()]
param
(
[Parameter(Mandatory = $true, Position = 0)]
[System.String]
$ComputerName,
[Parameter(Mandatory = $false)]
[System.Management.Automation.PSCredential]
[System.Management.Automation.Credential()]
$Credential,
)
if ($null -eq $Credential)
{
Invoke-Command -ComputerName $ComputerName -ScriptBlock { wuauclt.exe /ReportNow }
}
else
{
Invoke-Command -ComputerName $ComputerName -Credential $Credential -ScriptBlock { wuauclt.exe /ReportNow }
}
}
Register an Autonance extension to invoke the report now command for WSUS.
RELATED LINKS
https://github.com/claudiospizzi/Autonance