Skip to content

Fixes #7063 - Updates Add-Content + 5 more #7064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 18, 2020
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
21 changes: 12 additions & 9 deletions reference/7.0/Microsoft.PowerShell.Management/Add-Content.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
---
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
keywords: powershell,cmdlet
Locale: en-US
Module Name: Microsoft.PowerShell.Management
ms.date: 5/14/2019
ms.date: 12/18/2020
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.management/add-content?view=powershell-7&WT.mc_id=ps-gethelp
schema: 2.0.0
title: Add-Content
Expand Down Expand Up @@ -402,15 +401,19 @@ Accept wildcard characters: True

### -Stream

> [!NOTE]
> This Parameter is only available on Windows.

Specifies an alternative data stream for content. If the stream does not exist, this cmdlet creates
it. Wildcard characters are not supported.

**Stream** is a dynamic parameter that the FileSystem provider adds to `Add-Content`. This
parameter works only in file system drives.

You can use the `Add-Content` cmdlet to change the content of the **Zone.Identifier** alternate
data stream. However, we do not recommend this as a way to eliminate security checks that block
files that are downloaded from the Internet. If you verify that a downloaded file is safe, use the
You can use the `Add-Content` cmdlet to change the content of any alternate
data stream, such as `Zone.Identifier`. However, we do not recommend this as
a way to eliminate security checks that block files that are downloaded from
the Internet. If you verify that a downloaded file is safe, use the
`Unblock-File` cmdlet.

This parameter was introduced in PowerShell 3.0.
Expand Down Expand Up @@ -482,10 +485,10 @@ Accept wildcard characters: False

### CommonParameters

This cmdlet supports the common parameters: `-Debug`, `-ErrorAction`, `-ErrorVariable`,
`-InformationAction`, `-InformationVariable`, `-OutVariable`, `-OutBuffer`, `-PipelineVariable`,
`-Verbose`, `-WarningAction`, and `-WarningVariable`. For more information, see
[about_CommonParameters](../Microsoft.PowerShell.Core/About/about_CommonParameters.md).
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).

## INPUTS

Expand Down
94 changes: 50 additions & 44 deletions reference/7.0/Microsoft.PowerShell.Management/Clear-Content.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
---
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
keywords: powershell,cmdlet
Locale: en-US
Module Name: Microsoft.PowerShell.Management
ms.date: 10/18/2018
ms.date: 12/18/2020
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.management/clear-content?view=powershell-7&WT.mc_id=ps-gethelp
schema: 2.0.0
title: Clear-Content
Expand Down Expand Up @@ -52,22 +51,28 @@ The files are not deleted, but they are empty.
Clear-Content -Path "*" -Filter "*.log" -Force
```

This command deletes the contents of all files in the current directory with the ".log" file name extension, including files with the read-only attribute.
The asterisk (\*) in the path represents all items in the current directory.
The **Force** parameter makes the command effective on read-only files.
Using a filter to restrict the command to files with the .log file name extension instead of specifying \*.log in the path makes the operation faster.
This command deletes the contents of all files in the current directory with the ".log" file name
extension, including files with the read-only attribute. The asterisk (\*) in the path represents
all items in the current directory. The **Force** parameter makes the command effective on read-only
files. Using a filter to restrict the command to files with the .log file name extension instead of
specifying \*.log in the path makes the operation faster.

### Example 3: Clear all data from a stream

This example shows how the `Clear-Content` cmdlet clears the content from an alternate data stream while leaving the stream intact.
This example shows how the `Clear-Content` cmdlet clears the content from an alternate data stream
while leaving the stream intact.

The first command uses the `Get-Content` cmdlet to get the content of the Zone.Identifier stream in the Copy-Script.ps1 file, which was downloaded from the Internet.
The first command uses the `Get-Content` cmdlet to get the content of the `Zone.Identifier` stream
in the Copy-Script.ps1 file, which was downloaded from the Internet.

The second command uses the `Clear-Content` cmdlet to clear the content.

The third command repeats the first command. It verifies that the content is cleared, but the stream remains. If the stream were deleted, the command would generate an error.
The third command repeats the first command. It verifies that the content is cleared, but the stream
remains. If the stream were deleted, the command would generate an error.

You can use a method like this one to clear the content of an alternate data stream. However, it is not the recommended way to eliminate security checks that block files that are downloaded from the Internet. If you verify that a downloaded file is safe, use the `Unblock-File` cmdlet.
You can use a method like this one to clear the content of an alternate data stream. However, it is
not the recommended way to eliminate security checks that block files that are downloaded from the
Internet. If you verify that a downloaded file is safe, use the `Unblock-File` cmdlet.

```
PS C:\> Get-Content C:\Test\Copy-Script.ps1 -Stream Zone.Identifier
Expand All @@ -85,16 +90,19 @@ PS C:\>

### -Stream

Specifies an alternative data stream for content.
If the stream does not exist, this cmdlet creates it.
Wildcard characters are not supported.
> [!NOTE]
> This Parameter is only available on Windows.

Specifies an alternative data stream for content. If the stream does not exist, this cmdlet creates
it. Wildcard characters are not supported.

Stream is a dynamic parameter that the FileSystem provider adds to `Clear-Content`.
This parameter works only in file system drives.

You can use the `Clear-Content` cmdlet to change the content of the Zone.Identifier alternate data stream.
However, we do not recommend this as a way to eliminate security checks that block files that are downloaded from the Internet.
If you verify that a downloaded file is safe, use the `Unblock-File` cmdlet.
You can use the `Clear-Content` cmdlet to change the content of amy alternate data stream, such as
`Zone.Identifier`. However, we do not recommend this as a way to eliminate security checks that
block files that are downloaded from the Internet. If you verify that a downloaded file is safe, use
the `Unblock-File` cmdlet.

```yaml
Type: System.String
Expand Down Expand Up @@ -128,10 +136,9 @@ Accept wildcard characters: False

### -Exclude

Specifies, as a string array, strings that this cmdlet omits from the path to the content.
The value of this parameter qualifies the **Path** parameter.
Enter a path element or pattern, such as "*.txt".
Wildcards are permitted.
Specifies, as a string array, strings that this cmdlet omits from the path to the content. The value
of this parameter qualifies the **Path** parameter. Enter a path element or pattern, such as
"*.txt". Wildcards are permitted.

```yaml
Type: System.String[]
Expand All @@ -147,10 +154,10 @@ Accept wildcard characters: True

### -Filter

Specifies a filter in the provider's format or language.
The value of this parameter qualifies the **Path** parameter.
The syntax of the filter, including the use of wildcards, depends on the provider.
Filters are more efficient than other parameters, because the provider applies them when retrieving the objects, rather than having PowerShell filter the objects after they are retrieved.
Specifies a filter in the provider's format or language. The value of this parameter qualifies the
**Path** parameter. The syntax of the filter, including the use of wildcards, depends on the
provider. Filters are more efficient than other parameters, because the provider applies them when
retrieving the objects, rather than having PowerShell filter the objects after they are retrieved.

```yaml
Type: System.String
Expand Down Expand Up @@ -182,10 +189,8 @@ Accept wildcard characters: False

### -Include

Specifies, as a string array, content that this cmdlet clears.
The value of this parameter qualifies the **Path** parameter.
Enter a path element or pattern, such as "*.txt".
Wildcards are permitted.
Specifies, as a string array, content that this cmdlet clears. The value of this parameter qualifies
the **Path** parameter. Enter a path element or pattern, such as "*.txt". Wildcards are permitted.

```yaml
Type: System.String[]
Expand All @@ -201,11 +206,10 @@ Accept wildcard characters: True

### -LiteralPath

Specifies the paths to the items from which content is deleted.
Unlike the **Path** parameter, the value of **LiteralPath** is used exactly as it is typed.
No characters are interpreted as wildcards.
If the path includes escape characters, enclose it in single quotation marks.
Single quotation marks tell having PowerShell not to interpret any characters as escape sequences.
Specifies the paths to the items from which content is deleted. Unlike the **Path** parameter, the
value of **LiteralPath** is used exactly as it is typed. No characters are interpreted as wildcards.
If the path includes escape characters, enclose it in single quotation marks. Single quotation marks
tell having PowerShell not to interpret any characters as escape sequences.

```yaml
Type: System.String[]
Expand All @@ -221,12 +225,10 @@ Accept wildcard characters: False

### -Path

Specifies the paths to the items from which content is deleted.
Wildcards are permitted.
The paths must be paths to items, not to containers.
For example, you must specify a path to one or more files, not a path to a directory.
Wildcards are permitted.
This parameter is required, but the parameter name ("Path") is optional.
Specifies the paths to the items from which content is deleted. Wildcards are permitted. The paths
must be paths to items, not to containers. For example, you must specify a path to one or more
files, not a path to a directory. Wildcards are permitted. This parameter is required, but the
parameter name ("Path") is optional.

```yaml
Type: System.String[]
Expand Down Expand Up @@ -258,8 +260,7 @@ Accept wildcard characters: False

### -WhatIf

Shows what would happen if the cmdlet runs.
The cmdlet is not run.
Shows what would happen if the cmdlet runs. The cmdlet is not run.

```yaml
Type: System.Management.Automation.SwitchParameter
Expand All @@ -275,7 +276,11 @@ Accept wildcard characters: False

### CommonParameters

This cmdlet supports the common parameters: `-Debug`, `-ErrorAction`, `-ErrorVariable`, `-InformationAction`, `-InformationVariable`, `-OutVariable`, `-OutBuffer`, `-PipelineVariable`, `-Verbose`, `-WarningAction`, and `-WarningVariable`. For more information, see [about_CommonParameters](../Microsoft.PowerShell.Core/About/about_CommonParameters.md).
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).


## INPUTS

Expand All @@ -291,8 +296,9 @@ This cmdlet does not return any objects.

## NOTES

You can use `Clear-Content` with the PowerShell FileSystem provider and with other providers that manipulate content.
To clear items that are not considered to be content, such as items managed by the PowerShell Certificate or Registry providers, use `Clear-Item`.
You can use `Clear-Content` with the PowerShell FileSystem provider and with other providers that
manipulate content. To clear items that are not considered to be content, such as items managed by
the PowerShell Certificate or Registry providers, use `Clear-Item`.

The `Clear-Content` cmdlet is designed to work with the data exposed by any provider.
To list the providers available in your session, type `Get-PsProvider`.
Expand Down
16 changes: 9 additions & 7 deletions reference/7.0/Microsoft.PowerShell.Management/Get-Content.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
---
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
keywords: powershell,cmdlet
Locale: en-US
Module Name: Microsoft.PowerShell.Management
ms.date: 5/14/2019
ms.date: 12/18/2020
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.management/get-content?view=powershell-7&WT.mc_id=ps-gethelp
schema: 2.0.0
title: Get-Content
Expand Down Expand Up @@ -193,10 +192,10 @@ Get-Content -Path .\Stream.txt -Stream NewStream
Added a stream named NewStream to Stream.txt
```

The **Stream** parameter is a dynamic parameter of the
[FileSystem provider](../microsoft.powershell.core/about/about_filesystem_provider.md#stream-systemstring).
By default `Get-Content` only retrieves data from the primary, or `$DATA` stream. **Streams** can be
used to store hidden data such as attributes, security settings, or other data.
The **Stream** parameter is a dynamic parameter of the [FileSystem provider](../microsoft.powershell.core/about/about_filesystem_provider.md#stream-systemstring).
By default `Get-Content` only retrieves data from the default, or `:$DATA` stream. **Streams** can
be used to store hidden data such as attributes, security settings, or other data. They can also be
stored on directories without being child items.

### Example 6: Get raw content

Expand Down Expand Up @@ -239,7 +238,7 @@ Get-Member -InputObject $bytearray
```

```Output
TypeName: System.Byte[]
TypeName: System.Byte[]

Name MemberType Definition
---- ---------- ----------
Expand Down Expand Up @@ -571,6 +570,9 @@ Accept wildcard characters: False

### -Stream

> [!NOTE]
> This Parameter is only available on Windows.

Gets the contents of the specified alternate NTFS file stream from the file. Enter the stream name.
Wildcards are not supported.

Expand Down
7 changes: 5 additions & 2 deletions reference/7.0/Microsoft.PowerShell.Management/Get-Item.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
keywords: powershell,cmdlet
Locale: en-US
Module Name: Microsoft.PowerShell.Management
ms.date: 03/27/2020
ms.date: 12/18/2020
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.management/get-item?view=powershell-7&WT.mc_id=ps-gethelp
schema: 2.0.0
title: Get-Item
Expand Down Expand Up @@ -166,6 +166,9 @@ The new properties that are now part of the output are:

### -Stream

> [!NOTE]
> This Parameter is only available on Windows.

Gets the specified alternate NTFS file stream from the file. Enter the stream name. Wildcards are
supported. To get all streams, use an asterisk (`*`). This parameter isn't valid on folders.

Expand Down Expand Up @@ -351,7 +354,7 @@ To get the contents of an item recursively, use `Get-ChildItem`.
To navigate through the registry, use this cmdlet to get registry keys and the `Get-ItemProperty`
to get registry values and data. The registry values are considered to be properties of the
registry key.

This cmdlet is designed to work with the data exposed by any provider. To list the providers
available in your session, type `Get-PsProvider`. For more information, see
[about_Providers](../Microsoft.PowerShell.Core/About/about_Providers.md).
Expand Down
40 changes: 23 additions & 17 deletions reference/7.0/Microsoft.PowerShell.Management/Remove-Item.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
---
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
keywords: powershell,cmdlet
Locale: en-US
Module Name: Microsoft.PowerShell.Management
ms.date: 04/07/2020
ms.date: 12/18/2020
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.management/remove-item?view=powershell-7&WT.mc_id=ps-gethelp
schema: 2.0.0
title: Remove-Item
Expand Down Expand Up @@ -187,9 +186,9 @@ At line:1 char:1

```

The **Stream** parameter `Get-Item` gets the **Zone.Identifier** stream of the `Copy-Script.ps1`
file. `Remove-Item` uses the **Stream** parameter to remove the **Zone.Identifier** stream of the
file. Finally, the `Get-Item` cmdlet shows that the **Zone.Identifier** stream was deleted.
The **Stream** parameter `Get-Item` gets the `Zone.Identifier` stream of the `Copy-Script.ps1`
file. `Remove-Item` uses the **Stream** parameter to remove the `Zone.Identifier` stream of the
file. Finally, the `Get-Item` cmdlet shows that the `Zone.Identifier` stream was deleted.

## PARAMETERS

Expand Down Expand Up @@ -234,11 +233,13 @@ Accept wildcard characters: True

### -Filter

Specifies a filter to qualify the **Path** parameter. The [FileSystem](../Microsoft.PowerShell.Core/About/about_FileSystem_Provider.md)
provider is the only installed PowerShell provider that supports the use of filters. You can find
the syntax for the **FileSystem** filter language in [about_Wildcards](../Microsoft.PowerShell.Core/About/about_Wildcards.md).
Filters are more efficient than other parameters, because the provider applies them when the cmdlet
gets the objects rather than having PowerShell filter the objects after they are retrieved.
Specifies a filter to qualify the **Path** parameter. The
[FileSystem](../Microsoft.PowerShell.Core/About/about_FileSystem_Provider.md) provider is the only
installed PowerShell provider that supports the use of filters. You can find the syntax for the
**FileSystem** filter language in
[about_Wildcards](../Microsoft.PowerShell.Core/About/about_Wildcards.md). Filters are more efficient
than other parameters, because the provider applies them when the cmdlet gets the objects rather
than having PowerShell filter the objects after they are retrieved.

```yaml
Type: System.String
Expand Down Expand Up @@ -353,12 +354,16 @@ Accept wildcard characters: False

### -Stream

> [!NOTE]
> This Parameter is only available on Windows.

The **Stream** parameter is a dynamic parameter that the FileSystem provider adds to `Remove-Item`.
This parameter works only in file system drives.

You can use `Remove-Item` to delete an alternative data stream. However, it is not the recommended
way to eliminate security checks that block files that are downloaded from the Internet. If you
verify that a downloaded file is safe, use the `Unblock-File` cmdlet.
You can use `Remove-Item` to delete an alternative data stream, such as `Zone.Identifier`.
However, it is not the recommended way to eliminate security checks that block files that are
downloaded from the Internet. If you verify that a downloaded file is safe, use the `Unblock-File`
cmdlet.

This parameter was introduced in Windows PowerShell 3.0.

Expand Down Expand Up @@ -412,10 +417,11 @@ Accept wildcard characters: False

### CommonParameters

This cmdlet supports the common parameters: `-Debug`, `-ErrorAction`, `-ErrorVariable`,
`-InformationAction`, `-InformationVariable`, `-OutVariable`, `-OutBuffer`, `-PipelineVariable`,
`-Verbose`, `-WarningAction`, and `-WarningVariable`. For more information, see
[about_CommonParameters](../Microsoft.PowerShell.Core/About/about_CommonParameters.md).
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).


## INPUTS

Expand Down
Loading