Databases Reference
In-Depth Information
function Get-SQLProcess
{
<#
.SYNOPSIS
Retrieves processes starting with the term SQL
.DESCRIPTION
The Get-SQLProcess function uses the Get-Process Cmdlet to retrieve all the
processes
that start with SQL from the local computer.
#>
[CmdletBinding()]
Param()
Process
{
Get-Process SQL*
}
}
After this code has been executed by the PowerShell environment, you'll be able to call this function;
and because it uses the CmdletBinding attribute, which differentiates the advanced function from a
standard function, PowerShell will treat it like a compiled cmdlet — meaning it will have autocom-
plete and be listed among the available cmdlets. I've also written some simple documentation for the
preceding example, so this function now has help as well. The following listing shows the documen-
tation that is displayed for this function when Get-Help is called on it:
PS > Get-Help Get-SQLProcess
NAME
Get-SQLProcess
SYNOPSIS
Retrieves processes starting with the term SQL
SYNTAX
Get-SQLProcess [<CommonParameters>]
DESCRIPTION
The Get-SQLProcess function uses the Get-Process Cmdlet to retrieve all the
processes that start with SQL from the local computer.
RELATED LINKS
REMARKS
To see the examples, type: "get-help Get-SQLProcess -examples".
For more information, type: "get-help Get-SQLProcess -detailed".
For technical information, type: "get-help Get-SQLProcess -full".
Search WWH ::




Custom Search