Skip to content

Instantly share code, notes, and snippets.

@WimObiwan
Last active August 21, 2016 19:54
Show Gist options
  • Save WimObiwan/3336a44f3d0220eeca746dd91f00613c to your computer and use it in GitHub Desktop.
Save WimObiwan/3336a44f3d0220eeca746dd91f00613c to your computer and use it in GitHub Desktop.
[CmdletBinding(SupportsShouldProcess)]
Param (
...
)
...
$current_item = 'X'
if ($PSCmdlet.ShouldProcess($name, "My very dangerous operation on $current_item")) {
...
}
...
function Verb-Command
{
<#
.SYNOPSIS
Synopsis
.DESCRIPTION
Description
.PARAMETER Parameter1
Parameter1
.PARAMETER Parameter2
Parameter2
.EXAMPLE
Verb-Command -Parameter1
Description
-----------
This is an example.
.EXAMPLE
Verb-Command -Parameter2
Description
-----------
This is another example.
.EXAMPLE
Verb-Command -Parameter1 -Parameter2
Description
-----------
This is another example.
.INPUTS
System.Diagnostics.Process
You can pipe a process object to Verb-Command.
.OUTPUTS
System.IO.FileInfo
.LINK
http://www.foxinnovations.be/
#>
[CmdletBinding()]
Param (
[Parameter(Position = 0, Mandatory = $True, ValueFromPipeline = $True)]
[System.Diagnostics.Process]
$Process,
[Parameter(Position = 1)]
[ValidateScript({ Test-Path $_ })]
[String]
$DumpFilePath = $PWD
)
BEGIN
{
}
PROCESS
{
}
END
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment