Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ computer. The call to the `Get-Process` cmdlet is equivalent to the following co
retrieves all the processes whose names start with the characters "a" through "t".

```powershell
Get-Process -name [a-t]*
Get-Process -Name [a-t]*
```

> [!IMPORTANT]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ information about background jobs, see [Background Jobs](./background-jobs.md).
1. Create an object that derives from the
[System.Management.Automation.Job](/dotnet/api/System.Management.Automation.Job) class. This
object can be a custom job object or one of the job objects provided by Windows PowerShell, such
a [System.Management.Automation.Pseventjob](/dotnet/api/System.Management.Automation.PSEventJob)
a [System.Management.Automation.PSEventJob](/dotnet/api/System.Management.Automation.PSEventJob)
object.

The following example shows a custom job object.
Expand Down Expand Up @@ -172,7 +172,7 @@ using System.Diagnostics; // Diagnostics namespace for retrieving
// user/documents/WindowsPowerShell/modules/GetProcessSample06
//
// To import the module, run the following command: Import-Module GetProcessSample06.
// To test the cmdlet, run the following command: Get-Proc -name <process name>
// To test the cmdlet, run the following command: Get-Proc -Name <process name>
//

//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: How to Validate an Argument Count
This example shows how to specify a validation rule that the Windows PowerShell runtime can use to check the number of arguments (the count) that a parameter accepts before the cmdlet is run. You set this validation rule by declaring the ValidateCount attribute.

> [!NOTE]
> For more information about the class that defines this attribute, see [System.Management.Automation.Validatecountattribute](/dotnet/api/System.Management.Automation.ValidateCountAttribute).
> For more information about the class that defines this attribute, see [System.Management.Automation.ValidateCountAttribute](/dotnet/api/System.Management.Automation.ValidateCountAttribute).

## To validate an argument count

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: How to Validate an Argument Pattern
This example shows how to specify a validation rule that the Windows PowerShell runtime can use to check the character pattern of the parameter argument before the cmdlet is run. You set this validation rule by declaring the ValidatePattern attribute.

> [!NOTE]
> For more information about the class that defines this attribute, see [System.Management.Automation.Validatepatternattribute](/dotnet/api/System.Management.Automation.ValidatePatternAttribute).
> For more information about the class that defines this attribute, see [System.Management.Automation.ValidatePatternAttribute](/dotnet/api/System.Management.Automation.ValidatePatternAttribute).

## To validate an argument pattern

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: How to Validate an Argument Range
This example shows how to specify a validation rule that the Windows PowerShell runtime can use to check the minimum and maximum values of the parameter argument before the cmdlet is run. You set this validation rule by declaring the ValidateRange attribute.

> [!NOTE]
> For more information about the class that defines this attribute, see [System.Management.Automation.Validaterangeattribute](/dotnet/api/System.Management.Automation.ValidateRangeAttribute).
> For more information about the class that defines this attribute, see [System.Management.Automation.ValidateRangeAttribute](/dotnet/api/System.Management.Automation.ValidateRangeAttribute).

### To validate an argument range

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: How to Validate an Argument Set
This example shows how to specify a validation rule that the Windows PowerShell runtime can use to check the parameter argument before the cmdlet is run. This validation rule provides a set of the valid values for the parameter argument.

> [!NOTE]
> For more information about the class that defines this attribute, see [System.Management.Automation.Validatesetattribute](/dotnet/api/System.Management.Automation.ValidateSetAttribute).
> For more information about the class that defines this attribute, see [System.Management.Automation.ValidateSetAttribute](/dotnet/api/System.Management.Automation.ValidateSetAttribute).

## To validate an argument set

Expand All @@ -31,7 +31,7 @@ For more information about how to declare this attribute, see [ValidateSet Attri

## See Also

[System.Management.Automation.Validatesetattribute](/dotnet/api/System.Management.Automation.ValidateSetAttribute)
[System.Management.Automation.ValidateSetAttribute](/dotnet/api/System.Management.Automation.ValidateSetAttribute)

[ValidateSet Attribute Declaration](./validateset-attribute-declaration.md)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: How to Validate the Argument Length
This example shows how to specify a validation rule that the Windows PowerShell runtime can use to check the number of characters (the length) of the parameter argument before the cmdlet is run. You set this validation rule by declaring the ValidateLength attribute.

> [!NOTE]
> For more information about the class that defines this attribute, see [System.Management.Automation.Validatelengthattribute](/dotnet/api/System.Management.Automation.ValidateLengthAttribute).
> For more information about the class that defines this attribute, see [System.Management.Automation.ValidateLengthAttribute](/dotnet/api/System.Management.Automation.ValidateLengthAttribute).

## To validate the argument length

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ used to identify the error. This information is available through the following

- [System.Management.Automation.Cmdlet.WriteError][4]

- [System.Management.Automation.Cmdlet.Throwterminatingerror*][3]
- [System.Management.Automation.Cmdlet.ThrowTerminatingError*][3]

- [Adding Non-Terminating Error Reporting to Your Cmdlet](./adding-non-terminating-error-reporting-to-your-cmdlet.md)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ hidden from the user for tab expansion and IntelliSense. The default is `false`.

## See Also

- [System.Management.Automation.Parameterattribute][05]
- [System.Management.Automation.ParameterAttribute][05]
- [Cmdlet Parameter Names][07]
- [Writing a Windows PowerShell Cmdlet][02]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ If the cmdlet or provider must send a message but not request confirmation, it c

Cmdlets and providers first call the following methods to request confirmation before they attempt to perform an operation that changes a system outside of Windows PowerShell:

- [System.Management.Automation.Cmdlet.Shouldprocess](/dotnet/api/System.Management.Automation.Cmdlet.ShouldProcess)
- [System.Management.Automation.Cmdlet.ShouldProcess](/dotnet/api/System.Management.Automation.Cmdlet.ShouldProcess)

- [System.Management.Automation.Provider.Cmdletprovider.Shouldprocess](/dotnet/api/System.Management.Automation.Provider.CmdletProvider.ShouldProcess)
- [System.Management.Automation.Provider.CmdletProvider.ShouldProcess](/dotnet/api/System.Management.Automation.Provider.CmdletProvider.ShouldProcess)

They do so by calling the [System.Management.Automation.Cmdlet.Shouldprocess](/dotnet/api/System.Management.Automation.Cmdlet.ShouldProcess) method, which prompts the user to confirm the operation based on how the user invoked the command.
They do so by calling the [System.Management.Automation.Cmdlet.ShouldProcess](/dotnet/api/System.Management.Automation.Cmdlet.ShouldProcess) method, which prompts the user to confirm the operation based on how the user invoked the command.

## See Also

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ The verb specified in the Cmdlet attribute must come from the recognized set of

- [System.Management.Automation.VerbsDiagnostic](/dotnet/api/System.Management.Automation.VerbsDiagnostic)

- [System.Management.Automation.VerbsLifeCycle](/dotnet/api/System.Management.Automation.VerbsLifeCycle)
- [System.Management.Automation.VerbsLifecycle](/dotnet/api/System.Management.Automation.VerbsLifecycle)

- [System.Management.Automation.VerbsSecurity](/dotnet/api/System.Management.Automation.VerbsSecurity)

- [System.Management.Automation.VerbsOther](/dotnet/api/System.Management.Automation.VerbsOther)

For more information about the approved verb names, see [Cmdlet Verbs](./approved-verbs-for-windows-powershell-commands.md).

Users need a set of discoverable and expected cmdlet names. Use the appropriate verb so that the user can make a quick assessment of what a cmdlet does and to easily discover the capabilities of the system. For example, the following command-line command gets a list of all the commands on the system whose names begin with "start": `get-command start-*`. Use the nouns in your cmdlets to differentiate your cmdlets from other cmdlets. The noun indicates the resource on which the operation will be performed. The operation itself is represented by the verb.
Users need a set of discoverable and expected cmdlet names. Use the appropriate verb so that the user can make a quick assessment of what a cmdlet does and to easily discover the capabilities of the system. For example, the following command-line command gets a list of all the commands on the system whose names begin with "Start": `Get-Command Start-*`. Use the nouns in your cmdlets to differentiate your cmdlets from other cmdlets. The noun indicates the resource on which the operation will be performed. The operation itself is represented by the verb.

### Cmdlet Names: Characters that cannot be Used (RD02)

Expand Down Expand Up @@ -123,15 +123,15 @@ If your cmdlet is used interactively, always provide a Force parameter to overri

- [System.Management.Automation.Host.PSHostUserInterface.Prompt*](/dotnet/api/System.Management.Automation.Host.PSHostUserInterface.Prompt)

- [System.Management.Automation.Host.Pshostuserinterface.PromptForChoice](/dotnet/api/System.Management.Automation.Host.PSHostUserInterface.PromptForChoice)
- [System.Management.Automation.Host.PSHostUserInterface.PromptForChoice](/dotnet/api/System.Management.Automation.Host.PSHostUserInterface.PromptForChoice)

- [System.Management.Automation.Host.Ihostuisupportsmultiplechoiceselection.PromptForChoice](/dotnet/api/System.Management.Automation.Host.IHostUISupportsMultipleChoiceSelection.PromptForChoice)
- [System.Management.Automation.Host.IHostUISupportsMultipleChoiceSelection.PromptForChoice](/dotnet/api/System.Management.Automation.Host.IHostUISupportsMultipleChoiceSelection.PromptForChoice)

- [System.Management.Automation.Host.Pshostuserinterface.PromptForCredential*](/dotnet/api/System.Management.Automation.Host.PSHostUserInterface.PromptForCredential)
- [System.Management.Automation.Host.PSHostUserInterface.PromptForCredential*](/dotnet/api/System.Management.Automation.Host.PSHostUserInterface.PromptForCredential)

- [System.Management.Automation.Host.Pshostuserinterface.ReadLine*](/dotnet/api/System.Management.Automation.Host.PSHostUserInterface.ReadLine)
- [System.Management.Automation.Host.PSHostUserInterface.ReadLine*](/dotnet/api/System.Management.Automation.Host.PSHostUserInterface.ReadLine)

- [System.Management.Automation.Host.Pshostuserinterface.ReadLineAsSecureString*](/dotnet/api/System.Management.Automation.Host.PSHostUserInterface.ReadLineAsSecureString)
- [System.Management.Automation.Host.PSHostUserInterface.ReadLineAsSecureString*](/dotnet/api/System.Management.Automation.Host.PSHostUserInterface.ReadLineAsSecureString)

### Document Output Objects (RD06)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ PowerShell 2.0.

1. Run the following command to run the cmdlet:

`stop-proc`
`Stop-Proc`

## Requirements

Expand Down Expand Up @@ -77,7 +77,7 @@ namespace Microsoft.Samples.PowerShell.Commands
#region StopProcCommand

/// <summary>
/// This class implements the stop-proc cmdlet.
/// This class implements the Stop-Proc cmdlet.
/// </summary>
[Cmdlet(VerbsLifecycle.Stop, "Proc",
SupportsShouldProcess = true)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ similar to the `Stop-Process` cmdlet provided by Windows PowerShell 2.0.

1. Run the following command to run the cmdlet:

`stop-proc`
`Stop-Proc`

## Requirements

Expand Down Expand Up @@ -82,7 +82,7 @@ namespace Microsoft.Samples.PowerShell.Commands
#region StopProcCommand

/// <summary>
/// This class implements the stop-proc cmdlet.
/// This class implements the Stop-Proc cmdlet.
/// </summary>
[Cmdlet(VerbsLifecycle.Stop, "Proc",
SupportsShouldProcess = true)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PowerShell 2.0.

1. Run the following command to run the cmdlet:

`stop-proc`
`Stop-Proc`

## Requirements

Expand Down Expand Up @@ -74,7 +74,7 @@ namespace Microsoft.Samples.PowerShell.Commands
#region StopProcCommand

/// <summary>
/// This class implements the stop-proc cmdlet.
/// This class implements the Stop-Proc cmdlet.
/// </summary>
[Cmdlet(VerbsLifecycle.Stop, "Proc",
SupportsShouldProcess = true)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ provided by Windows PowerShell 2.0.

1. Run the following command to run the cmdlet:

`stop-proc`
`Stop-Proc`

## Requirements

Expand Down Expand Up @@ -79,7 +79,7 @@ namespace Microsoft.Samples.PowerShell.Commands
#region StopProcCommand

/// <summary>
/// This class implements the stop-proc cmdlet.
/// This class implements the Stop-Proc cmdlet.
/// </summary>
[Cmdlet(VerbsLifecycle.Stop, "Proc",
DefaultParameterSetName = "ProcessId",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ characters is not required, define a `LiteralPath` parameter.

If the data that the cmdlet reads or writes has to be a file, the cmdlet should accept Windows
PowerShell path input, and the cmdlet should use the
[System.Management.Automation.Sessionstate.Path](/dotnet/api/System.Management.Automation.SessionState.Path)
[System.Management.Automation.SessionState.Path](/dotnet/api/System.Management.Automation.SessionState.Path)
property to translate the Windows PowerShell paths into paths that the file system recognizes. The
specific mechanisms include the following methods:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ Windows PowerShell supports the following wildcard characters.

When you design cmdlets that support wildcard characters, allow for combinations of wildcard
characters. For example, the following command uses the `Get-ChildItem` cmdlet to retrieve all the
.txt files that are in the c:\Techdocs folder and that begin with the letters "a" through "l."
.txt files that are in the C:\Techdocs folder and that begin with the letters "a" through "l."

`Get-ChildItem c:\techdocs\[a-l]\*.txt`
`Get-ChildItem C:\techdocs\[a-l]\*.txt`

The previous command uses the range wildcard `[a-l]` to specify that the file name should begin
with the characters "a" through "l" and uses the `*` wildcard character as a placeholder
Expand All @@ -49,7 +49,7 @@ for any characters between the first letter of the filename and the **.txt** ext
The following example uses a range wildcard pattern that excludes the letter "d" but includes all
the other letters from "a" through "f."

`Get-ChildItem c:\techdocs\[a-cef]\*.txt`
`Get-ChildItem C:\techdocs\[a-cef]\*.txt`

## Handling Literal Characters in Wildcard Patterns

Expand Down
Loading