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
18 changes: 9 additions & 9 deletions reference/5.1/CimCmdlets/Remove-CimInstance.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
external help file: Microsoft.Management.Infrastructure.CimCmdlets.dll-Help.xml
Locale: en-US
Module Name: CimCmdlets
ms.date: 06/21/2021
ms.date: 05/17/2022
online version: https://docs.microsoft.com/powershell/module/cimcmdlets/remove-ciminstance?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
title: Remove-CimInstance
Expand Down Expand Up @@ -151,7 +151,7 @@ Accept wildcard characters: False

### -Namespace

Specifies the namespace for the CIM operation. The default namespace is **root/cimv2**. You can use
Specifies the namespace for the CIM operation. The default namespace is `root/cimv2`. You can use
tab completion to browse the list of namespaces, because PowerShell gets a list of namespaces from
the local WMI server to provide the list of namespaces.

Expand All @@ -170,7 +170,7 @@ Accept wildcard characters: False
### -OperationTimeoutSec

Specifies the amount of time that the cmdlet waits for a response from the computer. By default, the
value of this parameter is 0, which means that the cmdlet uses the default timeout value for the
value of this parameter is `0`, which means that the cmdlet uses the default timeout value for the
server.

If the **OperationTimeoutSec** parameter is set to a value less than the robust connection retry
Expand All @@ -195,10 +195,10 @@ Accept wildcard characters: False
Specifies a query to run on the CIM server. You can specify the query dialect using the
**QueryDialect** parameter.

If the value specified contains double quotes ("), single quotes ('), or a backslash (`\`), you must
escape those characters by prefixing them with the backslash (`\`) character. If the value specified
uses the WQL LIKE operator, then you must escape the following characters by enclosing them in
square brackets (`[]`): percent (%), underscore (`_`), or opening square bracket (`[`).
If the value specified contains double quotes (`"`), single quotes (`'`), or a backslash (`\`), you
must escape those characters by prefixing them with the backslash (`\`) character. If the value
specified uses the WQL `LIKE` operator, then you must escape the following characters by enclosing
them in square brackets (`[]`): percent (`%`), underscore (`_`), or opening square bracket (`[`).

```yaml
Type: System.String
Expand All @@ -215,7 +215,7 @@ Accept wildcard characters: False
### -QueryDialect

Specifies the query language used for the Query parameter. The acceptable values for this parameter
are: **WQL** or **CQL**. The default value is **WQL**.
are: `WQL` or `CQL`. The default value is `WQL`.

```yaml
Type: System.String
Expand Down Expand Up @@ -245,7 +245,7 @@ By default, if you do not specify this parameter, the DMTF standard resource URI
ResourceURI can only be used with CIM sessions created using the WSMan protocol, or when specifying
the ComputerName parameter, which creates a CIM session using WSMan. If you specify this parameter
without specifying the ComputerName parameter, or if you specify a CIM session created using DCOM
protocol, you will get an error, because the DCOM protocol does not support the ResourceURI
protocol, you get an error, because the DCOM protocol does not support the **ResourceURI**
parameter.

If both the **ResourceUri** parameter and the **Filter** parameter are specified, the **Filter**
Expand Down
14 changes: 7 additions & 7 deletions reference/5.1/ISE/Import-IseSnippet.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
external help file: ISE-help.xml
Locale: en-US
Module Name: ISE
ms.date: 06/09/2017
ms.date: 05/17/2022
online version: https://docs.microsoft.com/powershell/module/ise/import-isesnippet?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
title: Import-IseSnippet
Expand Down Expand Up @@ -75,7 +75,7 @@ Import-IseSnippet -Module SnippetModule -ListAvailable

### Example 3: Find snippets in modules

This example gets snippets in all installed modules in the PSModulePath environment variable.
This example gets snippets in all installed modules in the **PSModulePath** environment variable.

```powershell
($env:PSModulePath).split(";") |
Expand All @@ -97,9 +97,9 @@ you don't need to run a command like this because modules that have snippets wil

### Example 5: Copy all module snippets

This example copies the snippet files from all installed modules into the Snippets directory of the
current user. Unlike imported snippets, which affect only the current session, copied snippets are
available in every Windows PowerShell ISE session.
This example copies the snippet files from all installed modules into the `Snippets` directory of
the current user. Unlike imported snippets, which affect only the current session, copied snippets
are available in every Windows PowerShell ISE session.

```powershell
($env:PSModulePath).split(";") |
Expand Down Expand Up @@ -135,8 +135,8 @@ Accept wildcard characters: False
Imports snippets from the specified module into the current session. Wildcard characters are not
supported.

This parameter imports snippets from Snippet.ps1xml files in the Snippets subdirectory in the module
path, such as `$home\Documents\WindowsPowerShell\Modules\<ModuleName>\Snippets`.
This parameter imports snippets from `Snippet.ps1xml` files in the Snippets subdirectory in the
module path, such as `$home\Documents\WindowsPowerShell\Modules\<ModuleName>\Snippets`.

This parameter is designed to be used by module authors in a startup script, such as a script
specified in the **ScriptsToProcess** key of a module manifest. Snippets in a module are not
Expand Down
76 changes: 53 additions & 23 deletions reference/5.1/Microsoft.PowerShell.Core/About/about_Parsing.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Describes how PowerShell parses commands.
Locale: en-US
ms.date: 05/16/2022
ms.date: 05/17/2022
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_parsing?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about Parsing
Expand Down Expand Up @@ -200,15 +200,14 @@ prevent PowerShell from misinterpreting the parentheses.
icacls X:\VMS /grant Dom\HVAdmin:`(CI`)`(OI`)F
```

Beginning in PowerShell 3.0, you can use the _stop-parsing_ (`--%`) and
_end-of-parameters_ tokens (`--`) to stop PowerShell from interpreting input as
PowerShell commands or expressions.
### The stop-parsing token

Beginning in PowerShell 3.0, you can use the _stop-parsing_ (`--%`) token to
stop PowerShell from interpreting input as PowerShell commands or expressions.

> [!NOTE]
> The stop-parsing token is only intended for use on Windows platforms.

### The stop-parsing token

When calling a native command, place the stop-parsing token before the program
arguments. This technique is much easier than using escape characters to
prevent misinterpretation.
Expand Down Expand Up @@ -239,23 +238,6 @@ variable the token is passed through as-is.
You cannot use stream redirection (like `>file.txt`) because they are passed
verbatim as arguments to the target command.

### The end-of-parameters token

The end-of-parameters token (`--`) indicates that all arguments following it
are to be passed in their actual form as though double quotes were placed
around them. For example, using `--` you can output the string `-InputObject`
without using quotes or having it interpreted as a parameter:

```powershell
Write-Output -- -InputObject
```

```Output
-InputObject
```

This is a convention specified in the POSIX Shell and Utilities specification.

### Passing arguments that contain quote characters

Some native commands expect arguments that contain quote characters. Normally,
Expand Down Expand Up @@ -299,6 +281,54 @@ Arg 0 is <"C:\Program Files (x86)\Microsoft\">
You can build `TestExe` from the source code. See
[TestExe](https://github.com/PowerShell/PowerShell/blob/master/test/tools/TestExe/TestExe.cs).

## Passing arguments to PowerShell commands

Beginning in PowerShell 3.0, you can use the _end-of-parameters_ token (`--`)
to stop PowerShell from interpreting input as PowerShell parameters. This is a
convention specified in the POSIX Shell and Utilities specification.

The end-of-parameters token (`--`) indicates that all arguments following it
are to be passed in their actual form as though double quotes were placed
around them. For example, using `--` you can output the string `-InputObject`
without using quotes or having it interpreted as a parameter:

```powershell
Write-Output -- -InputObject
```

```Output
-InputObject
```

Unlike the stop-parsing (`--%`) token, any values following the `--` token can
be interpreted as expressions by PowerShell.

```powershell
Write-Output -- -InputObject $env:PROCESSOR_ARCHITECTURE
```

```Output
-InputObject
AMD64
```

This behavior only applies to PowerShell commands. If you use the `--` token
when calling an external command, the `--` string is passed as an argument to
that command.

```powershell
TestExe -echoargs -a -b -- -c
```

The output shows that `--` is passed as an argument to `TestExe`.

```Output
Arg 0 is <-a>
Arg 1 is <-b>
Arg 2 is <-->
Arg 3 is <-c>
```

## See also

- [about_Command_Syntax](about_Command_Syntax.md)
33 changes: 17 additions & 16 deletions reference/5.1/Microsoft.PowerShell.Diagnostics/Export-Counter.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
external help file: Microsoft.PowerShell.Commands.Diagnostics.dll-help.xml
Locale: en-US
Module Name: Microsoft.PowerShell.Diagnostics
ms.date: 10/12/2020
ms.date: 05/17/2022
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.diagnostics/export-counter?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
title: Export-Counter
Expand All @@ -22,9 +22,9 @@ Export-Counter [-Path] <String> [-FileFormat <String>] [-MaxSize <UInt32>]

## DESCRIPTION

The `Export-Counter` cmdlet exports performance counter data (PerformanceCounterSampleSet objects)
to log files in binary performance log (.blg), comma-separated value (.csv), or tab-separated value
(.tsv) format. You use this cmdlet to log performance counter data.
The `Export-Counter` cmdlet exports performance counter data (**PerformanceCounterSampleSet**
objects) to log files in binary performance log (`.blg`), comma-separated value (`.csv`), or
tab-separated value (`.tsv`) format. You use this cmdlet to log performance counter data.

The `Export-Counter` cmdlet is designed to export data that is returned by the `Get-Counter` and
`Import-Counter` cmdlets.
Expand All @@ -42,8 +42,8 @@ Get-Counter "\Processor(*)\% Processor Time" | Export-Counter -Path $home\Counte
```

The command uses the `Get-Counter` cmdlet to collect processor time data. It uses a pipeline
operator (|) to send the data to the `Export-Counter` cmdlet. The `Export-Counter` command uses the
**Path** variable to specify the output file.
operator (`|`) to send the data to the `Export-Counter` cmdlet. The `Export-Counter` command uses
the **Path** variable to specify the output file.

Because the data set might be very large, this example sends the data to `Export-Counter` through
the pipeline. If the data were saved in a variable, you might use a disproportionate amount of
Expand Down Expand Up @@ -74,7 +74,7 @@ The first command uses the `Get-Counter` cmdlet to collect working set counter d
remote computer. The command saves the data in the `$C` variable.

The second command uses a pipeline operator (`|`) to send the data in `$C` to the `Export-Counter`
cmdlet, which saves it in the `Workingset.blg` file in the Perf share of the Server01 computer.
cmdlet, which saves it in the `Workingset.blg` file in the `Perf` share of the Server01 computer.

```powershell
$C = Get-Counter -ComputerName Server01 -Counter "\Process(*)\Working Set - Private" -MaxSamples $C | Export-Counter -Path \\Server01\Perf\WorkingSet.blg
Expand All @@ -90,15 +90,15 @@ This example shows how to use the `Import-Counter` and `Export-Counter` cmdlets
data.

The first command uses the `Import-Counter` cmdlet to import performance counter data from the
DiskSpace.blg log. It saves the data in the `$All` variable. This file contains samples of the
`DiskSpace.blg` log. It saves the data in the `$All` variable. This file contains samples of the
"LogicalDisk\% Free Space" counter on more than 200 remote computers in the enterprise.

The second command uses the `Where-Object` cmdlet to select objects with **CookedValue** of less
than 15 (percent). The command saves the results in the `$LowSpace` variable.

The third command uses a pipeline operator (`|`) to send the data in the `$LowSpace` variable to the
`Export-Counter` cmdlet. The command uses the **Path** parameter to indicate that the selected data
should be logged in the LowDiskSpace.blg file.
should be logged in the `LowDiskSpace.blg` file.

```powershell
$All = Import-Counter DiskSpace.blg
Expand All @@ -110,8 +110,8 @@ $LowSpace | Export-Counter -Path LowDiskSpace.blg

### -Circular

Indicates that the output file is a circular log with first in, first out (FIFO) format.
When you include this parameter, the **MaxSize** parameter is required.
Indicates that the output file is a circular log with first in, first out (FIFO) format. When you
include this parameter, the **MaxSize** parameter is required.

```yaml
Type: System.Management.Automation.SwitchParameter
Expand All @@ -131,11 +131,11 @@ Specifies the output format of the output log file.

The acceptable values for this parameter are:

- CSV
- TSV
- BLG
- `CSV`
- `TSV`
- `BLG`

The default value is BLG.
The default value is `BLG`.

```yaml
Type: System.String
Expand All @@ -151,7 +151,8 @@ Accept wildcard characters: False

### -Force

Overwrites and replaces an existing file if one exists in the location specified by the **Path** parameter.
Overwrites and replaces an existing file if one exists in the location specified by the **Path**
parameter.

```yaml
Type: System.Management.Automation.SwitchParameter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
external help file: Microsoft.PowerShell.Commands.Diagnostics.dll-Help.xml
Locale: en-US
Module Name: Microsoft.PowerShell.Diagnostics
ms.date: 06/21/2021
ms.date: 05/17/2022
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.diagnostics/get-counter?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
title: Get-Counter
Expand Down Expand Up @@ -411,7 +411,7 @@ Path InstanceName CookedValue
`Get-Counter` uses the **Counter** parameter to specify the counter
`\Processor(*)\% Processor Time`. The values are stored in the `$Counter` variable. The objects
stored in `$Counter.CounterSamples` are sent down the pipeline. `Where-Object` uses a script block
to compare each objects value against a specified value of 20. The `$_.CookedValue` is a variable
to compare each objects value against a specified value of `20`. The `$_.CookedValue` is a variable
for the current object in the pipeline. Counters with a **CookedValue** that is less than 20 are
displayed.

Expand Down Expand Up @@ -599,7 +599,8 @@ Accept wildcard characters: False

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
-WarningAction, and -WarningVariable. For more information, see
[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

Expand Down
Loading