From 53dcf4fbce2dde06dba099834b7979216f68fa00 Mon Sep 17 00:00:00 2001 From: Sean Wheeler Date: Fri, 12 Jan 2018 10:31:55 -0800 Subject: [PATCH 1/4] clean up warnings from build log --- dsc/DscForEngineers.md | 7 +- dsc/configDataCredentials.md | 18 +- dsc/docfx.json | 1 - dsc/enactingConfigurations.md | 3 +- dsc/metaConfig.md | 11 +- dsc/metaConfig4.md | 1 - gallery/index.md | 3 - jea/index.md | 3 - .../About/about_WS-Management_Cmdlets.md | 2 - .../About/about_WS-Management_Cmdlets.md | 2 - .../About/about_desiredstateconfiguration.md | 7 - .../About/about_WS-Management_Cmdlets.md | 2 - .../About/about_WS-Management_Cmdlets.md | 2 - .../About/about_Language_Modes.md | 1 - .../Providers/Environment-Provider.md | 75 ++-- .../Add-Content-for-FileSystem.md | 259 ++++++----- .../Get-ChildItem-for-FileSystem.md | 371 ++++++++-------- .../Get-Content-for-FileSystem.md | 401 +++++++++--------- .../Set-Content-for-FileSystem.md | 245 +++++------ .../Providers/Function-Provider.md | 104 +++-- .../Providers/Variable-Provider.md | 102 +++-- ...-Integrated-Scripting-Environment--ISE-.md | 2 +- 22 files changed, 774 insertions(+), 848 deletions(-) delete mode 100644 gallery/index.md delete mode 100644 jea/index.md diff --git a/dsc/DscForEngineers.md b/dsc/DscForEngineers.md index 024fd629cbfb..07977850c493 100644 --- a/dsc/DscForEngineers.md +++ b/dsc/DscForEngineers.md @@ -1,6 +1,5 @@ --- ms.date: 2017-10-13 -author: eslesar;mgreenegit ms.topic: conceptual keywords: dsc,powershell,configuration,setup title: Desired State Configuration Overview for Decision Makers @@ -112,15 +111,15 @@ Configuration Sample_Share # implement the logic of "how" to execute a task xSmbShare MySMBShare { - Ensure = "Present" + Ensure = "Present" Name = "MyShare" - Path = "C:\Demo\Temp" + Path = "C:\Demo\Temp" ReadAccess = "Alice" FullAccess = "Bob" Description = "This is an updated description for this share" } } -} +} #Run the function to compile the configuration Sample_Share #Pass the configuration to the nodes we defined and configure them diff --git a/dsc/configDataCredentials.md b/dsc/configDataCredentials.md index 9e6efcebcc77..b0fc60dbad4b 100644 --- a/dsc/configDataCredentials.md +++ b/dsc/configDataCredentials.md @@ -18,7 +18,10 @@ To suppress these error and warning messages use the DSC configuration data keyw * **PsDscAllowPlainTextPassword** * **PsDscAllowDomainUser** ->**Notes:**

Storing/transmitting plaintext passwords unencrypted is generally not secure. Securing credentials by using the techniques covered later in this topic is recommended.

The Azure Automation DSC service allows you to centrally manage credentials to be compiled in configurations and stored securely. For information, see: [Compiling DSC Configurations / Credential Assets](https://docs.microsoft.com/en-in/azure/automation/automation-dsc-compile#credential-assets)

+> [!NOTE] +> Storing/transmitting plaintext passwords unencrypted is generally not secure. Securing credentials by using the techniques covered later in this topic is recommended. +> The Azure Automation DSC service allows you to centrally manage credentials to be compiled in configurations and stored securely. +> For information, see: [Compiling DSC Configurations / Credential Assets](/azure/automation/automation-dsc-compile#credential-assets) The following is an example of passing plain text credentials: @@ -133,7 +136,8 @@ see [Running DSC with user credentials](runAsUser.md). Newer resources and custom resources can use this automatic property instead of creating their own property for credentials. ->**Note:** the design of some resources are to use multiple credentials for a specific reason, and they will have their own credential properties. +> [!NOTE] +> The design of some resources are to use multiple credentials for a specific reason, and they will have their own credential properties. To find the available credential properties on a resource use either `Get-DscResource -Name ResourceName -Syntax` @@ -228,8 +232,8 @@ for node 'localhost'. ``` This example has two issues: -1. An error explains that plain text passwords are not recommended -2. A warning advises against using a domain credential +1. An error explains that plain text passwords are not recommended +2. A warning advises against using a domain credential ## PsDscAllowPlainTextPassword @@ -276,7 +280,8 @@ $cred = Get-Credential -UserName contoso\genericuser -Message "Password please" DomainCredentialExample -DomainCredential $cred -ConfigurationData $cd ``` ->**Note:** `NodeName` cannot equal asterisk, a specific node name is mandatory. +> [!NOTE] +> `NodeName` cannot equal asterisk, a specific node name is mandatory. **Microsoft advises to avoid plain text passwords due to the significant security risk.** @@ -291,8 +296,7 @@ still generates the warning that using a domain account for a credential is not Using a local account eliminates potential exposure of domain credentials that could be used on other servers. -**When using credentials with DSC resources, -prefer a local account over a domain account when possible.** +**When using credentials with DSC resources, prefer a local account over a domain account when possible.** If there is a '\' or '@' in the `Username` property of the credential, then DSC will treat it as a domain account. diff --git a/dsc/docfx.json b/dsc/docfx.json index 8a0ca570ced8..8d4d435b0573 100644 --- a/dsc/docfx.json +++ b/dsc/docfx.json @@ -13,7 +13,6 @@ "breadcrumb_path":"bread/toc.json", "uhfHeaderId": "MSDocsHeader-Powershell", "layout": "conceptual", - "ms.locale": "en-us", "ROBOTS": "INDEX, FOLLOW", "ms.prod": "powershell", "ms.technology": "dsc", diff --git a/dsc/enactingConfigurations.md b/dsc/enactingConfigurations.md index b036558181e0..ad90ea1563b5 100644 --- a/dsc/enactingConfigurations.md +++ b/dsc/enactingConfigurations.md @@ -1,6 +1,5 @@ --- ms.date: 2017-10-16 -author: eslesar;mgreenegit ms.topic: conceptual keywords: dsc,powershell,configuration,setup title: Enacting configurations @@ -27,7 +26,7 @@ For example, if the configuration MOF is located at `C:\DSC\Configurations\local you would apply it to the local machine with the following command: `Start-DscConfiguration -Path 'C:\DSC\Configurations'` -> __Note__: By default, DSC runs a configuration as a background job. To run the configuration interactively, call the +> __Note__: By default, DSC runs a configuration as a background job. To run the configuration interactively, call the >[Start-DscConfiguration](https://technet.microsoft.com/library/dn521623.aspx) with the __-Wait__ parameter. ## Pull mode diff --git a/dsc/metaConfig.md b/dsc/metaConfig.md index 6992810d6307..64f864bd5556 100644 --- a/dsc/metaConfig.md +++ b/dsc/metaConfig.md @@ -1,6 +1,5 @@ --- ms.date: 2017-10-11 -author: eslesar;mgreenegit ms.topic: conceptual keywords: dsc,powershell,configuration,setup title: Configuring the Local Configuration Manager @@ -46,7 +45,7 @@ configuration LCMConfig RefreshMode = 'Push' } } -} +} ``` The process of applying settings to LCM is similar to applying a DSC configuration. @@ -144,7 +143,7 @@ you create a **ConfigurationRepositoryWeb** block. A **ConfigurationRepositoryWeb** defines the following properties. |Property|Type|Description| -|---|---|---| +|---|---|---| |AllowUnsecureConnection|bool|Set to **$TRUE** to allow connections from the node to the server without authentication. Set to **$FALSE** to require authentication.| |CertificateID|string|The thumbprint of a certificate used to authenticate to the server.| |ConfigurationNames|String[]|An array of names of configurations to be pulled by the target node. These are used only if the node is registered with the pull service by using a **RegistrationKey**. For more information, see [Setting up a pull client with configuration names](pullClientConfigNames.md).| @@ -211,7 +210,7 @@ see [DSC Partial configurations](partialConfigs.md). **PartialConfiguration** defines the following properties. |Property|Type|Description| -|---|---|---| +|---|---|---| |ConfigurationSource|string[]|An array of names of configuration servers, previously defined in **ConfigurationRepositoryWeb** and **ConfigurationRepositoryShare** blocks, where the partial configuration is pulled from.| |DependsOn|string{}|A list of names of other configurations that must be completed before this partial configuration is applied.| |Description|string|Text used to describe the partial configuration.| @@ -221,11 +220,11 @@ see [DSC Partial configurations](partialConfigs.md). __Note:__ partial configurations are supported with Azure Automation DSC, but only one configuration can be pulled from each automation account per node. -## See Also +## See Also ### Concepts [Desired State Configuration Overview](overview.md) - + [Getting started with Azure Automation DSC](https://docs.microsoft.com/en-us/azure/automation/automation-dsc-getting-started) ### Other Resources diff --git a/dsc/metaConfig4.md b/dsc/metaConfig4.md index 32644e5ff88b..467225674575 100644 --- a/dsc/metaConfig4.md +++ b/dsc/metaConfig4.md @@ -1,6 +1,5 @@ --- ms.date: 2017-10-12 -author: eslesar;mgreenegit ms.topic: conceptual keywords: dsc,powershell,configuration,setup title: Windows PowerShell 4.0 Desired State Configuration Local Configuration Manager (LCM) diff --git a/gallery/index.md b/gallery/index.md deleted file mode 100644 index d52e9bb0f2ae..000000000000 --- a/gallery/index.md +++ /dev/null @@ -1,3 +0,0 @@ ---- -redirect_url: readme ---- diff --git a/jea/index.md b/jea/index.md deleted file mode 100644 index 5d11197e6073..000000000000 --- a/jea/index.md +++ /dev/null @@ -1,3 +0,0 @@ ---- -redirect_url: overview ---- diff --git a/reference/3.0/Microsoft.PowerShell.Core/About/about_WS-Management_Cmdlets.md b/reference/3.0/Microsoft.PowerShell.Core/About/about_WS-Management_Cmdlets.md index 1b6877370de4..1c2f2843c295 100644 --- a/reference/3.0/Microsoft.PowerShell.Core/About/about_WS-Management_Cmdlets.md +++ b/reference/3.0/Microsoft.PowerShell.Core/About/about_WS-Management_Cmdlets.md @@ -185,8 +185,6 @@ http://go.microsoft.com/fwlink/?LinkId=142329 [Set-WSManQuickConfig](../../Microsoft.WSMan.Management/Set-WSManQuickConfig.md) -[Set-WSManSessionOption](../../Microsoft.WSMan.Management/Set-WSManSessionOption.md) - [Test-WSMan](../../Microsoft.WSMan.Management/Test-WSMan.md) # KEYWORDS diff --git a/reference/4.0/Microsoft.PowerShell.Core/About/about_WS-Management_Cmdlets.md b/reference/4.0/Microsoft.PowerShell.Core/About/about_WS-Management_Cmdlets.md index 1b6877370de4..1c2f2843c295 100644 --- a/reference/4.0/Microsoft.PowerShell.Core/About/about_WS-Management_Cmdlets.md +++ b/reference/4.0/Microsoft.PowerShell.Core/About/about_WS-Management_Cmdlets.md @@ -185,8 +185,6 @@ http://go.microsoft.com/fwlink/?LinkId=142329 [Set-WSManQuickConfig](../../Microsoft.WSMan.Management/Set-WSManQuickConfig.md) -[Set-WSManSessionOption](../../Microsoft.WSMan.Management/Set-WSManSessionOption.md) - [Test-WSMan](../../Microsoft.WSMan.Management/Test-WSMan.md) # KEYWORDS diff --git a/reference/4.0/Microsoft.PowerShell.Core/About/about_desiredstateconfiguration.md b/reference/4.0/Microsoft.PowerShell.Core/About/about_desiredstateconfiguration.md index 986f4d855fbc..81758fca1960 100644 --- a/reference/4.0/Microsoft.PowerShell.Core/About/about_desiredstateconfiguration.md +++ b/reference/4.0/Microsoft.PowerShell.Core/About/about_desiredstateconfiguration.md @@ -30,13 +30,6 @@ For detailed information about DSC, see [PowerShell Desired State Configuration Overview](http://go.microsoft.com/fwlink/?LinkId=311940) in the TechNet Library. -## DEVELOPING DSC RESOURCES WITH CLASSES - -Starting in PowerShell 5.0, you can develop DSC resources by using classes. -For more information, see [about_Classes](about_Classes.md), and -[Writing a custom DSC resource with PowerShell classes](http://technet.microsoft.com/library/dn948461.aspx) -on Microsoft TechNet. - ## USING DSC To use DSC to configure your environment, first define a PowerShell diff --git a/reference/5.0/Microsoft.PowerShell.Core/About/about_WS-Management_Cmdlets.md b/reference/5.0/Microsoft.PowerShell.Core/About/about_WS-Management_Cmdlets.md index 1b6877370de4..1c2f2843c295 100644 --- a/reference/5.0/Microsoft.PowerShell.Core/About/about_WS-Management_Cmdlets.md +++ b/reference/5.0/Microsoft.PowerShell.Core/About/about_WS-Management_Cmdlets.md @@ -185,8 +185,6 @@ http://go.microsoft.com/fwlink/?LinkId=142329 [Set-WSManQuickConfig](../../Microsoft.WSMan.Management/Set-WSManQuickConfig.md) -[Set-WSManSessionOption](../../Microsoft.WSMan.Management/Set-WSManSessionOption.md) - [Test-WSMan](../../Microsoft.WSMan.Management/Test-WSMan.md) # KEYWORDS diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_WS-Management_Cmdlets.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_WS-Management_Cmdlets.md index 1b6877370de4..1c2f2843c295 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_WS-Management_Cmdlets.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_WS-Management_Cmdlets.md @@ -185,8 +185,6 @@ http://go.microsoft.com/fwlink/?LinkId=142329 [Set-WSManQuickConfig](../../Microsoft.WSMan.Management/Set-WSManQuickConfig.md) -[Set-WSManSessionOption](../../Microsoft.WSMan.Management/Set-WSManSessionOption.md) - [Test-WSMan](../../Microsoft.WSMan.Management/Test-WSMan.md) # KEYWORDS diff --git a/reference/6/Microsoft.PowerShell.Core/About/about_Language_Modes.md b/reference/6/Microsoft.PowerShell.Core/About/about_Language_Modes.md index c53e1e438e24..c12aefe01cec 100644 --- a/reference/6/Microsoft.PowerShell.Core/About/about_Language_Modes.md +++ b/reference/6/Microsoft.PowerShell.Core/About/about_Language_Modes.md @@ -251,4 +251,3 @@ NoLanguage session, PowerShell returns the ScriptsNotAllowed error message. - [about_Session_Configuration_Files](about_Session_Configuration_Files.md) - [about_Session_Configurations](about_Session_Configurations.md) -- [about_Windows_RT](about_Windows_RT.md) diff --git a/reference/6/Microsoft.PowerShell.Core/Providers/Environment-Provider.md b/reference/6/Microsoft.PowerShell.Core/Providers/Environment-Provider.md index 9081a845cfad..9374699d9809 100644 --- a/reference/6/Microsoft.PowerShell.Core/Providers/Environment-Provider.md +++ b/reference/6/Microsoft.PowerShell.Core/Providers/Environment-Provider.md @@ -13,39 +13,36 @@ online version: https://go.microsoft.com/fwlink/?linkid=834944 ## Provider name - Environment + Environment ## Drives - `Env:` + `Env:` ## Short description - Provides access to the Windows environment variables. + Provides access to the Windows environment variables. ## Detailed description - The Windows PowerShell **Environment** provider lets you get, add, change, clear, and delete Windows environment variables in Windows PowerShell. + The Windows PowerShell **Environment** provider lets you get, add, change, clear, and delete Windows environment variables in Windows PowerShell. - The **Environment** provider is a flat namespace that contains only objects that represent the environment variables. The variables have no child items. + The **Environment** provider is a flat namespace that contains only objects that represent the environment variables. The variables have no child items. - Each environment variable is an instance of the [System.Collections.DictionaryEntry](https://msdn.microsoft.com/library/system.collections.dictionaryentry) class. The name of the variable is the dictionary key. The value of the environment variable is the dictionary value. + Each environment variable is an instance of the [System.Collections.DictionaryEntry](https://msdn.microsoft.com/library/system.collections.dictionaryentry) class. The name of the variable is the dictionary key. The value of the environment variable is the dictionary value. - The **Environment** provider exposes its data store in the `Env:` drive. To work with environment variables, change your location to the `Env:` drive (`set-location Env:`), or work from another Windows PowerShell drive. To reference an environment variable from another location, use the `Env:` drive name in the path. + The **Environment** provider exposes its data store in the `Env:` drive. To work with environment variables, change your location to the `Env:` drive (`set-location Env:`), or work from another Windows PowerShell drive. To reference an environment variable from another location, use the `Env:` drive name in the path. - The **Environment** provider supports all the cmdlets that contain the *Item* noun except for [Invoke-Item](../../Microsoft.PowerShell.Management/Invoke-Item.md). And, it supports the [Get-Content](../../Microsoft.PowerShell.Management/Get-Content.md) and [Set-Content](../../Microsoft.PowerShell.Management/Set-Content.md) cmdlets. However, it does not support the cmdlets that contain the *ItemProperty* noun, and it does not support the `-Filter` parameter in any cmdlet. - - Environment variables must conform to the usual naming standards. Additionally, the name cannot include the equal sign (`=`). - - Changes to the environment variables affect the current session only. To save the changes, add the changes to the Windows PowerShell profile, or use [Export-Console](there-should-be-an-external-link) to save the current session. + The **Environment** provider supports all the cmdlets that contain the *Item* noun except for [Invoke-Item](../../Microsoft.PowerShell.Management/Invoke-Item.md). And, it supports the [Get-Content](../../Microsoft.PowerShell.Management/Get-Content.md) and [Set-Content](../../Microsoft.PowerShell.Management/Set-Content.md) cmdlets. However, it does not support the cmdlets that contain the *ItemProperty* noun, and it does not support the `-Filter` parameter in any cmdlet. + Environment variables must conform to the usual naming standards. Additionally, the name cannot include the equal sign (`=`). ## Capabilities - ShouldProcess + ShouldProcess ## Examples @@ -56,13 +53,13 @@ online version: https://go.microsoft.com/fwlink/?linkid=834944 #### Example 1 - This command changes the current location to the `Env:` drive: + This command changes the current location to the `Env:` drive: ```powershell Set-Location Env: ``` - You can use this command from any drive in Windows PowerShell. To return to a file system drive, type the drive name. For example, type: + You can use this command from any drive in Windows PowerShell. To return to a file system drive, type the drive name. For example, type: ```powershell Set-Location c: ``` @@ -73,18 +70,18 @@ Set-Location c: #### Example 1 - This command lists all the environment variables in the current session: + This command lists all the environment variables in the current session: ```powershell Get-ChildItem -Path Env: ``` - You can use this command from any Windows PowerShell drive. + You can use this command from any Windows PowerShell drive. #### Example 2 - This command gets the `WINDIR` environment Variable: + This command gets the `WINDIR` environment Variable: ```powershell Get-ChildItem -Path Env:windir @@ -93,14 +90,14 @@ Get-ChildItem -Path Env:windir #### Example 3 - This command gets a list of all the environment variables in the current session and then sorts them by name: + This command gets a list of all the environment variables in the current session and then sorts them by name: ```powershell Get-ChildItem | Sort-Object -Property name ``` - By default, the environment variables appear in the order that Windows PowerShell discovers them. This command is submitted in the `Env:` drive. -When you run this command from another drive, add the `-Path` parameter with a value of `Env:`. + By default, the environment variables appear in the order that Windows PowerShell discovers them. This command is submitted in the `Env:` drive. +When you run this command from another drive, add the `-Path` parameter with a value of `Env:`. ### Creating a new environment variable @@ -108,14 +105,14 @@ When you run this command from another drive, add the `-Path` parameter with a v #### Example 1 - This command creates the `USERMODE` environment variable with a value of "Non-Admin": + This command creates the `USERMODE` environment variable with a value of "Non-Admin": ```powershell New-Item -Path . -Name USERMODE -Value Non-Admin ``` - Because the current location is in the `Env:` drive, the value of the `-Path` parameter is a dot (`.`). The dot represents the current location. -If you are not in the `Env:` drive, the value of the `-Path` parameter would be `Env:`. + Because the current location is in the `Env:` drive, the value of the `-Path` parameter is a dot (`.`). The dot represents the current location. +If you are not in the `Env:` drive, the value of the `-Path` parameter would be `Env:`. ### Displaying the properties and methods of environment variables @@ -123,32 +120,32 @@ If you are not in the `Env:` drive, the value of the `-Path` parameter would be #### Example 1 - This command uses the [Get-ChildItem](../../Microsoft.PowerShell.Management/Get-ChildItem.md) cmdlet to get all the environment variables: + This command uses the [Get-ChildItem](../../Microsoft.PowerShell.Management/Get-ChildItem.md) cmdlet to get all the environment variables: ```powershell Get-ChildItem -Path Env: | Get-Member ``` - The pipeline operator (`|`) sends the results to [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md), which displays the methods and properties of the object. -When you pipe a collection of objects to [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md), such as the collection of environment variables in the `Env:` drive, [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md) evaluates each object in the collection separately. [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md) then returns information about each object type that it finds. If all the objects are of the same type, it returns information about the single object type. In this case, all the environment variables are [DictionaryEntry](https://msdn.microsoft.com/library/system.collections.dictionaryentry) objects. -To get information about the collection of [DictionaryEntry](https://msdn.microsoft.com/library/system.collections.dictionaryentry) objects, use the `-InputObject` parameter of [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md). For example, type: + The pipeline operator (`|`) sends the results to [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md), which displays the methods and properties of the object. +When you pipe a collection of objects to [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md), such as the collection of environment variables in the `Env:` drive, [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md) evaluates each object in the collection separately. [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md) then returns information about each object type that it finds. If all the objects are of the same type, it returns information about the single object type. In this case, all the environment variables are [DictionaryEntry](https://msdn.microsoft.com/library/system.collections.dictionaryentry) objects. +To get information about the collection of [DictionaryEntry](https://msdn.microsoft.com/library/system.collections.dictionaryentry) objects, use the `-InputObject` parameter of [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md). For example, type: ```powershell Get-Member -InputObject (Get-ChildItem Env:) ``` -When you use the `-InputObject` parameter, [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md) evaluates the collection, not the objects in the collection. +When you use the `-InputObject` parameter, [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md) evaluates the collection, not the objects in the collection. #### Example 2 - This command lists the values of the properties of the `WINDIR` environment Variable: + This command lists the values of the properties of the `WINDIR` environment Variable: ```powershell Get-Item Env:windir | Format-List -Property * ``` - It uses the [Get-Item](../../Microsoft.PowerShell.Management/Get-Item.md) cmdlet to get an object that represents the `WINDIR` environment variable. The pipeline operator (`|`) sends the results to the [Format-List](../../Microsoft.PowerShell.Utility/Format-List.md) command. It uses the `-Property` parameter with a wildcard character (`*`) to format and display the values of all the properties of the `WINDIR` environment variable. + It uses the [Get-Item](../../Microsoft.PowerShell.Management/Get-Item.md) cmdlet to get an object that represents the `WINDIR` environment variable. The pipeline operator (`|`) sends the results to the [Format-List](../../Microsoft.PowerShell.Utility/Format-List.md) command. It uses the `-Property` parameter with a wildcard character (`*`) to format and display the values of all the properties of the `WINDIR` environment variable. ### Changing the properties of an environment variable @@ -156,19 +153,19 @@ Get-Item Env:windir | Format-List -Property * #### Example 1 - This command uses the [Rename-Item](../../Microsoft.PowerShell.Management/Rename-Item.md) cmdlet to change the name of the `USERMODE` environment variable that you created to `USERROLE`: + This command uses the [Rename-Item](../../Microsoft.PowerShell.Management/Rename-Item.md) cmdlet to change the name of the `USERMODE` environment variable that you created to `USERROLE`: ```powershell Rename-Item -Path Env:USERMODE -NewName USERROLE ``` - This change affects the **Name**, **Key**, and **PSPath** properties of the [DictionaryEntry](https://msdn.microsoft.com/library/system.collections.dictionaryentry) object. -Do not change the name of an environment variable that the system uses. Although these changes affect only the current session, they might cause the system or a program to operate incorrectly. + This change affects the **Name**, **Key**, and **PSPath** properties of the [DictionaryEntry](https://msdn.microsoft.com/library/system.collections.dictionaryentry) object. +Do not change the name of an environment variable that the system uses. Although these changes affect only the current session, they might cause the system or a program to operate incorrectly. #### Example 2 - This command uses the [Set-Item](../../Microsoft.PowerShell.Management/Set-Item.md) cmdlet to change the value of the `USERROLE` environment variable to "Administrator": + This command uses the [Set-Item](../../Microsoft.PowerShell.Management/Set-Item.md) cmdlet to change the value of the `USERROLE` environment variable to "Administrator": ```powershell Set-Item -Path Env:USERROLE -Value Administrator @@ -180,7 +177,7 @@ Set-Item -Path Env:USERROLE -Value Administrator #### Example 1 - This command copies the value of the `USERROLE` environment variable to the `USERROLE2` environment Variable: + This command copies the value of the `USERROLE` environment variable to the `USERROLE2` environment Variable: ```powershell Copy-Item -Path Env:USERROLE -Destination Env:USERROLE2 @@ -192,18 +189,18 @@ Copy-Item -Path Env:USERROLE -Destination Env:USERROLE2 #### Example 1 - This command deletes the `USERROLE2` environment variable from the current session: + This command deletes the `USERROLE2` environment variable from the current session: ```powershell Remove-Item -Path Env:USERROLE2 ``` - You can use this command in any Windows PowerShell drive. If you are in the `Env:` drive, you can omit the drive name from the path. + You can use this command in any Windows PowerShell drive. If you are in the `Env:` drive, you can omit the drive name from the path. #### Example 2 - This command deletes the `USERROLE` environment variable. + This command deletes the `USERROLE` environment variable. ```powershell Clear-Item -Path Env:USERROLE diff --git a/reference/6/Microsoft.PowerShell.Core/Providers/FileSystem-Provider/Add-Content-for-FileSystem.md b/reference/6/Microsoft.PowerShell.Core/Providers/FileSystem-Provider/Add-Content-for-FileSystem.md index ece5a6b15211..0866984673d1 100644 --- a/reference/6/Microsoft.PowerShell.Core/Providers/FileSystem-Provider/Add-Content-for-FileSystem.md +++ b/reference/6/Microsoft.PowerShell.Core/Providers/FileSystem-Provider/Add-Content-for-FileSystem.md @@ -8,198 +8,187 @@ online version: http://go.microsoft.com/fwlink/?LinkId=834948 --- # Add-Content for FileSystem -Appends content, such as words or data, to a file. +Appends content, such as words or data, to a file. -## Syntax +## Syntax -``` -Add-Content [-Encoding { | | | | | | | | | | }] [-Force] [-Stream ] [-Confirm] [-WhatIf] [-UseTransaction] [] +``` +Add-Content [-Encoding { | | | | | | | | | | }] [-Force] [-Stream ] [-Confirm] [-WhatIf] [] -``` +``` -## Description - In file system drives, the [Add-Content](../../../Microsoft.PowerShell.Management/Add-Content.md) cmdlet appends the content you specify to the end of a file. This cmdlet is not valid on folders. +## Description + In file system drives, the [Add-Content](../../../Microsoft.PowerShell.Management/Add-Content.md) cmdlet appends the content you specify to the end of a file. This cmdlet is not valid on folders. - Note: This custom cmdlet help file explains how the [Add-Content](../../../Microsoft.PowerShell.Management/Add-Content.md) cmdlet works in a file system drive. For information about the [Add-Content](../../../Microsoft.PowerShell.Management/Add-Content.md) cmdlet in all drives, type "[Get-Help](../../Get-Help.md)[Add-Content](../../../Microsoft.PowerShell.Management/Add-Content.md) -Path $null" or see [Add-Content](../../../Microsoft.PowerShell.Management/Add-Content.md) at http://go.microsoft.com/fwlink/?LinkID=113278. + Note: This custom cmdlet help file explains how the [Add-Content](../../../Microsoft.PowerShell.Management/Add-Content.md) cmdlet works in a file system drive. For information about the [Add-Content](../../../Microsoft.PowerShell.Management/Add-Content.md) cmdlet in all drives, type "[Get-Help](../../Get-Help.md)[Add-Content](../../../Microsoft.PowerShell.Management/Add-Content.md) -Path $null" or see [Add-Content](../../../Microsoft.PowerShell.Management/Add-Content.md) at http://go.microsoft.com/fwlink/?LinkID=113278. -## Parameters +## Parameters -### -Encoding - Specifies the file encoding. The default is ASCII. +### -Encoding + Specifies the file encoding. The default is ASCII. - Valid values are: + Valid values are: - -- ASCII: Uses the encoding for the ASCII (7-bit) character set. + -- ASCII: Uses the encoding for the ASCII (7-bit) character set. - -- BigEndianUnicode: Encodes in UTF-16 format using the big-endian byte order. + -- BigEndianUnicode: Encodes in UTF-16 format using the big-endian byte order. - -- Byte: Encodes a set of characters into a sequence of bytes. + -- Byte: Encodes a set of characters into a sequence of bytes. - -- String: Uses the encoding type for a string. + -- String: Uses the encoding type for a string. - -- Unicode: Encodes in UTF-16 format using the little-endian byte order. + -- Unicode: Encodes in UTF-16 format using the little-endian byte order. - -- UTF7: Encodes in UTF-7 format. + -- UTF7: Encodes in UTF-7 format. - -- UTF8: Encodes in UTF-8 format. + -- UTF8: Encodes in UTF-8 format. - -- Unknown: The encoding type is unknown or invalid. The data can be treated as binary. + -- Unknown: The encoding type is unknown or invalid. The data can be treated as binary. - Encoding is a dynamic parameter that the FileSystem provider adds to the [Add-Content](../../../Microsoft.PowerShell.Management/Add-Content.md) cmdlet. This parameter works only in file system drives. + Encoding is a dynamic parameter that the FileSystem provider adds to the [Add-Content](../../../Microsoft.PowerShell.Management/Add-Content.md) cmdlet. This parameter works only in file system drives. -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|ASCII| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +||| +|-|-| +|Required?|false| +|Position?|named| +|Default Value|ASCII| +|Accept Pipeline Input?|false| +|Accept Wildcard Characters?|false| -### -Force - Adds contents to files even if they are read-only. Without this parameter, read-only files are not affected. +### -Force + Adds contents to files even if they are read-only. Without this parameter, read-only files are not affected. -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|False| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +||| +|-|-| +|Required?|false| +|Position?|named| +|Default Value|False| +|Accept Pipeline Input?|false| +|Accept Wildcard Characters?|false| -### -Stream - Adds the content to the specified alternate data stream. If the stream does not yet, exist, [Add-Content](../../../Microsoft.PowerShell.Management/Add-Content.md) creates it. Enter the stream name. Wildcards are not supported. +### -Stream + Adds the content to the specified alternate data stream. If the stream does not yet, exist, [Add-Content](../../../Microsoft.PowerShell.Management/Add-Content.md) creates it. Enter the stream name. Wildcards are not supported. - Stream is a dynamic parameter that the FileSystem provider adds to the [Add-Content](../../../Microsoft.PowerShell.Management/Add-Content.md) cmdlet. This parameter works only in file system drives. + Stream is a dynamic parameter that the FileSystem provider adds to the [Add-Content](../../../Microsoft.PowerShell.Management/Add-Content.md) cmdlet. This parameter works only in file system drives. - This parameter is introduced in Windows PowerShell 3.0. + This parameter is introduced in Windows PowerShell 3.0. -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +||| +|-|-| +|Required?|false| +|Position?|named| +|Default Value|| +|Accept Pipeline Input?|false| +|Accept Wildcard Characters?|false| -### -Confirm - Prompts you for confirmation before executing the command. +### -Confirm + Prompts you for confirmation before executing the command. -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +||| +|-|-| +|Required?|false| +|Position?|named| +|Default Value|| +|Accept Pipeline Input?|false| +|Accept Wildcard Characters?|false| -### -WhatIf - Describes what would happen if you executed the command without actually executing the command. +### -WhatIf + Describes what would happen if you executed the command without actually executing the command. -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +||| +|-|-| +|Required?|false| +|Position?|named| +|Default Value|| +|Accept Pipeline Input?|false| +|Accept Wildcard Characters?|false| -### -UseTransaction - Includes the command in the active transaction. This parameter is valid only when a transaction is in progress. For more information, see [about_Transactions](../../About/about_Transactions.md). +### + This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, -OutVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](../../About/about_CommonParameters.md). -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +## Inputs and Outputs + The input type is the type of the objects that you can pipe to the cmdlet. The return type is the type of the objects that the cmdlet returns. -### - This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, -OutVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](../../About/about_CommonParameters.md). +||| +|-|-| +|Inputs|Sytem.Object[], System.String[], System.Management.Automation.PSCredential

You can pipe the value (object), a path, or a credential object to Add-Contnet.| +|Outputs|None or System.String

When you use the Passthru parameter, Add-Content generates a System.String object representing the content. Otherwise, this cmdlet does not generate any output.| -## Inputs and Outputs - The input type is the type of the objects that you can pipe to the cmdlet. The return type is the type of the objects that the cmdlet returns. +## Example 1 -||| -|-|-| -|Inputs|Sytem.Object[], System.String[], System.Management.Automation.PSCredential

You can pipe the value (object), a path, or a credential object to Add-Contnet.| -|Outputs|None or System.String

When you use the Passthru parameter, Add-Content generates a System.String object representing the content. Otherwise, this cmdlet does not generate any output.| +``` +C:\PS>Add-Content -Path *.txt -Exclude help* -Value "END" -## Example 1 +Description +----------- +This command adds "END" to all text files in the current directory, except for those with file names that begin with "help." -``` -C:\PS>Add-Content -Path *.txt -Exclude help* -Value "END" +``` -Description ------------ -This command adds "END" to all text files in the current directory, except for those with file names that begin with "help." +## Example 2 -``` +``` +C:\PS>Add-Content -Path file1.log, file2.log -Value (get-date) -PassThru -## Example 2 +Description +----------- +This command adds the date to the end of the File1.log and File2.log files and then displays the date at the command line. -``` -C:\PS>Add-Content -Path file1.log, file2.log -Value (get-date) -PassThru +The command uses the Get-Date cmdlet to get the date, and it uses the Value parameter to pass the date to Add-Content. The PassThru parameter sends the added content through the pipeline. Because there is no other cmdlet to receive the passed content, it is displayed at the command line. -Description ------------ -This command adds the date to the end of the File1.log and File2.log files and then displays the date at the command line. +``` -The command uses the Get-Date cmdlet to get the date, and it uses the Value parameter to pass the date to Add-Content. The PassThru parameter sends the added content through the pipeline. Because there is no other cmdlet to receive the passed content, it is displayed at the command line. +## Example 3 -``` +``` +C:\PS>Add-Content -Path monthly.txt -Value (Get-Content c:\rec1\weekly.txt) -## Example 3 +Description +----------- +This command adds the contents of the Weekly.txt file to the end of the Monthly.txt file. It uses the Get-Content cmdlet to get the contents of the Weekly.txt file, and it uses the Value parameter to pass the content of weekly.txt to Add-Content. The parentheses ensure that the Get-Content command is complete before the Add-Content command begins. -``` -C:\PS>Add-Content -Path monthly.txt -Value (Get-Content c:\rec1\weekly.txt) +You can also copy the content of Weekly.txt to a variable, such as $w, and then use the Value parameter to pass the variable to Add-Content. In that case, the command would be "add-content -path monthly.txt -value $w". -Description ------------ -This command adds the contents of the Weekly.txt file to the end of the Monthly.txt file. It uses the Get-Content cmdlet to get the contents of the Weekly.txt file, and it uses the Value parameter to pass the content of weekly.txt to Add-Content. The parentheses ensure that the Get-Content command is complete before the Add-Content command begins. +``` -You can also copy the content of Weekly.txt to a variable, such as $w, and then use the Value parameter to pass the variable to Add-Content. In that case, the command would be "add-content -path monthly.txt -value $w". +## Example 4 -``` +``` +C:\PS>Add-Content -Value (Get-Content test.log) -Path C:\tests\test134\logs\test134.log -## Example 4 +Description +----------- +This command creates a new directory and file and copies the content of an existing file to the newly created file. -``` -C:\PS>Add-Content -Value (Get-Content test.log) -Path C:\tests\test134\logs\test134.log +This command uses the Add-Content cmdlet to add the content. The value of the Value parameter is a Get-Content command that gets content from an existing file, Test.log. -Description ------------ -This command creates a new directory and file and copies the content of an existing file to the newly created file. +The value of the path parameter is a path that does not exist when the command runs. In this example, only the C:\Tests directories exist. The command creates the remaining directories and the Test134.log file. -This command uses the Add-Content cmdlet to add the content. The value of the Value parameter is a Get-Content command that gets content from an existing file, Test.log. +The Force parameter is not required for this command. Add-Content creates directories to complete a path even without the Force parameter. -The value of the path parameter is a path that does not exist when the command runs. In this example, only the C:\Tests directories exist. The command creates the remaining directories and the Test134.log file. +``` -The Force parameter is not required for this command. Add-Content creates directories to complete a path even without the Force parameter. +## Example 5 -``` +``` +C:\PS>Get-Content test.xml | Add-Content final.xml -Force -Encoding UTF8 -## Example 5 +Description +----------- +This command appends the contents of the final.xml file to the contents of the test.xml file. -``` -C:\PS>Get-Content test.xml | Add-Content final.xml -Force -Encoding UTF8 +The command uses the Force parameter so that the command is successful even if the Final.xml file is read-only. It uses the Encoding parameter to specify an encoding of UTF-8. -Description ------------ -This command appends the contents of the final.xml file to the contents of the test.xml file. +``` -The command uses the Force parameter so that the command is successful even if the Final.xml file is read-only. It uses the Encoding parameter to specify an encoding of UTF-8. - -``` - -## See Also - [FileSystem Provider](../FileSystem-Provider.md) - [Clear-Content](../../../Microsoft.PowerShell.Management/Clear-Content.md) - [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) - [Get-ChildItem](../../../Microsoft.PowerShell.Management/Get-ChildItem.md) - [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) - [Get-Item](../../../Microsoft.PowerShell.Management/Get-Item.md) - [Remove-Item](../../../Microsoft.PowerShell.Management/Remove-Item.md) - [Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) +## See Also + [FileSystem Provider](../FileSystem-Provider.md) + [Clear-Content](../../../Microsoft.PowerShell.Management/Clear-Content.md) + [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) + [Get-ChildItem](../../../Microsoft.PowerShell.Management/Get-ChildItem.md) + [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) + [Get-Item](../../../Microsoft.PowerShell.Management/Get-Item.md) + [Remove-Item](../../../Microsoft.PowerShell.Management/Remove-Item.md) + [Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) [Test-Path](../../../Microsoft.PowerShell.Management/Test-Path.md) diff --git a/reference/6/Microsoft.PowerShell.Core/Providers/FileSystem-Provider/Get-ChildItem-for-FileSystem.md b/reference/6/Microsoft.PowerShell.Core/Providers/FileSystem-Provider/Get-ChildItem-for-FileSystem.md index 31d62bc5d9ab..6bdb07292604 100644 --- a/reference/6/Microsoft.PowerShell.Core/Providers/FileSystem-Provider/Get-ChildItem-for-FileSystem.md +++ b/reference/6/Microsoft.PowerShell.Core/Providers/FileSystem-Provider/Get-ChildItem-for-FileSystem.md @@ -8,286 +8,275 @@ online version: http://go.microsoft.com/fwlink/?LinkId=834950 --- # Get-ChildItem for FileSystem -Gets the files and folders in a file system drive. +Gets the files and folders in a file system drive. -## Syntax +## Syntax -``` -Get-ChildItem [-Attributes ] [-Directory] [-File] [-Force] [-Hidden] [-ReadOnly] [-System] [-UseTransaction] [] +``` +Get-ChildItem [-Attributes ] [-Directory] [-File] [-Force] [-Hidden] [-ReadOnly] [-System] [] -``` +``` -## Description - In a file system drive, the [Get-ChildItem](../../../Microsoft.PowerShell.Management/Get-ChildItem.md) cmdlet gets the directories, subdirectories, and files. In a file system directory, it gets subdirectories and files. +## Description + In a file system drive, the [Get-ChildItem](../../../Microsoft.PowerShell.Management/Get-ChildItem.md) cmdlet gets the directories, subdirectories, and files. In a file system directory, it gets subdirectories and files. - By default, [Get-ChildItem](../../../Microsoft.PowerShell.Management/Get-ChildItem.md) gets non-hidden items, but you can use the Directory, File, Hidden, ReadOnly, and System parameters to get only items with these attributes. To create a complex attribute search, use the Attributes parameter. If you use these parameters, [Get-ChildItem](../../../Microsoft.PowerShell.Management/Get-ChildItem.md) gets only the items that meet all search conditions, as though the parameters were connected by an AND operator. + By default, [Get-ChildItem](../../../Microsoft.PowerShell.Management/Get-ChildItem.md) gets non-hidden items, but you can use the Directory, File, Hidden, ReadOnly, and System parameters to get only items with these attributes. To create a complex attribute search, use the Attributes parameter. If you use these parameters, [Get-ChildItem](../../../Microsoft.PowerShell.Management/Get-ChildItem.md) gets only the items that meet all search conditions, as though the parameters were connected by an AND operator. - Note: This custom cmdlet help file explains how the [Get-ChildItem](../../../Microsoft.PowerShell.Management/Get-ChildItem.md) cmdlet works in a file system drive. For information about the [Get-ChildItem](../../../Microsoft.PowerShell.Management/Get-ChildItem.md) cmdlet in all drives, type "[Get-Help](../../Get-Help.md)[Get-ChildItem](../../../Microsoft.PowerShell.Management/Get-ChildItem.md) -Path $null" or see [Get-ChildItem](../../../Microsoft.PowerShell.Management/Get-ChildItem.md) at http://go.microsoft.com/fwlink/?LinkID=113308. + Note: This custom cmdlet help file explains how the [Get-ChildItem](../../../Microsoft.PowerShell.Management/Get-ChildItem.md) cmdlet works in a file system drive. For information about the [Get-ChildItem](../../../Microsoft.PowerShell.Management/Get-ChildItem.md) cmdlet in all drives, type "[Get-Help](../../Get-Help.md)[Get-ChildItem](../../../Microsoft.PowerShell.Management/Get-ChildItem.md) -Path $null" or see [Get-ChildItem](../../../Microsoft.PowerShell.Management/Get-ChildItem.md) at http://go.microsoft.com/fwlink/?LinkID=113308. -## Parameters +## Parameters -### -Attributes - Gets files and folders with the specified attributes. This parameter supports all attributes and lets you specify complex combinations of attributes. +### -Attributes + Gets files and folders with the specified attributes. This parameter supports all attributes and lets you specify complex combinations of attributes. - For example, to get non-system files (not directories) that are encrypted or compressed, type: + For example, to get non-system files (not directories) that are encrypted or compressed, type: - [Get-ChildItem](../../../Microsoft.PowerShell.Management/Get-ChildItem.md) -Attributes !Directory+!System+Encrypted, !Directory+!System+Compressed + [Get-ChildItem](../../../Microsoft.PowerShell.Management/Get-ChildItem.md) -Attributes !Directory+!System+Encrypted, !Directory+!System+Compressed - To find files and folders with commonly used attributes, you can use the Attributes parameter, or the Directory, File, Hidden, ReadOnly, and System switch parameters. + To find files and folders with commonly used attributes, you can use the Attributes parameter, or the Directory, File, Hidden, ReadOnly, and System switch parameters. - The Attributes parameter supports the following attributes: Archive, Compressed, Device, Directory, Encrypted, Hidden, Normal, NotContentIndexed, Offline, ReadOnly, ReparsePoint, SparseFile, System, and Temporary. For a description of these attributes, see the FileAttributes enumeration at http://go.microsoft.com/fwlink/?LinkId=201508. + The Attributes parameter supports the following attributes: Archive, Compressed, Device, Directory, Encrypted, Hidden, Normal, NotContentIndexed, Offline, ReadOnly, ReparsePoint, SparseFile, System, and Temporary. For a description of these attributes, see the FileAttributes enumeration at http://go.microsoft.com/fwlink/?LinkId=201508. - Use the following operators to combine attributes. + Use the following operators to combine attributes. - ! NOT + ! NOT - \+ AND + \+ AND - , OR + , OR - No spaces are permitted between an operator and its attribute. However, spaces are permitted before commas. + No spaces are permitted between an operator and its attribute. However, spaces are permitted before commas. - You can use the following abbreviations for commonly used attributes: + You can use the following abbreviations for commonly used attributes: - D Directory + D Directory - H Hidden + H Hidden - R Read-only + R Read-only - S System + S System -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +||| +|-|-| +|Required?|false| +|Position?|named| +|Default Value|| +|Accept Pipeline Input?|false| +|Accept Wildcard Characters?|false| -### -Directory - Gets directories (folders). +### -Directory + Gets directories (folders). - To get only directories, use the Directory parameter and omit the File parameter. To exclude directories, use the File parameter and omit the Directory parameter, or use the Attributes parameter. + To get only directories, use the Directory parameter and omit the File parameter. To exclude directories, use the File parameter and omit the Directory parameter, or use the Attributes parameter. - To get directories, use the Directory parameter, its "ad" alias, or the Directory attribute of the Attributes parameter. + To get directories, use the Directory parameter, its "ad" alias, or the Directory attribute of the Attributes parameter. -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|None| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +||| +|-|-| +|Required?|false| +|Position?|named| +|Default Value|None| +|Accept Pipeline Input?|false| +|Accept Wildcard Characters?|false| -### -File - Gets files. +### -File + Gets files. - To get only files, use the File parameter and omit the Directory parameter. To exclude files, use the Directory parameter and omit the File parameter, or use the Attributes parameter. + To get only files, use the File parameter and omit the Directory parameter. To exclude files, use the Directory parameter and omit the File parameter, or use the Attributes parameter. - To get files, use the File parameter, its "af" alias, or the File value of the Attributes parameter. + To get files, use the File parameter, its "af" alias, or the File value of the Attributes parameter. -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +||| +|-|-| +|Required?|false| +|Position?|named| +|Default Value|| +|Accept Pipeline Input?|false| +|Accept Wildcard Characters?|false| -### -Hidden - Gets only hidden files and directories (folders). By default, [Get-ChildItem](../../../Microsoft.PowerShell.Management/Get-ChildItem.md) gets only non-hidden items, but you can use the Force parameter to include hidden items in the results. +### -Hidden + Gets only hidden files and directories (folders). By default, [Get-ChildItem](../../../Microsoft.PowerShell.Management/Get-ChildItem.md) gets only non-hidden items, but you can use the Force parameter to include hidden items in the results. - To get only hidden items, use the Hidden parameter, its "h" or "ah" aliases, or the Hidden value of the Attributes parameter. To exclude hidden items, omit the Hidden parameter or use the Attributes parameter. + To get only hidden items, use the Hidden parameter, its "h" or "ah" aliases, or the Hidden value of the Attributes parameter. To exclude hidden items, omit the Hidden parameter or use the Attributes parameter. -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +||| +|-|-| +|Required?|false| +|Position?|named| +|Default Value|| +|Accept Pipeline Input?|false| +|Accept Wildcard Characters?|false| -### -ReadOnly - Gets only read-only files and directories (folders). +### -ReadOnly + Gets only read-only files and directories (folders). - To get only read-only items, use the ReadOnly parameter, its "ar" alias, or the ReadOnly value of the Attributes parameter. To exclude read-only items, use the Attributes parameter. + To get only read-only items, use the ReadOnly parameter, its "ar" alias, or the ReadOnly value of the Attributes parameter. To exclude read-only items, use the Attributes parameter. -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +||| +|-|-| +|Required?|false| +|Position?|named| +|Default Value|| +|Accept Pipeline Input?|false| +|Accept Wildcard Characters?|false| -### -System - Gets only system files and directories (folders). +### -System + Gets only system files and directories (folders). - To get only system files and folders, use the System parameter, its "as" alias, or the System value of the Attributes parameter. To exclude system files and folders, use the Attributes parameter. + To get only system files and folders, use the System parameter, its "as" alias, or the System value of the Attributes parameter. To exclude system files and folders, use the Attributes parameter. -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +||| +|-|-| +|Required?|false| +|Position?|named| +|Default Value|| +|Accept Pipeline Input?|false| +|Accept Wildcard Characters?|false| -### -Force - Gets hidden files and folders. By default, hidden files and folder are excluded. You can also get hidden files and folders by using the Hidden parameter or the Hidden value of the Attributes parameter. +### -Force + Gets hidden files and folders. By default, hidden files and folder are excluded. You can also get hidden files and folders by using the Hidden parameter or the Hidden value of the Attributes parameter. -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +||| +|-|-| +|Required?|false| +|Position?|named| +|Default Value|| +|Accept Pipeline Input?|false| +|Accept Wildcard Characters?|false| -### -UseTransaction - Includes the command in the active transaction. This parameter is valid only when a transaction is in progress. For more information, see [about_Transactions](../../About/about_Transactions.md). +### + This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, -OutVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](../../About/about_CommonParameters.md). -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +## Inputs and Outputs + The input type is the type of the objects that you can pipe to the cmdlet. The return type is the type of the objects that the cmdlet returns. -### - This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, -OutVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](../../About/about_CommonParameters.md). +||| +|-|-| +|Inputs|System.String[]

You can pipe a file system path (in quotation marks) to Get-ChildItem.| +|Outputs|System.IO.DirectoryInfo, System.IO.FileInfo, System.String| -## Inputs and Outputs - The input type is the type of the objects that you can pipe to the cmdlet. The return type is the type of the objects that the cmdlet returns. +## Notes + The Attributes, Directory, File, Hidden, ReadOnly, and System parameters were introduced in Windows PowerShell 3.0 and -||| -|-|-| -|Inputs|System.String[]

You can pipe a file system path (in quotation marks) to Get-ChildItem.| -|Outputs|System.IO.DirectoryInfo, System.IO.FileInfo, System.String| + are effective only in file system drives. -## Notes - The Attributes, Directory, File, Hidden, ReadOnly, and System parameters were introduced in Windows PowerShell 3.0 and + Get-ChildItem Alias Reference: - are effective only in file system drives. + --------------------------------\- - Get-ChildItem Alias Reference: + Get-ChildItem dir - --------------------------------\- + Directory d, ad - Get-ChildItem dir + File af - Directory d, ad + Hidden h, ah - File af + ReadOnly ar - Hidden h, ah + System as - ReadOnly ar +## Example 1 - System as +``` +C:\PS>Get-ChildItem -## Example 1 +Description +----------- +This command gets the files and subdirectories in the current directory. If the current directory does not have child items, the command does not return any results. -``` -C:\PS>Get-ChildItem +``` -Description ------------ -This command gets the files and subdirectories in the current directory. If the current directory does not have child items, the command does not return any results. +## Example 2 -``` +``` +C:\PS>Get-Childitem -System -File -Recurse -## Example 2 +Description +----------- +This command gets system files in the current directory and its subdirectories. -``` -C:\PS>Get-Childitem -System -File -Recurse +``` -Description ------------ -This command gets system files in the current directory and its subdirectories. +## Example 3 -``` +``` +C:\PS>Get-ChildItem -Attributes !Directory,!Directory+Hidden -## Example 3 +C:\PS> dir -att !d,!d+h -``` -C:\PS>Get-ChildItem -Attributes !Directory,!Directory+Hidden +Description +----------- +These command get all files, including hidden files, in the current directory, but exclude subdirectories. The second command uses aliases and abbreviations, but has the same effect as the first. -C:\PS> dir -att !d,!d+h +``` -Description ------------ -These command get all files, including hidden files, in the current directory, but exclude subdirectories. The second command uses aliases and abbreviations, but has the same effect as the first. +## Example 4 -``` +``` +C:\PS>dir -ad -## Example 4 +Description +----------- +This command gets the subdirectories in the current directory. It uses the "dir" alias of the Get-ChildItem cmdlet and the "ad" alias of the Directory parameter. -``` -C:\PS>dir -ad +``` -Description ------------ -This command gets the subdirectories in the current directory. It uses the "dir" alias of the Get-ChildItem cmdlet and the "ad" alias of the Directory parameter. +## Example 5 -``` +``` +C:\PS>Get-ChildItem -File -Attributes !ReadOnly -path C:\ps-test -## Example 5 +Description +----------- +This command gets read-write files in the C:\ps-test directory. -``` -C:\PS>Get-ChildItem -File -Attributes !ReadOnly -path C:\ps-test +``` -Description ------------ -This command gets read-write files in the C:\ps-test directory. +## Example 6 -``` +``` +C:\PS>get-childitem . -include *.txt -recurse -force -## Example 6 +Description +----------- +This command gets all of the .txt files in the current directory and its subdirectories. -``` -C:\PS>get-childitem . -include *.txt -recurse -force +The dot (.) represents the current directory. The Include parameter specifies the file name extension. The Recurse parameter directs Windows PowerShell to search for objects recursively, and it indicates that the subject of the command is the specified directory and its contents. The Force parameter adds hidden files to the display. -Description ------------ -This command gets all of the .txt files in the current directory and its subdirectories. +``` -The dot (.) represents the current directory. The Include parameter specifies the file name extension. The Recurse parameter directs Windows PowerShell to search for objects recursively, and it indicates that the subject of the command is the specified directory and its contents. The Force parameter adds hidden files to the display. +## Example 7 -``` +``` +C:\PS>get-childitem c:\windows\logs\* -include *.txt -exclude A* -## Example 7 +Description +----------- +This command gets the .txt files in the Logs subdirectory, except for those whose names start with the letter A. It uses the wildcard character (*) to indicate the contents of the Logs subdirectory, not the directory container. Because the command does not include the Recurse parameter, Get-ChildItem does not include the contents of the current directory automatically; you need to specify it. -``` -C:\PS>get-childitem c:\windows\logs\* -include *.txt -exclude A* +``` -Description ------------ -This command gets the .txt files in the Logs subdirectory, except for those whose names start with the letter A. It uses the wildcard character (*) to indicate the contents of the Logs subdirectory, not the directory container. Because the command does not include the Recurse parameter, Get-ChildItem does not include the contents of the current directory automatically; you need to specify it. +## Example 8 -``` +``` +C:\PS>get-childitem -name -## Example 8 +Description +----------- +This command retrieves only the names of items in the current directory. -``` -C:\PS>get-childitem -name +``` -Description ------------ -This command retrieves only the names of items in the current directory. - -``` - -## See Also - [FileSystem Provider](../FileSystem-Provider.md) - [Clear-Content](../../../Microsoft.PowerShell.Management/Clear-Content.md) - [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) - [Get-ChildItem](../../../Microsoft.PowerShell.Management/Get-ChildItem.md) - [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) - [Get-Item](../../../Microsoft.PowerShell.Management/Get-Item.md) - [Remove-Item](../../../Microsoft.PowerShell.Management/Remove-Item.md) - [Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) +## See Also + [FileSystem Provider](../FileSystem-Provider.md) + [Clear-Content](../../../Microsoft.PowerShell.Management/Clear-Content.md) + [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) + [Get-ChildItem](../../../Microsoft.PowerShell.Management/Get-ChildItem.md) + [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) + [Get-Item](../../../Microsoft.PowerShell.Management/Get-Item.md) + [Remove-Item](../../../Microsoft.PowerShell.Management/Remove-Item.md) + [Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) [Test-Path](../../../Microsoft.PowerShell.Management/Test-Path.md) diff --git a/reference/6/Microsoft.PowerShell.Core/Providers/FileSystem-Provider/Get-Content-for-FileSystem.md b/reference/6/Microsoft.PowerShell.Core/Providers/FileSystem-Provider/Get-Content-for-FileSystem.md index 0dc9118751ea..f34d1a0531b0 100644 --- a/reference/6/Microsoft.PowerShell.Core/Providers/FileSystem-Provider/Get-Content-for-FileSystem.md +++ b/reference/6/Microsoft.PowerShell.Core/Providers/FileSystem-Provider/Get-Content-for-FileSystem.md @@ -8,306 +8,295 @@ online version: http://go.microsoft.com/fwlink/?LinkId=834951 --- # Get-Content for FileSystem -Gets the contents of a file. +Gets the contents of a file. -## Syntax +## Syntax -``` -Get-Content [-Delimiter ] [-Encoding { | | | | | | | | | | }] [-Force] [-Raw ] [-Stream ] [-Wait] [-UseTransaction] [] +``` +Get-Content [-Delimiter ] [-Encoding { | | | | | | | | | | }] [-Force] [-Raw ] [-Stream ] [-Wait] [] -``` +``` -## Description - In file system drives, you can use the [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) cmdlet to get content that you display at the command line, save in a variable for processing, or write to another file. It is not valid on folders. +## Description + In file system drives, you can use the [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) cmdlet to get content that you display at the command line, save in a variable for processing, or write to another file. It is not valid on folders. - Note: This custom cmdlet help file explains how the [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) cmdlet works in a file system drive. For information about the [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) cmdlet in all drives, type "[Get-Help](../../Get-Help.md)[Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) -Path $null" or see [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) at http://go.microsoft.com/fwlink/?LinkID=113310. + Note: This custom cmdlet help file explains how the [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) cmdlet works in a file system drive. For information about the [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) cmdlet in all drives, type "[Get-Help](../../Get-Help.md)[Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) -Path $null" or see [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) at http://go.microsoft.com/fwlink/?LinkID=113310. -## Parameters +## Parameters -### -Encoding - Specifies the file encoding. The default is ASCII. +### -Encoding + Specifies the file encoding. The default is ASCII. - Valid values are: + Valid values are: - -- ASCII: Uses the encoding for the ASCII (7-bit) character set. + -- ASCII: Uses the encoding for the ASCII (7-bit) character set. - -- BigEndianUnicode: Encodes in UTF-16 format using the big-endian byte order. + -- BigEndianUnicode: Encodes in UTF-16 format using the big-endian byte order. - -- Byte: Encodes a set of characters into a sequence of bytes. + -- Byte: Encodes a set of characters into a sequence of bytes. - -- String: Uses the encoding type for a string. + -- String: Uses the encoding type for a string. - -- Unicode: Encodes in UTF-16 format using the little-endian byte order. + -- Unicode: Encodes in UTF-16 format using the little-endian byte order. - -- UTF7: Encodes in UTF-7 format. + -- UTF7: Encodes in UTF-7 format. - -- UTF8: Encodes in UTF-8 format. + -- UTF8: Encodes in UTF-8 format. - -- Unknown: The encoding type is unknown or invalid. The data can be treated as binary. + -- Unknown: The encoding type is unknown or invalid. The data can be treated as binary. - Encoding is a dynamic parameter that the FileSystem provider adds to the [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) cmdlet. This parameter works only in file system drives. + Encoding is a dynamic parameter that the FileSystem provider adds to the [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) cmdlet. This parameter works only in file system drives. - When reading from and writing to binary files, use a value of Byte for the Encoding dynamic parameter and a value of 0 for the ReadCount parameter. A ReadCount value of 0 reads the entire file in a single read operation and converts it into a single object (PSObject). The default ReadCount value, 1, reads one byte in each read operation and converts each byte into a separate object, which causes errors when you use the [Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) cmdlet to write the bytes to a file. For more information, see the examples. + When reading from and writing to binary files, use a value of Byte for the Encoding dynamic parameter and a value of 0 for the ReadCount parameter. A ReadCount value of 0 reads the entire file in a single read operation and converts it into a single object (PSObject). The default ReadCount value, 1, reads one byte in each read operation and converts each byte into a separate object, which causes errors when you use the [Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) cmdlet to write the bytes to a file. For more information, see the examples. -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|ASCII| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +||| +|-|-| +|Required?|false| +|Position?|named| +|Default Value|ASCII| +|Accept Pipeline Input?|false| +|Accept Wildcard Characters?|false| -### -Delimiter - Specifies the delimiter that [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) uses to divide the file into objects while it reads. +### -Delimiter + Specifies the delimiter that [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) uses to divide the file into objects while it reads. - The default is "\n", the end-of-line character. + The default is "\n", the end-of-line character. - Therefore, by default, when reading a text file, [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) returns a collection of string objects, each of which ends with an end-of-line character. + Therefore, by default, when reading a text file, [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) returns a collection of string objects, each of which ends with an end-of-line character. - When you enter a delimiter that does not exist in the file, [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) returns the entire file as a single, undelimited object. + When you enter a delimiter that does not exist in the file, [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) returns the entire file as a single, undelimited object. - You can use this parameter to split a large file into smaller files by specifying a file separator, such as "End of Example", as the delimiter. The delimiter is preserved (not discarded) and becomes the last item in each file section. + You can use this parameter to split a large file into smaller files by specifying a file separator, such as "End of Example", as the delimiter. The delimiter is preserved (not discarded) and becomes the last item in each file section. - Delimiter is a dynamic parameter that the FileSystem provider adds to the [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) cmdlet. This parameter works only in file system drives. + Delimiter is a dynamic parameter that the FileSystem provider adds to the [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) cmdlet. This parameter works only in file system drives. - Troubleshooting Note: Currently, when the value of the Delimiter parameter is an empty string, [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) does not return anything. This is a known issue. To force [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) to return the entire file as a single, undelimited string, enter a value that does not exist in the file. + Troubleshooting Note: Currently, when the value of the Delimiter parameter is an empty string, [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) does not return anything. This is a known issue. To force [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) to return the entire file as a single, undelimited string, enter a value that does not exist in the file. -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|End-of-line character| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +||| +|-|-| +|Required?|false| +|Position?|named| +|Default Value|End-of-line character| +|Accept Pipeline Input?|false| +|Accept Wildcard Characters?|false| -### -Force - Gets the contents of all files, including hidden files. By default, [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) does not get the contents of hidden files unless you specify the hidden file by name. +### -Force + Gets the contents of all files, including hidden files. By default, [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) does not get the contents of hidden files unless you specify the hidden file by name. -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|False| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +||| +|-|-| +|Required?|false| +|Position?|named| +|Default Value|False| +|Accept Pipeline Input?|false| +|Accept Wildcard Characters?|false| -### -Raw - Ignores newline characters and returns the entire contents of a file in one string. By default, the contents of a file is returned as a array of strings that is delimited by the newline character. +### -Raw + Ignores newline characters and returns the entire contents of a file in one string. By default, the contents of a file is returned as a array of strings that is delimited by the newline character. - Raw is a dynamic parameter that the FileSystem provider adds to the [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) cmdlet. This parameter works only in file system drives. + Raw is a dynamic parameter that the FileSystem provider adds to the [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) cmdlet. This parameter works only in file system drives. - This parameter is introduced in Windows PowerShell 3.0. + This parameter is introduced in Windows PowerShell 3.0. -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +||| +|-|-| +|Required?|false| +|Position?|named| +|Default Value|| +|Accept Pipeline Input?|false| +|Accept Wildcard Characters?|false| -### -Wait - Waits for the cmdlet to get the content before returning the command prompt. While waiting, [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) checks the file once each second until you interrupt it, such as by pressing CTRL+C. +### -Wait + Waits for the cmdlet to get the content before returning the command prompt. While waiting, [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) checks the file once each second until you interrupt it, such as by pressing CTRL+C. - Wait is a dynamic parameter that the FileSystem provider adds to the [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) cmdlet. This parameter works only in file system drives. + Wait is a dynamic parameter that the FileSystem provider adds to the [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) cmdlet. This parameter works only in file system drives. -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|False| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +||| +|-|-| +|Required?|false| +|Position?|named| +|Default Value|False| +|Accept Pipeline Input?|false| +|Accept Wildcard Characters?|false| -### -Stream - Gets the contents of the specified alternate NTFS file stream from the file. Enter the stream name. Wildcards are not supported. +### -Stream + Gets the contents of the specified alternate NTFS file stream from the file. Enter the stream name. Wildcards are not supported. - Stream is a dynamic parameter that the FileSystem provider adds to the [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) cmdlet. This parameter works only in file system drives. + Stream is a dynamic parameter that the FileSystem provider adds to the [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) cmdlet. This parameter works only in file system drives. - This parameter is introduced in Windows PowerShell 3.0. + This parameter is introduced in Windows PowerShell 3.0. -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +||| +|-|-| +|Required?|false| +|Position?|named| +|Default Value|| +|Accept Pipeline Input?|false| +|Accept Wildcard Characters?|false| -### -UseTransaction - Includes the command in the active transaction. This parameter is valid only when a transaction is in progress. For more information, see [about_Transactions](../../About/about_Transactions.md). +### + This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, -OutVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](../../About/about_CommonParameters.md). -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +## Inputs and Outputs + The input type is the type of the objects that you can pipe to the cmdlet. The return type is the type of the objects that the cmdlet returns. -### - This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, -OutVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](../../About/about_CommonParameters.md). +||| +|-|-| +|Inputs|System.Int64, System.String[], System.Management.Automation.PSCredential

You can pipe the read count, total count, paths, or credentials to Get-Content.| +|Outputs|System.Object, System.String

Get-Content returns objects that represent the content that it gets. The object type depends on the content type. If you use the Stream parameter, the cmdlet returns the alternate data stream contents as a string.| -## Inputs and Outputs - The input type is the type of the objects that you can pipe to the cmdlet. The return type is the type of the objects that the cmdlet returns. +## Example 1 -||| -|-|-| -|Inputs|System.Int64, System.String[], System.Management.Automation.PSCredential

You can pipe the read count, total count, paths, or credentials to Get-Content.| -|Outputs|System.Object, System.String

Get-Content returns objects that represent the content that it gets. The object type depends on the content type. If you use the Stream parameter, the cmdlet returns the alternate data stream contents as a string.| +``` +C:\PS>Get-Content -Path C:\Chapters\chapter1.txt -## Example 1 +Description +----------- +This command gets the content of the Chapter1.txt file and displays it in the console. It uses the Path parameter to specify the name of the item. -``` -C:\PS>Get-Content -Path C:\Chapters\chapter1.txt +Get-Content actually passes the content down the pipeline, but because there are no other cmdlets in the pipeline, Windows PowerShell formats the contents and displays it in the console. -Description ------------ -This command gets the content of the Chapter1.txt file and displays it in the console. It uses the Path parameter to specify the name of the item. +``` -Get-Content actually passes the content down the pipeline, but because there are no other cmdlets in the pipeline, Windows PowerShell formats the contents and displays it in the console. +## Example 2 -``` +``` +C:\PS>Get-Content C:\Logs\Log060912.txt -TotalCount 50 | Set-Content Sample.txt -## Example 2 +Description +----------- +This command gets the first 50 lines of the Log060912.txt file and stores them in the sample.txt file. -``` -C:\PS>Get-Content C:\Logs\Log060912.txt -TotalCount 50 | Set-Content Sample.txt +The command uses the Get-Content cmdlet to get the text in the file. (The name of Path parameter, which is optional, is omitted.) The TotalCount parameter limits the retrieval to the first 50 lines. The pipeline operator (|) sends the result to Set-Content, which places it in the sample.txt file. -Description ------------ -This command gets the first 50 lines of the Log060912.txt file and stores them in the sample.txt file. +``` -The command uses the Get-Content cmdlet to get the text in the file. (The name of Path parameter, which is optional, is omitted.) The TotalCount parameter limits the retrieval to the first 50 lines. The pipeline operator (|) sends the result to Set-Content, which places it in the sample.txt file. +## Example 3 -``` +``` +C:\PS>(Get-Content Cmdlets.txt -TotalCount 5)[-1] -## Example 3 +Description +----------- +This command gets the fifth line of the Cmdlets.txt text file. It uses the TotalCount parameter to get the first five lines and then uses array notation to get the last line (indicated by "-1") of the resulting set. -``` -C:\PS>(Get-Content Cmdlets.txt -TotalCount 5)[-1] +``` -Description ------------ -This command gets the fifth line of the Cmdlets.txt text file. It uses the TotalCount parameter to get the first five lines and then uses array notation to get the last line (indicated by "-1") of the resulting set. +## Example 4 -``` +``` +C:\PS>Get-Content .\DataSets\*.csv -Delimiter "*---*" -Force -Encoding UTF8 -## Example 4 +Description +----------- +This command gets the contents of all CSV files in the DataSets subdirectory. It uses the Force parameter to get all files, including hidden files, and the Encoding parameter to specify the file encoding. -``` -C:\PS>Get-Content .\DataSets\*.csv -Delimiter "*---*" -Force -Encoding UTF8 +The command also uses the Delimiter parameter to divide the returned content into sets, each of which ends at the CSV file row that contains the "*----*" marker. -Description ------------ -This command gets the contents of all CSV files in the DataSets subdirectory. It uses the Force parameter to get all files, including hidden files, and the Encoding parameter to specify the file encoding. +``` -The command also uses the Delimiter parameter to divide the returned content into sets, each of which ends at the CSV file row that contains the "*----*" marker. +## Example 5 -``` +``` +C:\PS>Get-Content .\Copy-Scripts.ps1 -Stream Zone.Identifier -## Example 5 +[ZoneTransfer] +ZoneId=3 -``` -C:\PS>Get-Content .\Copy-Scripts.ps1 -Stream Zone.Identifier +Description +----------- +This command uses the Stream parameter to get the content of the Zone.Identifier alternate data stream. The output includes Zone ID value of 3, which represents the Internet. -[ZoneTransfer] -ZoneId=3 +The Stream parameter is introduced in Windows PowerShell 3.0. -Description ------------ -This command uses the Stream parameter to get the content of the Zone.Identifier alternate data stream. The output includes Zone ID value of 3, which represents the Internet. +``` -The Stream parameter is introduced in Windows PowerShell 3.0. +## Example 6 -``` +``` +C:\PS>$Manifest = (Get-Module -List PSScheduledJob).Path -## Example 6 +C:\PS>$Hash = Invoke-Expression (Get-Content $Manifest -Raw) -``` -C:\PS>$Manifest = (Get-Module -List PSScheduledJob).Path +C:\PS>$Hash -C:\PS>$Hash = Invoke-Expression (Get-Content $Manifest -Raw) +Name Value +---- ----- +Copyright ? Microsoft Corporation. All rights reserved. +ModuleToProcess Microsoft.PowerShell.ScheduledJob.dll +FormatsToProcess PSScheduledJob.Format.ps1xml +PowerShellVersion 3.0 +CompanyName Microsoft Corporation +GUID 50cdb55f-5ab7-489f-9e94-4ec21ff51e59 +Author Microsoft Corporation +CLRVersion 4.0 +CmdletsToExport {New-JobTrigger, Add-JobTrigger, Remove-JobTrigger, Get-JobTrigger...} +TypesToProcess PSScheduledJob.types.ps1xml +HelpInfoURI http://go.microsoft.com/fwlink/?LinkID=223911 +ModuleVersion 1.0.0.0 -C:\PS>$Hash +C:\PS>$Hash.ModuleToProcess +Microsoft.PowerShell.ScheduledJob.dll -Name Value ----- ----- -Copyright ? Microsoft Corporation. All rights reserved. -ModuleToProcess Microsoft.PowerShell.ScheduledJob.dll -FormatsToProcess PSScheduledJob.Format.ps1xml -PowerShellVersion 3.0 -CompanyName Microsoft Corporation -GUID 50cdb55f-5ab7-489f-9e94-4ec21ff51e59 -Author Microsoft Corporation -CLRVersion 4.0 -CmdletsToExport {New-JobTrigger, Add-JobTrigger, Remove-JobTrigger, Get-JobTrigger...} -TypesToProcess PSScheduledJob.types.ps1xml -HelpInfoURI http://go.microsoft.com/fwlink/?LinkID=223911 -ModuleVersion 1.0.0.0 +Description +----------- +The commands in this example get the contents of a module manifest file (.psd1) as a hash table. The manifest file contains a hash table, but if you get the contents without the Raw dynamic parameter, it is returned as an array of newline-delimited strings. -C:\PS>$Hash.ModuleToProcess -Microsoft.PowerShell.ScheduledJob.dll +The Raw dynamic parameter is introduced in Windows PowerShell 3.0. -Description ------------ -The commands in this example get the contents of a module manifest file (.psd1) as a hash table. The manifest file contains a hash table, but if you get the contents without the Raw dynamic parameter, it is returned as an array of newline-delimited strings. +The first command uses the Path property of modules to get the path to the file that contains the module manifest for the PSScheduledJob module. It saves the path in the $Manifest variable. -The Raw dynamic parameter is introduced in Windows PowerShell 3.0. +The second command uses the Invoke-Expression cmdlet to run a Get-Content command and the Raw dynamic parameter of the Get-Content cmdlet to get the contents of the module manifest file in a single string. The command saves the hash table in the $Hash variable. -The first command uses the Path property of modules to get the path to the file that contains the module manifest for the PSScheduledJob module. It saves the path in the $Manifest variable. +The third command gets the hash table in the Hash variable. The contents is returned as a collection of name-value pairs. -The second command uses the Invoke-Expression cmdlet to run a Get-Content command and the Raw dynamic parameter of the Get-Content cmdlet to get the contents of the module manifest file in a single string. The command saves the hash table in the $Hash variable. +The fourth command uses the ModuleToProcess property of the hash table to get the value of the ModuleToProcess key in the module manifest. -The third command gets the hash table in the Hash variable. The contents is returned as a collection of name-value pairs. +``` -The fourth command uses the ModuleToProcess property of the hash table to get the value of the ModuleToProcess key in the module manifest. +## Example 7 -``` +``` +C:\PS>$a = Get-Content -Path .\Download.zip -Encoding Byte -ReadCount 0 -## Example 7 +Set-Content -Path \\Server\Share\Download.zip -Encoding Byte -Value $a -``` -C:\PS>$a = Get-Content -Path .\Download.zip -Encoding Byte -ReadCount 0 +$b = Get-Content -Path .\Download.zip -Encoding Byte +Set-Content -Path \\Server\Share\Download.zip -Encoding Byte -Value $b -Set-Content -Path \\Server\Share\Download.zip -Encoding Byte -Value $a +Set-Content : Cannot proceed with byte encoding. When using byte encoding the content must be of type byte. +At line:1 char:1 ++ Set-Content \\Server\Share\Download.zip -Encoding Byte -Value $b ++ [!INCLUDE[]()][!INCLUDE[]()][!INCLUDE[]()]~~~~~ + + CategoryInfo : InvalidArgument: (:) [Set-Content], PSArgumentException + + FullyQualifiedErrorId : Argument,Microsoft.PowerShell.Commands.SetContentCommand -$b = Get-Content -Path .\Download.zip -Encoding Byte -Set-Content -Path \\Server\Share\Download.zip -Encoding Byte -Value $b +Description +----------- +This example shows how to use the ReadCount parameter of the Get-Content cmdlet with a value of 0 to avoid byte-related errors when using the Set-Content cmdlet to write the bytes to a file. -Set-Content : Cannot proceed with byte encoding. When using byte encoding the content must be of type byte. -At line:1 char:1 -+ Set-Content \\Server\Share\Download.zip -Encoding Byte -Value $b -+ [!INCLUDE[]()][!INCLUDE[]()][!INCLUDE[]()]~~~~~ - + CategoryInfo : InvalidArgument: (:) [Set-Content], PSArgumentException - + FullyQualifiedErrorId : Argument,Microsoft.PowerShell.Commands.SetContentCommand +When getting the content of a file in bytes, Get-Content creates an object (PSObject) for the bytes in each read operation. If you read the bytes one at a time, which is the default, Get-Content creates an object for each byte. The objects cause errors when you use the Set-Content cmdlet to write the bytes to a file. -Description ------------ -This example shows how to use the ReadCount parameter of the Get-Content cmdlet with a value of 0 to avoid byte-related errors when using the Set-Content cmdlet to write the bytes to a file. +The first command uses the Get-Content cmdlet to get the contents of the Download.zip file and save it in the $a variable. The command uses the Encoding dynamic parameter with a value of Byte. It also uses the ReadCount parameter with a value of 0, which directs Get-Content to get the file contents in a single read operation. The default value of the ReadCount parameter, 1, gets one byte at a time. -When getting the content of a file in bytes, Get-Content creates an object (PSObject) for the bytes in each read operation. If you read the bytes one at a time, which is the default, Get-Content creates an object for each byte. The objects cause errors when you use the Set-Content cmdlet to write the bytes to a file. +The second command uses the Set-Content cmdlet to write the bytes in the $a variable to the Download.zip file on a file share. The command succeeds. -The first command uses the Get-Content cmdlet to get the contents of the Download.zip file and save it in the $a variable. The command uses the Encoding dynamic parameter with a value of Byte. It also uses the ReadCount parameter with a value of 0, which directs Get-Content to get the file contents in a single read operation. The default value of the ReadCount parameter, 1, gets one byte at a time. +The third and fourth commands show the same sequence without the ReadCount parameter. -The second command uses the Set-Content cmdlet to write the bytes in the $a variable to the Download.zip file on a file share. The command succeeds. +The third command uses the Encoding dynamic parameter of the Get-Content cmdlet to get the contents of the Download.zip file and save it in the $b variable. Because the command omits the ReadCount parameter, it uses the default value of 1. -The third and fourth commands show the same sequence without the ReadCount parameter. +The fourth command uses the Set-Content cmdlet to write the bytes in the $b variable to the Download.zip file on a file share. Because the content is a collection of objects, rather than a single object that contains a byte array, the command fails. -The third command uses the Encoding dynamic parameter of the Get-Content cmdlet to get the contents of the Download.zip file and save it in the $b variable. Because the command omits the ReadCount parameter, it uses the default value of 1. +``` -The fourth command uses the Set-Content cmdlet to write the bytes in the $b variable to the Download.zip file on a file share. Because the content is a collection of objects, rather than a single object that contains a byte array, the command fails. - -``` - -## See Also - [FileSystem Provider](../FileSystem-Provider.md) - [Clear-Content](../../../Microsoft.PowerShell.Management/Clear-Content.md) - [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) - [Get-ChildItem](../../../Microsoft.PowerShell.Management/Get-ChildItem.md) - [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) - [Get-Item](../../../Microsoft.PowerShell.Management/Get-Item.md) - [Remove-Item](../../../Microsoft.PowerShell.Management/Remove-Item.md) - [Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) +## See Also + [FileSystem Provider](../FileSystem-Provider.md) + [Clear-Content](../../../Microsoft.PowerShell.Management/Clear-Content.md) + [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) + [Get-ChildItem](../../../Microsoft.PowerShell.Management/Get-ChildItem.md) + [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) + [Get-Item](../../../Microsoft.PowerShell.Management/Get-Item.md) + [Remove-Item](../../../Microsoft.PowerShell.Management/Remove-Item.md) + [Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) [Test-Path](../../../Microsoft.PowerShell.Management/Test-Path.md) diff --git a/reference/6/Microsoft.PowerShell.Core/Providers/FileSystem-Provider/Set-Content-for-FileSystem.md b/reference/6/Microsoft.PowerShell.Core/Providers/FileSystem-Provider/Set-Content-for-FileSystem.md index 8c62b5e182fd..ae67263f126e 100644 --- a/reference/6/Microsoft.PowerShell.Core/Providers/FileSystem-Provider/Set-Content-for-FileSystem.md +++ b/reference/6/Microsoft.PowerShell.Core/Providers/FileSystem-Provider/Set-Content-for-FileSystem.md @@ -8,187 +8,176 @@ online version: http://go.microsoft.com/fwlink/?LinkId=834955 --- # Set-Content for FileSystem -Replaces the contents of a file with contents that you specify. +Replaces the contents of a file with contents that you specify. -## Syntax +## Syntax -``` -Set-Content [-Encoding { | | | | | | | | | | }] [-Force] [-Stream ] [-Confirm] [-WhatIf] [-UseTransaction] [] +``` +Set-Content [-Encoding { | | | | | | | | | | }] [-Force] [-Stream ] [-Confirm] [-WhatIf] [] -``` +``` -## Description - In file system drives, the [Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) cmdlet overwrites or replaces the content of one or more files with the content that you specify. This cmdlet is not valid on folders. +## Description + In file system drives, the [Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) cmdlet overwrites or replaces the content of one or more files with the content that you specify. This cmdlet is not valid on folders. - Note: This custom cmdlet help file explains how the [Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) cmdlet works in a file system drive. For information about the [Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) cmdlet in all drives, type "[Get-Help](../../Get-Help.md)[Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) -Path $null" or see [Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) at http://go.microsoft.com/fwlink/?LinkID=113392. + Note: This custom cmdlet help file explains how the [Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) cmdlet works in a file system drive. For information about the [Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) cmdlet in all drives, type "[Get-Help](../../Get-Help.md)[Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) -Path $null" or see [Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) at http://go.microsoft.com/fwlink/?LinkID=113392. -## Parameters +## Parameters -### -Encoding - Specifies the file encoding. The default is ASCII. +### -Encoding + Specifies the file encoding. The default is ASCII. - Valid values are: + Valid values are: - -- ASCII: Uses the encoding for the ASCII (7-bit) character set. + -- ASCII: Uses the encoding for the ASCII (7-bit) character set. - -- BigEndianUnicode: Encodes in UTF-16 format using the big-endian byte order. + -- BigEndianUnicode: Encodes in UTF-16 format using the big-endian byte order. - -- Byte: Encodes a set of characters into a sequence of bytes. + -- Byte: Encodes a set of characters into a sequence of bytes. - -- String: Uses the encoding type for a string. + -- String: Uses the encoding type for a string. - -- Unicode: Encodes in UTF-16 format using the little-endian byte order. + -- Unicode: Encodes in UTF-16 format using the little-endian byte order. - -- UTF7: Encodes in UTF-7 format. + -- UTF7: Encodes in UTF-7 format. - -- UTF8: Encodes in UTF-8 format. + -- UTF8: Encodes in UTF-8 format. - -- Unknown: The encoding type is unknown or invalid. The data can be treated as binary. + -- Unknown: The encoding type is unknown or invalid. The data can be treated as binary. - Encoding is a dynamic parameter that the FileSystem provider adds to the [Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) cmdlet. This parameter works only in file system drives. + Encoding is a dynamic parameter that the FileSystem provider adds to the [Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) cmdlet. This parameter works only in file system drives. -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|ASCII| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +||| +|-|-| +|Required?|false| +|Position?|named| +|Default Value|ASCII| +|Accept Pipeline Input?|false| +|Accept Wildcard Characters?|false| -### -Force - Replaces the contents of a file, even if the file is read-only. Without this parameter, read-only files are not changed. +### -Force + Replaces the contents of a file, even if the file is read-only. Without this parameter, read-only files are not changed. -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +||| +|-|-| +|Required?|false| +|Position?|named| +|Default Value|| +|Accept Pipeline Input?|false| +|Accept Wildcard Characters?|false| -### -Stream - Creates or replaces the content in the specified alternate data stream. If the stream does not yet exist, [Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) creates it. Enter the stream name. Wildcards are not supported. +### -Stream + Creates or replaces the content in the specified alternate data stream. If the stream does not yet exist, [Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) creates it. Enter the stream name. Wildcards are not supported. - Stream is a dynamic parameter that the FileSystem provider adds to the [Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) cmdlet. This parameter works only in file system drives. + Stream is a dynamic parameter that the FileSystem provider adds to the [Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) cmdlet. This parameter works only in file system drives. - You can use the [Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) cmdlet to change the content of the Zone.Identifier 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 the [Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) cmdlet to change the content of the Zone.Identifier 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. - This parameter is introduced in Windows PowerShell 3.0. + This parameter is introduced in Windows PowerShell 3.0. -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +||| +|-|-| +|Required?|false| +|Position?|named| +|Default Value|| +|Accept Pipeline Input?|false| +|Accept Wildcard Characters?|false| -### -Confirm - Prompts you for confirmation before executing the command. +### -Confirm + Prompts you for confirmation before executing the command. -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +||| +|-|-| +|Required?|false| +|Position?|named| +|Default Value|| +|Accept Pipeline Input?|false| +|Accept Wildcard Characters?|false| -### -WhatIf - Describes what would happen if you executed the command without actually executing the command. +### -WhatIf + Describes what would happen if you executed the command without actually executing the command. -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +||| +|-|-| +|Required?|false| +|Position?|named| +|Default Value|| +|Accept Pipeline Input?|false| +|Accept Wildcard Characters?|false| -### -UseTransaction - Includes the command in the active transaction. This parameter is valid only when a transaction is in progress. For more information, see [about_Transactions](../../About/about_Transactions.md). +### + This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, -OutVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](../../About/about_CommonParameters.md). -||| -|-|-| -|Required?|false| -|Position?|named| -|Default Value|| -|Accept Pipeline Input?|false| -|Accept Wildcard Characters?|false| +## Inputs and Outputs + The input type is the type of the objects that you can pipe to the cmdlet. The return type is the type of the objects that the cmdlet returns. -### - This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, -OutVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](../../About/about_CommonParameters.md). +||| +|-|-| +|Inputs|System.Object[], System.String[], System.Management.Automation.PSCredential

You can pipe a value (object), a path, or a credential object to Set-Content| +|Outputs|None or System.String

When you use the Passthru parameter, Set-Content generates a System.String object representing the content. Otherwise, this cmdlet does not generate any output.| -## Inputs and Outputs - The input type is the type of the objects that you can pipe to the cmdlet. The return type is the type of the objects that the cmdlet returns. +## Example 1 -||| -|-|-| -|Inputs|System.Object[], System.String[], System.Management.Automation.PSCredential

You can pipe a value (object), a path, or a credential object to Set-Content| -|Outputs|None or System.String

When you use the Passthru parameter, Set-Content generates a System.String object representing the content. Otherwise, this cmdlet does not generate any output.| +``` +C:\PS>Set-Content -Path C:\Test1\test*.txt -Value "Hello, World" -## Example 1 +Description +----------- +This command replaces the contents of all files in the Test1 directory that have names beginning with "test" with "Hello, World". This example shows how to specify content by typing it in the command. -``` -C:\PS>Set-Content -Path C:\Test1\test*.txt -Value "Hello, World" +``` -Description ------------ -This command replaces the contents of all files in the Test1 directory that have names beginning with "test" with "Hello, World". This example shows how to specify content by typing it in the command. +## Example 2 -``` +``` +C:\PS>Get-Date | Set-Content C:\Test1\date.csv -## Example 2 +Description +----------- +This command creates a comma-separated variable-length (csv) file that contains only the current date and time. It uses the Get-Date cmdlet to get the current system date and time. The pipeline operator passes the result to Set-Content, which creates the file and writes the content. -``` -C:\PS>Get-Date | Set-Content C:\Test1\date.csv +If the Test1 directory does not exist, the command fails, but if the file does not exist, the command will create it. -Description ------------ -This command creates a comma-separated variable-length (csv) file that contains only the current date and time. It uses the Get-Date cmdlet to get the current system date and time. The pipeline operator passes the result to Set-Content, which creates the file and writes the content. +``` -If the Test1 directory does not exist, the command fails, but if the file does not exist, the command will create it. +## Example 3 -``` +``` +C:\PS>Get-Content Notice.txt | ForEach-Object {$_ -replace "Warning", "Caution"} | Set-Content Notice.txt -## Example 3 +Description +----------- +This command replaces all instances of "Warning" with "Caution" in the Notice.txt file. -``` -C:\PS>Get-Content Notice.txt | ForEach-Object {$_ -replace "Warning", "Caution"} | Set-Content Notice.txt +It uses the Get-Content cmdlet to get the content of Notice.txt. The pipeline operator sends the results to the ForEach-Object cmdlet, which applies the expression to each line of content in Get-Content. The expression uses the "$_" symbol to refer to the current item and the Replace parameter to specify the text to be replaced. -Description ------------ -This command replaces all instances of "Warning" with "Caution" in the Notice.txt file. +Another pipeline operator sends the changed content to Set-Content which replaces the text in Notice.txt with the new content. -It uses the Get-Content cmdlet to get the content of Notice.txt. The pipeline operator sends the results to the ForEach-Object cmdlet, which applies the expression to each line of content in Get-Content. The expression uses the "$_" symbol to refer to the current item and the Replace parameter to specify the text to be replaced. +The parentheses around the Get-Content command ensure that the Get operation is complete before the Set operation begins. Without them, the command will fail because the two functions will be trying to access the same file. -Another pipeline operator sends the changed content to Set-Content which replaces the text in Notice.txt with the new content. +``` -The parentheses around the Get-Content command ensure that the Get operation is complete before the Set operation begins. Without them, the command will fail because the two functions will be trying to access the same file. +## Example 4 -``` +``` +C:\PS>Get-Content test.xml | Set-Content final.xml -Force -Encoding UTF8 -## Example 4 +Description +----------- +This command replaces the contents of the final.xml file with the contents of the test.xml file. -``` -C:\PS>Get-Content test.xml | Set-Content final.xml -Force -Encoding UTF8 +The command uses the Force parameter so that the command is successful even if the Final.xml file is read-only. It uses the Encoding dynamic parameter to specify an encoding of UTF-8. -Description ------------ -This command replaces the contents of the final.xml file with the contents of the test.xml file. +``` -The command uses the Force parameter so that the command is successful even if the Final.xml file is read-only. It uses the Encoding dynamic parameter to specify an encoding of UTF-8. - -``` - -## See Also - [FileSystem Provider](../FileSystem-Provider.md) - [Clear-Content](../../../Microsoft.PowerShell.Management/Clear-Content.md) - [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) - [Get-ChildItem](../../../Microsoft.PowerShell.Management/Get-ChildItem.md) - [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) - [Get-Item](../../../Microsoft.PowerShell.Management/Get-Item.md) - [Remove-Item](../../../Microsoft.PowerShell.Management/Remove-Item.md) - [Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) +## See Also + [FileSystem Provider](../FileSystem-Provider.md) + [Clear-Content](../../../Microsoft.PowerShell.Management/Clear-Content.md) + [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) + [Get-ChildItem](../../../Microsoft.PowerShell.Management/Get-ChildItem.md) + [Get-Content](../../../Microsoft.PowerShell.Management/Get-Content.md) + [Get-Item](../../../Microsoft.PowerShell.Management/Get-Item.md) + [Remove-Item](../../../Microsoft.PowerShell.Management/Remove-Item.md) + [Set-Content](../../../Microsoft.PowerShell.Management/Set-Content.md) [Test-Path](../../../Microsoft.PowerShell.Management/Test-Path.md) diff --git a/reference/6/Microsoft.PowerShell.Core/Providers/Function-Provider.md b/reference/6/Microsoft.PowerShell.Core/Providers/Function-Provider.md index 567749152b9a..535fdd8b8d21 100644 --- a/reference/6/Microsoft.PowerShell.Core/Providers/Function-Provider.md +++ b/reference/6/Microsoft.PowerShell.Core/Providers/Function-Provider.md @@ -13,43 +13,41 @@ online version: http://go.microsoft.com/fwlink/?LinkId=834961 ## Provider name - Function + Function ## Drives - `Function:` + `Function:` ## Short description - Provides access to the functions defined in Windows PowerShell. + Provides access to the functions defined in Windows PowerShell. ## Detailed description - The Windows PowerShell **Function** provider lets you get, add, change, clear, and delete the functions and filters in Windows PowerShell. + The Windows PowerShell **Function** provider lets you get, add, change, clear, and delete the functions and filters in Windows PowerShell. - A function is a named block of code that performs an action. When you type the function name, the code in the function runs. A filter is a named block of code that establishes conditions for an action. You can type the name of the filter in place of the condition, such as in a [Where-Object](../Where-Object.md) command. + A function is a named block of code that performs an action. When you type the function name, the code in the function runs. A filter is a named block of code that establishes conditions for an action. You can type the name of the filter in place of the condition, such as in a [Where-Object](../Where-Object.md) command. - In the `Function:` drive, functions are preceded by the label "Function" and filters are preceded by the label "Filter", but they operate properly when used in the correct context regardless of the label. + In the `Function:` drive, functions are preceded by the label "Function" and filters are preceded by the label "Filter", but they operate properly when used in the correct context regardless of the label. - The **Function** provider is a flat namespace that contains only the function and filter objects. Neither functions nor filters have child items. + The **Function** provider is a flat namespace that contains only the function and filter objects. Neither functions nor filters have child items. - Each function is an instance of the [System.Management.Automation.FunctionInfo](https://msdn.microsoft.com/library/system.management.automation.functioninfo) class. Each filter is an instance of the [System.Management.Automation.FilterInfo](https://msdn.microsoft.com/library/system.management.automation.filterinfo) class. + Each function is an instance of the [System.Management.Automation.FunctionInfo](https://msdn.microsoft.com/library/system.management.automation.functioninfo) class. Each filter is an instance of the [System.Management.Automation.FilterInfo](https://msdn.microsoft.com/library/system.management.automation.filterinfo) class. - The examples in this section show how to manage functions, but the same methods can be used with filters. + The examples in this section show how to manage functions, but the same methods can be used with filters. - The **Function** provider exposes its data store in the `Function:` drive. To work with functions, you can change your location to the `Function:` drive (`set-location Function:`). Or, you can work from another Windows PowerShell drive. To reference a function from another location, use the drive name (`Function:`) in the path. + The **Function** provider exposes its data store in the `Function:` drive. To work with functions, you can change your location to the `Function:` drive (`set-location Function:`). Or, you can work from another Windows PowerShell drive. To reference a function from another location, use the drive name (`Function:`) in the path. - The **Function** provider supports all of the cmdlets whose names contain the *Item* noun (the `*-Item` cmdlets), except for [Invoke-Item](../../Microsoft.PowerShell.Management/Invoke-Item.md). And, it supports the [Get-Content](../../Microsoft.PowerShell.Management/Get-Content.md) and [Set-Content](../../Microsoft.PowerShell.Management/Set-Content.md) cmdlets. However, it does not support the cmdlets whose names contain the *ItemProperty* noun (the `*-ItemProperty` cmdlets), and it does not support the `-Filter` parameter in any cmdlet. - - All changes to the functions affect the current console only. To save the changes, add the function to the Windows PowerShell profile, or use [Export-Console](there-should-be-an-external-link) to save the current console. + The **Function** provider supports all of the cmdlets whose names contain the *Item* noun (the `*-Item` cmdlets), except for [Invoke-Item](../../Microsoft.PowerShell.Management/Invoke-Item.md). And, it supports the [Get-Content](../../Microsoft.PowerShell.Management/Get-Content.md) and [Set-Content](../../Microsoft.PowerShell.Management/Set-Content.md) cmdlets. However, it does not support the cmdlets whose names contain the *ItemProperty* noun (the `*-ItemProperty` cmdlets), and it does not support the `-Filter` parameter in any cmdlet. ## Capabilities - ShouldProcess + ShouldProcess ## Examples @@ -60,7 +58,7 @@ online version: http://go.microsoft.com/fwlink/?LinkId=834961 #### Example 1 - Changes the current location to the `Function:` drive. You can use this command from any drive in Windows PowerShell. To return to a file system drive, type the drive name. For example, type `set-location c:`. + Changes the current location to the `Function:` drive. You can use this command from any drive in Windows PowerShell. To return to a file system drive, type the drive name. For example, type `set-location c:`. ```powershell Set-Location Function: @@ -72,7 +70,7 @@ Set-Location Function: #### Example 1 - This command gets the list of all the functions in the current session. You can use this command from any Windows PowerShell drive. + This command gets the list of all the functions in the current session. You can use this command from any Windows PowerShell drive. ```powershell Get-ChildItem -Path Function: @@ -81,26 +79,26 @@ Get-ChildItem -Path Function: #### Example 2 - This command gets the `man` function from the `Function:` drive. It uses the [Get-Item](../../Microsoft.PowerShell.Management/Get-Item.md) cmdlet to get the function. The pipeline operator (`|`) sends the result to [Format-Table](../../Microsoft.PowerShell.Utility/Format-Table.md). + This command gets the `man` function from the `Function:` drive. It uses the [Get-Item](../../Microsoft.PowerShell.Management/Get-Item.md) cmdlet to get the function. The pipeline operator (`|`) sends the result to [Format-Table](../../Microsoft.PowerShell.Utility/Format-Table.md). - The `-Wrap` parameter directs text that does not fit on the line onto the next line. The `-Autosize` parameter resizes the table columns to accommodate the text. + The `-Wrap` parameter directs text that does not fit on the line onto the next line. The `-Autosize` parameter resizes the table columns to accommodate the text. ```powershell Get-Item -Path man | Format-Table -Wrap -Autosize ``` - If you are in a different drive, add the drive name (`Function:`) to the path. + If you are in a different drive, add the drive name (`Function:`) to the path. #### Example 3 - These commands both get the function named `c:`. The first command can be used in any drive. The second command is used in the `Function:` drive. + These commands both get the function named `c:`. The first command can be used in any drive. The second command is used in the `Function:` drive. - Because the name ends in a colon, which is the syntax for a drive, you must qualify the path with the drive name. Within the `Function:` drive, you can use either format. In the second command, the dot (`.`) represents the current location. + Because the name ends in a colon, which is the syntax for a drive, you must qualify the path with the drive name. Within the `Function:` drive, you can use either format. In the second command, the dot (`.`) represents the current location. ``` c:\PS> Get-Item -Path Function:c: -PS Function> Get-Item -Path .\c: +PS Function> Get-Item -Path .\c: ``` @@ -109,25 +107,25 @@ PS Function> Get-Item -Path .\c: #### Example 1 - This command uses the [New-Item](../../Microsoft.PowerShell.Management/New-Item.md) cmdlet to create a function called `HKLM:`. The expression in braces is the script block that is represented by the function name. + This command uses the [New-Item](../../Microsoft.PowerShell.Management/New-Item.md) cmdlet to create a function called `HKLM:`. The expression in braces is the script block that is represented by the function name. ```powershell New-Item -Path Function:HKLM: -Value {Set-Location HKLM:} ``` - You can also create a function by typing it at the Windows PowerShell command line. For example, tpe `Function:HKLM: {set-location HKLM:}`. If you are in the `Function:` drive, you can omit the drive name. -Because you cannot specify the "Filter" label in [New-Item](../../Microsoft.PowerShell.Management/New-Item.md), filters are labeled as functions, but they operate properly with any label. To create a filter with the "Filter" label, type the filter at the command line. For example, type `filter:Running {$_.Status -eq "Running"}`. + You can also create a function by typing it at the Windows PowerShell command line. For example, tpe `Function:HKLM: {set-location HKLM:}`. If you are in the `Function:` drive, you can omit the drive name. +Because you cannot specify the "Filter" label in [New-Item](../../Microsoft.PowerShell.Management/New-Item.md), filters are labeled as functions, but they operate properly with any label. To create a filter with the "Filter" label, type the filter at the command line. For example, type `filter:Running {$_.Status -eq "Running"}`. #### Example 2 - This command uses the [New-Item](../../Microsoft.PowerShell.Management/New-Item.md) cmdlet to create a function called `Csrss`. It uses the `-Options` dynamic parameter to specify a value of `ReadOnly` for the **Options** property of the function. + This command uses the [New-Item](../../Microsoft.PowerShell.Management/New-Item.md) cmdlet to create a function called `Csrss`. It uses the `-Options` dynamic parameter to specify a value of `ReadOnly` for the **Options** property of the function. ```powershell New-Item -Path Function: -Name csrss -Options readonly -Value {Get-Process csrss} ``` - This command works from any location. If you are in the `Function:` drive, you can use a dot (`.`) to specify the path. The dot represents the current location. + This command works from any location. If you are in the `Function:` drive, you can use a dot (`.`) to specify the path. The dot represents the current location. ### Deleting a function @@ -135,7 +133,7 @@ New-Item -Path Function: -Name csrss -Options readonly -Value {Get-Process csrss #### Example 1 - This command deletes the `HKLM:` function from the current session. + This command deletes the `HKLM:` function from the current session. ```powershell Remove-Item Function:HKLM: @@ -144,13 +142,13 @@ Remove-Item Function:HKLM: #### Example 2 - This command deletes all the functions from the current session except for the functions whose **Options** property has a value of `Constant`. Without the `-Force` parameter, the command does not delete functions whose **Options** property has a value of `ReadOnly`. + This command deletes all the functions from the current session except for the functions whose **Options** property has a value of `Constant`. Without the `-Force` parameter, the command does not delete functions whose **Options** property has a value of `ReadOnly`. ```powershell Remove-Item Function:* -Force ``` - When you delete all the functions, the command prompt changes because the prompt function, which defines the content of the command prompt, is deleted. + When you delete all the functions, the command prompt changes because the prompt function, which defines the content of the command prompt, is deleted. ### Displaying the properties and methods of functions @@ -158,19 +156,19 @@ Remove-Item Function:* -Force #### Example 1 - This command uses the [Get-Item](../../Microsoft.PowerShell.Management/Get-Item.md) cmdlet to get all the functions. The pipeline operator sends the results to the [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md) cmdlet, which displays the methods and the properties of the object. + This command uses the [Get-Item](../../Microsoft.PowerShell.Management/Get-Item.md) cmdlet to get all the functions. The pipeline operator sends the results to the [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md) cmdlet, which displays the methods and the properties of the object. ```powershell Get-Item -Path Function:* | Get-Member ``` - When you pipe a collection of objects (such as the collection of functions in the `Function:` drive) to [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md), [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md) evaluates each object in the collection separately and returns information about each object type that it finds. If all of the objects are of the same type, it returns information about the single object type. In this case, all of the functions are [FunctionInfo](https://msdn.microsoft.com/library/system.management.automation.functioninfo) objects. -To get information about the collection of [FunctionInfo](https://msdn.microsoft.com/library/system.management.automation.functioninfo) objects, use the `-InputObject` parameter of [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md). For example, type `Get-Member -InputObject (Get-Item Function:*)`. When you use the `-InputObject` parameter, [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md) evaluates the collection, not the objects in the collection. + When you pipe a collection of objects (such as the collection of functions in the `Function:` drive) to [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md), [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md) evaluates each object in the collection separately and returns information about each object type that it finds. If all of the objects are of the same type, it returns information about the single object type. In this case, all of the functions are [FunctionInfo](https://msdn.microsoft.com/library/system.management.automation.functioninfo) objects. +To get information about the collection of [FunctionInfo](https://msdn.microsoft.com/library/system.management.automation.functioninfo) objects, use the `-InputObject` parameter of [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md). For example, type `Get-Member -InputObject (Get-Item Function:*)`. When you use the `-InputObject` parameter, [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md) evaluates the collection, not the objects in the collection. #### Example 2 - This command lists the values of the properties of the `prompt` function. It uses the [Get-Item](../../Microsoft.PowerShell.Management/Get-Item.md) cmdlet to get an object that represents the `prompt` function. The pipeline operator (`|`) sends the results to the [Format-List](../../Microsoft.PowerShell.Utility/Format-List.md) command. The [Format-List](../../Microsoft.PowerShell.Utility/Format-List.md) command uses the `-Property` parameter with a wildcard character (`*`) to format and to display the values of all of the properties of the `prompt` function. + This command lists the values of the properties of the `prompt` function. It uses the [Get-Item](../../Microsoft.PowerShell.Management/Get-Item.md) cmdlet to get an object that represents the `prompt` function. The pipeline operator (`|`) sends the results to the [Format-List](../../Microsoft.PowerShell.Utility/Format-List.md) command. The [Format-List](../../Microsoft.PowerShell.Utility/Format-List.md) command uses the `-Property` parameter with a wildcard character (`*`) to format and to display the values of all of the properties of the `prompt` function. ```powershell Get-Item Function:prompt | Format-List -Property * @@ -182,9 +180,9 @@ Get-Item Function:prompt | Format-List -Property * #### Example 1 - You can use the [Set-Item](../../Microsoft.PowerShell.Management/Set-Item.md) cmdlet with the `-Options` dynamic parameter to change the value of the **Options** property of a function. + You can use the [Set-Item](../../Microsoft.PowerShell.Management/Set-Item.md) cmdlet with the `-Options` dynamic parameter to change the value of the **Options** property of a function. - This command sets the `AllScope` and `ReadOnly` options for the `prompt` function. This command uses the `-Options` dynamic parameter of the [Set-Item](../../Microsoft.PowerShell.Management/Set-Item.md) cmdlet. The `-Options` parameter is available in [Set-Item](../../Microsoft.PowerShell.Management/Set-Item.md) only when you use it with the **Alias** or **Function** provider. + This command sets the `AllScope` and `ReadOnly` options for the `prompt` function. This command uses the `-Options` dynamic parameter of the [Set-Item](../../Microsoft.PowerShell.Management/Set-Item.md) cmdlet. The `-Options` parameter is available in [Set-Item](../../Microsoft.PowerShell.Management/Set-Item.md) only when you use it with the **Alias** or **Function** provider. ```powershell Set-Item -Path Function:prompt -Options "AllScope,ReadOnly" @@ -193,18 +191,18 @@ Set-Item -Path Function:prompt -Options "AllScope,ReadOnly" #### Example 2 - This command uses the [Set-Item](../../Microsoft.PowerShell.Management/Set-Item.md) cmdlet to change the `prompt` function so that it displays the time before the path. + This command uses the [Set-Item](../../Microsoft.PowerShell.Management/Set-Item.md) cmdlet to change the `prompt` function so that it displays the time before the path. ```powershell Set-Item -Path Function:prompt -Value {'PS '+ $(Get-Date -Format t) + " " + $(Get-Location) + '> '} ``` - The change affects both the **Definition** and **ScriptBlock** properties of the [FunctionInfo](https://msdn.microsoft.com/library/system.management.automation.functioninfo) object. To see the effect of the change, type `Get-Item -Path Function:prompt | Format-List -Property *`. + The change affects both the **Definition** and **ScriptBlock** properties of the [FunctionInfo](https://msdn.microsoft.com/library/system.management.automation.functioninfo) object. To see the effect of the change, type `Get-Item -Path Function:prompt | Format-List -Property *`. #### Example 3 - This command uses the [Rename-Item](../../Microsoft.PowerShell.Management/Rename-Item.md) cmdlet to change the name of the `help` function to `gh`. + This command uses the [Rename-Item](../../Microsoft.PowerShell.Management/Rename-Item.md) cmdlet to change the name of the `help` function to `gh`. ```powershell Rename-Item -Path Function:help -NewName gh @@ -216,9 +214,9 @@ Rename-Item -Path Function:help -NewName gh #### Example 1 - This command copies the `prompt` function to `oldPrompt`, effectively creating a new name for the script block that is associated with the prompt function. You can use this to save the original prompt function if you plan to change it. + This command copies the `prompt` function to `oldPrompt`, effectively creating a new name for the script block that is associated with the prompt function. You can use this to save the original prompt function if you plan to change it. - The **Options** property of the new function has a value of `None`. To change the value of the **Options** property, use [Set-Item](../../Microsoft.PowerShell.Management/Set-Item.md). + The **Options** property of the new function has a value of `None`. To change the value of the **Options** property, use [Set-Item](../../Microsoft.PowerShell.Management/Set-Item.md). ```powershell Copy-Item -Path Function:prompt -Destination Function:oldPrompt @@ -227,32 +225,32 @@ Copy-Item -Path Function:prompt -Destination Function:oldPrompt ## Dynamic parameters - Dynamic parameters are cmdlet parameters that are added by a Windows PowerShell provider and are available only when the cmdlet is being used in the provider-enabled drive. + Dynamic parameters are cmdlet parameters that are added by a Windows PowerShell provider and are available only when the cmdlet is being used in the provider-enabled drive. ### `Options` <[System.Management.Automation.ScopedItemOptions](https://msdn.microsoft.com/library/system.management.automation.scopeditemoptions)> - Determines the value of the **Options** property of a function. + Determines the value of the **Options** property of a function. -|Value|Description| -|-----------|-----------------| -|`None`|No options. `None` is the default.| -|`Constant`|The function cannot be deleted, and its properties cannot be changed. `Constant` is available only when you are creating a function. You cannot change the option of an existing function to `Constant`.| -|`Private`|The function is visible only in the current scope (not in child scopes).| -|`ReadOnly`|The properties of the function cannot be changed except by using the `-Force` parameter. You can use [Remove-Item](../../Microsoft.PowerShell.Management/Remove-Item.md) to delete the function.| -|`AllScope`|The function is copied to any new scopes that are created.| +|Value|Description| +|-----------|-----------------| +|`None`|No options. `None` is the default.| +|`Constant`|The function cannot be deleted, and its properties cannot be changed. `Constant` is available only when you are creating a function. You cannot change the option of an existing function to `Constant`.| +|`Private`|The function is visible only in the current scope (not in child scopes).| +|`ReadOnly`|The properties of the function cannot be changed except by using the `-Force` parameter. You can use [Remove-Item](../../Microsoft.PowerShell.Management/Remove-Item.md) to delete the function.| +|`AllScope`|The function is copied to any new scopes that are created.| #### Cmdlets supported: -- [New-Item](../../Microsoft.PowerShell.Management/New-Item.md) +- [New-Item](../../Microsoft.PowerShell.Management/New-Item.md) -- [Set-Item](../../Microsoft.PowerShell.Management/Set-Item.md) +- [Set-Item](../../Microsoft.PowerShell.Management/Set-Item.md) ## See also - [about_Functions](../About/about_Functions.md) + [about_Functions](../About/about_Functions.md) [about_Providers](../About/about_Providers.md) diff --git a/reference/6/Microsoft.PowerShell.Core/Providers/Variable-Provider.md b/reference/6/Microsoft.PowerShell.Core/Providers/Variable-Provider.md index 5def5c3f3a32..54fee4a291cf 100644 --- a/reference/6/Microsoft.PowerShell.Core/Providers/Variable-Provider.md +++ b/reference/6/Microsoft.PowerShell.Core/Providers/Variable-Provider.md @@ -13,51 +13,49 @@ online version: http://go.microsoft.com/fwlink/?LinkId=834963 ## Provider name - Variable + Variable ## Drives - `Variable:` + `Variable:` ## Short description - Provides access to the Windows PowerShell variables and to their values. + Provides access to the Windows PowerShell variables and to their values. ## Detailed description - The Windows PowerShell **Variable** provider lets you get, add, change, clear, and delete Windows PowerShell variables in the current console. + The Windows PowerShell **Variable** provider lets you get, add, change, clear, and delete Windows PowerShell variables in the current console. - The Windows PowerShell **Variable** provider supports the variables that Windows PowerShell creates, including the automatic variables, the preference variables, and the variables that you create. + The Windows PowerShell **Variable** provider supports the variables that Windows PowerShell creates, including the automatic variables, the preference variables, and the variables that you create. - The **Variable** provider is a flat namespace that contains only the variable objects. The variables have no child items. + The **Variable** provider is a flat namespace that contains only the variable objects. The variables have no child items. - Most of the variables are instances of the [System.Management.Automation.PSVariable](https://msdn.microsoft.com/library/system.management.automation.psvariable) class. However, there are some variations. For example, the `?` variable is a member of the `QuestionMarkVariable` internal class, and the `MaximumVariableCount` variable is a member of the `SessionStateCapacityVariable` internal class. + Most of the variables are instances of the [System.Management.Automation.PSVariable](https://msdn.microsoft.com/library/system.management.automation.psvariable) class. However, there are some variations. For example, the `?` variable is a member of the `QuestionMarkVariable` internal class, and the `MaximumVariableCount` variable is a member of the `SessionStateCapacityVariable` internal class. - The **Variable** provider exposes its data store in the `Variable:` drive. To work with variables, you can change your location to the `Variable:` drive (`set-location Variable:`), or you can work from any other Windows PowerShell drive. To reference a variable from another location, use the drive name (`Variable:`) in the path. + The **Variable** provider exposes its data store in the `Variable:` drive. To work with variables, you can change your location to the `Variable:` drive (`set-location Variable:`), or you can work from any other Windows PowerShell drive. To reference a variable from another location, use the drive name (`Variable:`) in the path. - Windows PowerShell includes a set of cmdlets designed especially to view and to change variables: + Windows PowerShell includes a set of cmdlets designed especially to view and to change variables: - - [Get-Variable](../../Microsoft.PowerShell.Utility/Get-Variable.md) - - [New-Variable](../../Microsoft.PowerShell.Utility/New-Variable.md) - - [Set-Variable](../../Microsoft.PowerShell.Utility/Set-Variable.md) - - [Remove-Variable](../../Microsoft.PowerShell.Utility/Remove-Variable.md) - - [Clear-Variable](../../Microsoft.PowerShell.Utility/Clear-Variable.md) + - [Get-Variable](../../Microsoft.PowerShell.Utility/Get-Variable.md) + - [New-Variable](../../Microsoft.PowerShell.Utility/New-Variable.md) + - [Set-Variable](../../Microsoft.PowerShell.Utility/Set-Variable.md) + - [Remove-Variable](../../Microsoft.PowerShell.Utility/Remove-Variable.md) + - [Clear-Variable](../../Microsoft.PowerShell.Utility/Clear-Variable.md) - When you use these cmdlets, you do not need to specify the `Variable:` drive in the name. + When you use these cmdlets, you do not need to specify the `Variable:` drive in the name. - The **Variable** provider supports all of the cmdlets whose names contain the *Item* noun (the `*-Item` cmdlets), except for [Invoke-Item](../../Microsoft.PowerShell.Management/Invoke-Item.md). The **Variable** provider supports the [Get-Content](../../Microsoft.PowerShell.Management/Get-Content.md) and [Set-Content](../../Microsoft.PowerShell.Management/Set-Content.md) cmdlets. However, it does not support the cmdlets whose names contain the *ItemProperty* noun (the `*-ItemProperty` cmdlets), and it does not support the `-Filter` parameter in any cmdlet. + The **Variable** provider supports all of the cmdlets whose names contain the *Item* noun (the `*-Item` cmdlets), except for [Invoke-Item](../../Microsoft.PowerShell.Management/Invoke-Item.md). The **Variable** provider supports the [Get-Content](../../Microsoft.PowerShell.Management/Get-Content.md) and [Set-Content](../../Microsoft.PowerShell.Management/Set-Content.md) cmdlets. However, it does not support the cmdlets whose names contain the *ItemProperty* noun (the `*-ItemProperty` cmdlets), and it does not support the `-Filter` parameter in any cmdlet. - You can also use the Windows PowerShell expression parser to create, view, and change the values of variables without using the cmdlets. When working with variables directly, use a dollar sign (`$`) to identify the name as a variable and the assignment operator (`=`) to establish and change its value. For example, `$p = Get-Process` creates the `p` variable and stores the results of a `Get-Process` command in it. - - All changes to the variables affect the current session only. To save the changes, add the changes to the Windows PowerShell profile, or use [Export-Console](there-should-be-an-external-link) to save the current console. + You can also use the Windows PowerShell expression parser to create, view, and change the values of variables without using the cmdlets. When working with variables directly, use a dollar sign (`$`) to identify the name as a variable and the assignment operator (`=`) to establish and change its value. For example, `$p = Get-Process` creates the `p` variable and stores the results of a `Get-Process` command in it. ## Capabilities - ShouldProcess + ShouldProcess ## Examples @@ -68,7 +66,7 @@ online version: http://go.microsoft.com/fwlink/?LinkId=834963 #### Example 1 - This command changes the current location to the `Variable:` drive. You can use this command from any drive in Windows PowerShell. To return to a file system drive, type the drive name. For example, type `set-location c:`. + This command changes the current location to the `Variable:` drive. You can use this command from any drive in Windows PowerShell. To return to a file system drive, type the drive name. For example, type `set-location c:`. ```powershell Set-Location Variable: @@ -80,7 +78,7 @@ Set-Location Variable: #### Example 1 - This command gets the list of all the variables and their values in the current session. You can use this command from any Windows PowerShell drive. + This command gets the list of all the variables and their values in the current session. You can use this command from any Windows PowerShell drive. ```powershell Get-ChildItem -Path Variable: @@ -89,20 +87,20 @@ Get-ChildItem -Path Variable: #### Example 2 - This command gets the variables with names that begin with "max". You can use this command from any Windows PowerShell drive. + This command gets the variables with names that begin with "max". You can use this command from any Windows PowerShell drive. ```powershell Get-ChildItem -Path Variable:max* ``` - If you are in the `Variable:` drive, you can omit the drive name from the path. + If you are in the `Variable:` drive, you can omit the drive name from the path. #### Example 3 - This command gets the value of the `WhatIfPreference` variable by typing it at the command line. + This command gets the value of the `WhatIfPreference` variable by typing it at the command line. - The name of the variable is preceded by a dollar sign (`$`) to indicate that it is a variable. The `Variable:` drive name is not specified. + The name of the variable is preceded by a dollar sign (`$`) to indicate that it is a variable. The `Variable:` drive name is not specified. ```powershell $WhatIfPreference @@ -111,18 +109,18 @@ $WhatIfPreference #### Example 4 - This command uses the `-LiteralPath` parameter of [Get-ChildItem](../../Microsoft.PowerShell.Management/Get-ChildItem.md) to get the value of the `?` variable from within the `Variable:` drive. [Get-ChildItem](../../Microsoft.PowerShell.Management/Get-ChildItem.md) does not attempt to resolve any wildcards in the values of the `-LiteralPath` parameter. + This command uses the `-LiteralPath` parameter of [Get-ChildItem](../../Microsoft.PowerShell.Management/Get-ChildItem.md) to get the value of the `?` variable from within the `Variable:` drive. [Get-ChildItem](../../Microsoft.PowerShell.Management/Get-ChildItem.md) does not attempt to resolve any wildcards in the values of the `-LiteralPath` parameter. ```powershell Get-ChildItem -Literalpath ? ``` - To display the value of a variable with a special character name without a cmdlet, type a dollar sign (`$`) and the variable name. For example, to display the value of the `?` variable, type `$?`. + To display the value of a variable with a special character name without a cmdlet, type a dollar sign (`$`) and the variable name. For example, to display the value of the `?` variable, type `$?`. #### Example 5 - This command gets the variables that have the values of `ReadOnly` or `Constant` for their **Options** property. + This command gets the variables that have the values of `ReadOnly` or `Constant` for their **Options** property. ```powershell Get-ChildItem -Path Variable: | Where-Object {$_.options -Match "Constant" -or $_.options -Match "ReadOnly"} | Format-List -Property name, value, options @@ -134,28 +132,28 @@ Get-ChildItem -Path Variable: | Where-Object {$_.options -Match "Constant" -or $ #### Example 1 - This command creates the `services` variable and stores the results of a [Get-Service](../../Microsoft.PowerShell.Management/Get-Service.md) command in it. Because the current location is in the `Variable:` drive, the value of the `-Path` parameter is a dot (`.`), which represents the current location. + This command creates the `services` variable and stores the results of a [Get-Service](../../Microsoft.PowerShell.Management/Get-Service.md) command in it. Because the current location is in the `Variable:` drive, the value of the `-Path` parameter is a dot (`.`), which represents the current location. - The parentheses around the [Get-Service](../../Microsoft.PowerShell.Management/Get-Service.md) command ensure that the command is executed before the variable is created. Without the parentheses, the value of the new variable is a "Get-Service" string. + The parentheses around the [Get-Service](../../Microsoft.PowerShell.Management/Get-Service.md) command ensure that the command is executed before the variable is created. Without the parentheses, the value of the new variable is a "Get-Service" string. ```powershell New-Item -Path . -Name services -Value (Get-Service) ``` - If you are not in the `Variable:` drive, include the `Variable:` drive name in the path. + If you are not in the `Variable:` drive, include the `Variable:` drive name in the path. #### Example 2 - This command creates a `services` variable and stores the result of a [Get-Service](../../Microsoft.PowerShell.Management/Get-Service.md) command in it. + This command creates a `services` variable and stores the result of a [Get-Service](../../Microsoft.PowerShell.Management/Get-Service.md) command in it. - The command uses a dollar sign (`$`) to indicate a variable and the assignment operator (`=`) to assign the result of the [Get-Service](../../Microsoft.PowerShell.Management/Get-Service.md) command to the newly created variable. + The command uses a dollar sign (`$`) to indicate a variable and the assignment operator (`=`) to assign the result of the [Get-Service](../../Microsoft.PowerShell.Management/Get-Service.md) command to the newly created variable. ```powershell $services = Get-Service ``` - To create a variable without a value, omit the assignment operator. + To create a variable without a value, omit the assignment operator. ### Displaying the properties and methods of variables @@ -163,19 +161,19 @@ $services = Get-Service #### Example 1 - This command uses the Get-Item cmdlet to get all variables. The pipeline operator (`|`) sends the results to the [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md) cmdlet, which displays the methods and properties of the object. + This command uses the Get-Item cmdlet to get all variables. The pipeline operator (`|`) sends the results to the [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md) cmdlet, which displays the methods and properties of the object. ```powershell Get-Item -Path Variable:* | Get-Member ``` - When you pipe a collection of objects (such as the collection of variables in the `Variable:` drive) to [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md), [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md) evaluates each object in the collection separately and returns information about each of the object types that it finds. -To get information about the collection of objects in the `Variable:` drive, use the `-InputObject` parameter of [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md). For example, `Get-Member -InputObject (Get-Item Variable:*)`. When you use `-InputObject`, [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md) evaluates the collection, not the objects in the collection. + When you pipe a collection of objects (such as the collection of variables in the `Variable:` drive) to [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md), [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md) evaluates each object in the collection separately and returns information about each of the object types that it finds. +To get information about the collection of objects in the `Variable:` drive, use the `-InputObject` parameter of [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md). For example, `Get-Member -InputObject (Get-Item Variable:*)`. When you use `-InputObject`, [Get-Member](../../Microsoft.PowerShell.Utility/Get-Member.md) evaluates the collection, not the objects in the collection. #### Example 2 - This command lists the values of the properties of the `home` variable. It uses the [Get-Item](../../Microsoft.PowerShell.Management/Get-Item.md) cmdlet to get an object that represents the `home` variable. The pipeline operator (`|`) sends the results to the [Format-List](../../Microsoft.PowerShell.Utility/Format-List.md) command. The [Format-List](../../Microsoft.PowerShell.Utility/Format-List.md) command uses the `-Property` parameter with a wildcard character (`*`) to format and to display the values of all of the properties of the `home` variable. + This command lists the values of the properties of the `home` variable. It uses the [Get-Item](../../Microsoft.PowerShell.Management/Get-Item.md) cmdlet to get an object that represents the `home` variable. The pipeline operator (`|`) sends the results to the [Format-List](../../Microsoft.PowerShell.Utility/Format-List.md) command. The [Format-List](../../Microsoft.PowerShell.Utility/Format-List.md) command uses the `-Property` parameter with a wildcard character (`*`) to format and to display the values of all of the properties of the `home` variable. ```powershell Get-Item Variable:home | Format-List -Property * @@ -187,7 +185,7 @@ Get-Item Variable:home | Format-List -Property * #### Example 1 - This command uses the [Rename-Item](../../Microsoft.PowerShell.Management/Rename-Item.md) cmdlet to change the name of the `a` variable to `processes`. + This command uses the [Rename-Item](../../Microsoft.PowerShell.Management/Rename-Item.md) cmdlet to change the name of the `a` variable to `processes`. ```powershell Rename-Item -Path Variable:a -NewName processes @@ -196,7 +194,7 @@ Rename-Item -Path Variable:a -NewName processes #### Example 2 - This command uses the [Set-Item](../../Microsoft.PowerShell.Management/Set-Item.md) cmdlet to change the value of the `ErrorActionPreference` variable to "Stop". + This command uses the [Set-Item](../../Microsoft.PowerShell.Management/Set-Item.md) cmdlet to change the value of the `ErrorActionPreference` variable to "Stop". ```powershell Set-Item -Path Variable:ErrorActionPreference -Value Stop @@ -205,9 +203,9 @@ Set-Item -Path Variable:ErrorActionPreference -Value Stop #### Example 3 - This command changes the value of the `ErrorActionPreference` variable to "Stop". + This command changes the value of the `ErrorActionPreference` variable to "Stop". - It uses a dollar sign (`$`) to indicate a variable and the assignment operator (`=`) to assign the value. + It uses a dollar sign (`$`) to indicate a variable and the assignment operator (`=`) to assign the value. ```powershell $ErrorActionPreference = Stop @@ -219,18 +217,18 @@ $ErrorActionPreference = Stop #### Example 1 - This command uses the [Copy-Item](../../Microsoft.PowerShell.Management/Copy-Item.md) cmdlet to copy the `processes` variable to `old_processes`. This creates a new variable named `old_processes` that has the same value as the `processes` variable. + This command uses the [Copy-Item](../../Microsoft.PowerShell.Management/Copy-Item.md) cmdlet to copy the `processes` variable to `old_processes`. This creates a new variable named `old_processes` that has the same value as the `processes` variable. ```powershell Copy-Item -Path Variable:processes -Destination Variable:old_processes ``` - If the command is issued from within the `Variable:` drive, you can omit the drive name from the value of the `-Path` parameter. + If the command is issued from within the `Variable:` drive, you can omit the drive name from the value of the `-Path` parameter. #### Example 2 - This command copies the `processes` variable to `old_processes` without using a cmdlet. It uses the dollar sign (`$`) to indicate variables and the assignment operator to assign the value of `$processes` to `old_processes`. + This command copies the `processes` variable to `old_processes` without using a cmdlet. It uses the dollar sign (`$`) to indicate variables and the assignment operator to assign the value of `$processes` to `old_processes`. ```powershell $old_processes = $processes @@ -242,7 +240,7 @@ $old_processes = $processes #### Example 1 - This command deletes the `serv` variable from the current session. You can use this command in any Windows PowerShell drive. + This command deletes the `serv` variable from the current session. You can use this command in any Windows PowerShell drive. ```powershell Remove-Variable -Path Variable:serv @@ -251,7 +249,7 @@ Remove-Variable -Path Variable:serv #### Example 2 - This command deletes all variables from the current session except for the variables whose **Options** property has a value of `Constant`. Without the `-Force` parameter, the command does not delete variables whose **Options** property has a value of `ReadOnly`. + This command deletes all variables from the current session except for the variables whose **Options** property has a value of `Constant`. Without the `-Force` parameter, the command does not delete variables whose **Options** property has a value of `ReadOnly`. ```powershell Remove-Item Variable:* -Force @@ -263,7 +261,7 @@ Remove-Item Variable:* -Force #### Example 1 - This command uses the [Clear-Item](../../Microsoft.PowerShell.Management/Clear-Item.md) cmdlet to change the value of the `processes` variable to NULL. + This command uses the [Clear-Item](../../Microsoft.PowerShell.Management/Clear-Item.md) cmdlet to change the value of the `processes` variable to NULL. ```powershell Clear-Item -Path Variable:processes @@ -272,7 +270,7 @@ Clear-Item -Path Variable:processes #### Example 2 - This command clears the value of the `processes` variable by assigning a null value to it. It uses the `$null` automatic variable to represent the NULL value. + This command clears the value of the `processes` variable by assigning a null value to it. It uses the `$null` automatic variable to represent the NULL value. ```powershell $processes = $null @@ -281,7 +279,7 @@ $processes = $null ## See also - [about_Variables](../About/about_Variables.md) - [about_Automatic_Variables](../About/about_Automatic_Variables.md) + [about_Variables](../About/about_Variables.md) + [about_Automatic_Variables](../About/about_Automatic_Variables.md) [about_Providers](../About/about_Providers.md) diff --git a/reference/docs-conceptual/getting-started/fundamental/Windows-PowerShell-Integrated-Scripting-Environment--ISE-.md b/reference/docs-conceptual/getting-started/fundamental/Windows-PowerShell-Integrated-Scripting-Environment--ISE-.md index e93fab433ffe..fa8a43a45ed6 100644 --- a/reference/docs-conceptual/getting-started/fundamental/Windows-PowerShell-Integrated-Scripting-Environment--ISE-.md +++ b/reference/docs-conceptual/getting-started/fundamental/Windows-PowerShell-Integrated-Scripting-Environment--ISE-.md @@ -63,5 +63,5 @@ Note that any entries labelled "Preview" are pre-release code and are not featur > Because Windows PowerShell ISE requires a graphical user interface, you can’t run it on the Server Core option of Windows Server. ## See also -- [Using the Windows PowerShell Integrated Scripting Environment](Using-the-Windows-PowerShell-ISE.md) +- [Using the Windows PowerShell Integrated Scripting Environment](../../core-powershell/ise/Using-the-Windows-PowerShell-ISE.md) From 22b50ea6f155eff696fd37c783f3565f4f35137d Mon Sep 17 00:00:00 2001 From: Sean Wheeler Date: Fri, 12 Jan 2018 11:18:06 -0800 Subject: [PATCH 2/4] clean up moniker mapping and add image types to config --- reference/docfx.json | 321 ++++---------------------- reference/mapping/monikerMapping.json | 21 +- 2 files changed, 50 insertions(+), 292 deletions(-) diff --git a/reference/docfx.json b/reference/docfx.json index 04bbc9671568..abe02ab6866c 100644 --- a/reference/docfx.json +++ b/reference/docfx.json @@ -1,289 +1,50 @@ { "build": { - "content": [{ - "files": [ - "bread-pscore/toc.yml" - ] - }, - { - "files": [ - "toc.yml" - ], - "src": "docs-conceptual", - "version": "powershell-3.0", - "dest": "scripting/powershell-3.0" - }, - { - "files": [ - "**/*.md" - ], - "src": "docs-conceptual", - "version": "powershell-3.0", - "dest": "scripting" - }, - { - "files": [ - "toc.yml" - ], - "src": "3.0", - "version": "powershell-3.0", - "dest": "module/psdocs" - }, - { - "files": [ - "**/*.md" - ], - "src": "3.0", - "version": "powershell-3.0", - "exclude": [ - "docs-conceptual/**" - ], - "dest": "module" - }, - { - "files": [ - "toc.yml" - ], - "src": "docs-conceptual", - "version": "powershell-4.0", - "dest": "scripting/powershell-4.0" - }, - { - "files": [ - "**/*.md" - ], - "src": "docs-conceptual", - "version": "powershell-4.0", - "dest": "scripting" - }, - { - "files": [ - "toc.yml" - ], - "src": "4.0", - "version": "powershell-4.0", - "dest": "module/psdocs" - }, - { - "files": [ - "**/*.md" - ], - "src": "4.0", - "version": "powershell-4.0", - "exclude": [ - "docs-conceptual/**" - ], - "dest": "module" - }, - { - "files": [ - "toc.yml" - ], - "src": "docs-conceptual", - "version": "powershell-5.0", - "dest": "scripting/powershell-5.0" - }, - { - "files": [ - "**/*.md" - ], - "src": "docs-conceptual", - "version": "powershell-5.0", - "dest": "scripting" - }, - { - "files": [ - "toc.yml" - ], - "src": "5.0", - "version": "powershell-5.0", - "dest": "module/psdocs" - }, - { - "files": [ - "**/*.md" - ], - "src": "5.0", - "version": "powershell-5.0", - "exclude": [ - "docs-conceptual/**" - ], - "dest": "module" - }, - { - "files": [ - "toc.yml" - ], - "src": "docs-conceptual", - "version": "powershell-5.1", - "dest": "scripting/powershell-5.1" - }, - { - "files": [ - "**/*.md" - ], - "src": "docs-conceptual", - "version": "powershell-5.1", - "dest": "scripting" - }, - { - "files": [ - "toc.yml" - ], - "src": "5.1", - "version": "powershell-5.1", - "dest": "module/psdocs" - }, - { - "files": [ - "**/*.md" - ], - "src": "5.1", - "version": "powershell-5.1", - "exclude": [ - "docs-conceptual/**" - ], - "dest": "module" - }, - { - "files": [ - "toc.yml" - ], - "src": "docs-conceptual", - "version": "powershell-6", - "dest": "scripting/powershell-6" - }, - { - "files": [ - "**/*.md" - ], - "src": "docs-conceptual", - "version": "powershell-6", - "dest": "scripting" - }, - { - "files": [ - "toc.yml" - ], - "src": "6", - "version": "powershell-6", - "dest": "module/psdocs" - }, - { - "files": [ - "**/*.md" - ], - "src": "6", - "version": "powershell-6", - "exclude": [ - "docs-conceptual/**" - ], - "dest": "module" - }, - { - "files": [ - "**/*.md" - ], - "src": "virtual-directory", - "dest": "scripting" - }, - { - "files": [ - "**/*.md" - ], - "src": "virtual-directory-module", - "dest": "module" - } + "content": [ + { "files": [ "bread-pscore/toc.yml" ] }, + // version 3 definitions + { "files": [ "toc.yml" ], "src": "docs-conceptual", "version": "powershell-3.0", "dest": "scripting/powershell-3.0" }, + { "files": [ "**/*.md" ], "src": "docs-conceptual", "version": "powershell-3.0", "dest": "scripting" }, + { "files": [ "toc.yml" ], "src": "3.0", "version": "powershell-3.0", "dest": "module/psdocs" }, + { "files": [ "**/*.md" ], "src": "3.0", "version": "powershell-3.0", "exclude": [ "docs-conceptual/**" ], "dest": "module" }, + // version 4 definitions + { "files": [ "toc.yml" ], "src": "docs-conceptual", "version": "powershell-4.0", "dest": "scripting/powershell-4.0" }, + { "files": [ "**/*.md" ], "src": "docs-conceptual", "version": "powershell-4.0", "dest": "scripting" }, + { "files": [ "toc.yml" ], "src": "4.0", "version": "powershell-4.0", "dest": "module/psdocs" }, + { "files": [ "**/*.md" ], "src": "4.0", "version": "powershell-4.0", "exclude": [ "docs-conceptual/**" ], "dest": "module" }, + // version 5 definitions + { "files": [ "toc.yml" ], "src": "docs-conceptual", "version": "powershell-5.0", "dest": "scripting/powershell-5.0" }, + { "files": [ "**/*.md" ], "src": "docs-conceptual", "version": "powershell-5.0", "dest": "scripting" }, + { "files": [ "toc.yml" ], "src": "5.0", "version": "powershell-5.0", "dest": "module/psdocs" }, + { "files": [ "**/*.md" ], "src": "5.0", "version": "powershell-5.0", "exclude": [ "docs-conceptual/**" ], "dest": "module" }, + // version 5.1 definitions + { "files": [ "toc.yml" ], "src": "docs-conceptual", "version": "powershell-5.1", "dest": "scripting/powershell-5.1" }, + { "files": [ "**/*.md" ], "src": "docs-conceptual", "version": "powershell-5.1", "dest": "scripting" }, + { "files": [ "toc.yml" ], "src": "5.1", "version": "powershell-5.1", "dest": "module/psdocs" }, + { "files": [ "**/*.md" ], "src": "5.1", "version": "powershell-5.1", "exclude": [ "docs-conceptual/**" ], "dest": "module" }, + // version 6 definitions + { "files": [ "toc.yml" ], "src": "docs-conceptual", "version": "powershell-6", "dest": "scripting/powershell-6" }, + { "files": [ "**/*.md" ], "src": "docs-conceptual", "version": "powershell-6", "dest": "scripting" }, + { "files": [ "toc.yml" ], "src": "6", "version": "powershell-6", "dest": "module/psdocs" }, + { "files": [ "**/*.md" ], "src": "6", "version": "powershell-6", "exclude": [ "docs-conceptual/**" ], "dest": "module" }, + // virtual folder definitions + { "files": [ "**/*.md" ], "src": "virtual-directory", "dest": "scripting" }, + { "files": [ "**/*.md" ], "src": "virtual-directory-module", "dest": "module" } ], "resource": [ - { - "files": [ - "**/images/**", - "**/*.png", - "**/*.jpg" - ], - "exclude": [ - "**/obj/**", - "**/includes/**" - ] - }, - { - "files": [ - "**/images/**", - "**/*.png", - "**/*.jpg" - ], - "exclude": [ - "**/obj/**", - "**/includes/**" - ], - "version": "powershell-3.0" - }, - { - "files": [ - "**/images/**", - "**/*.png", - "**/*.jpg" - ], - "exclude": [ - "**/obj/**", - "**/includes/**" - ], - "version": "powershell-4.0" - }, - { - "files": [ - "**/images/**", - "**/*.png", - "**/*.jpg" - ], - "exclude": [ - "**/obj/**", - "**/includes/**" - ], - "version": "powershell-5.0" - }, - { - "files": [ - "**/images/**", - "**/*.png", - "**/*.jpg" - ], - "exclude": [ - "**/obj/**", - "**/includes/**" - ], - "version": "powershell-5.1" - }, - { - "files": [ - "**/images/**", - "**/*.png", - "**/*.jpg" - ], - "exclude": [ - "**/obj/**", - "**/includes/**" - ], - "version": "powershell-6" - } + { "files": [ "**/images/**", "**/*.png", "**/*.gif", "**/*.jpeg", "**/*.jpg", "**/*.svg" ], "exclude": [ "**/obj/**", "**/includes/**" ] }, + { "files": [ "**/images/**", "**/*.png", "**/*.gif", "**/*.jpeg", "**/*.jpg", "**/*.svg" ], "exclude": [ "**/obj/**", "**/includes/**" ], "version": "powershell-3.0" }, + { "files": [ "**/images/**", "**/*.png", "**/*.gif", "**/*.jpeg", "**/*.jpg", "**/*.svg" ], "exclude": [ "**/obj/**", "**/includes/**" ], "version": "powershell-4.0" }, + { "files": [ "**/images/**", "**/*.png", "**/*.gif", "**/*.jpeg", "**/*.jpg", "**/*.svg" ], "exclude": [ "**/obj/**", "**/includes/**" ], "version": "powershell-5.0" }, + { "files": [ "**/images/**", "**/*.png", "**/*.gif", "**/*.jpeg", "**/*.jpg", "**/*.svg" ], "exclude": [ "**/obj/**", "**/includes/**" ], "version": "powershell-5.1" }, + { "files": [ "**/images/**", "**/*.png", "**/*.gif", "**/*.jpeg", "**/*.jpg", "**/*.svg" ], "exclude": [ "**/obj/**", "**/includes/**" ], "version": "powershell-6" } ], "versions": { - "powershell-3.0": { - "dest": "powershell-3.0" - }, - "powershell-4.0": { - "dest": "powershell-4.0" - }, - "powershell-5.0": { - "dest": "powershell-5.0" - }, - "powershell-5.1": { - "dest": "powershell-5.1" - }, - "powershell-6": { - "dest": "powershell-6" - } + "powershell-3.0": { "dest": "powershell-3.0" }, + "powershell-4.0": { "dest": "powershell-4.0" }, + "powershell-5.0": { "dest": "powershell-5.0" }, + "powershell-5.1": { "dest": "powershell-5.1" }, + "powershell-6": { "dest": "powershell-6" } }, "overwrite": [], "externalReference": [], diff --git a/reference/mapping/monikerMapping.json b/reference/mapping/monikerMapping.json index c188d50d7bc5..7e92667dc05f 100644 --- a/reference/mapping/monikerMapping.json +++ b/reference/mapping/monikerMapping.json @@ -54,13 +54,13 @@ "Microsoft.PowerShell.Security":{}, "Microsoft.PowerShell.Utility":{}, "Microsoft.WsMan.Management":{}, + "PackageManagement":{}, + "PowershellGet":{}, "PSDesiredStateConfiguration":{}, "PSReadline":{}, "PSScheduledJob":{}, "PSWorkflow":{}, - "PSWorkflowUtility":{}, - "PackageManagement":{}, - "PowershellGet":{} + "PSWorkflowUtility":{} } }, "powershell-5.1": { @@ -81,13 +81,13 @@ "Microsoft.PowerShell.Security":{}, "Microsoft.PowerShell.Utility":{}, "Microsoft.WsMan.Management":{}, + "PackageManagement":{}, + "PowershellGet":{}, "PSDesiredStateConfiguration":{}, "PSReadline":{}, "PSScheduledJob":{}, "PSWorkflow":{}, - "PSWorkflowUtility":{}, - "PackageManagement":{}, - "PowershellGet":{} + "PSWorkflowUtility":{} } }, "powershell-6": { @@ -101,18 +101,15 @@ "Microsoft.PowerShell.Core": {}, "Microsoft.PowerShell.Diagnostics":{}, "Microsoft.PowerShell.Host":{}, - "Microsoft.PowerShell.LocalAccounts":{}, "Microsoft.PowerShell.Management":{}, "Microsoft.PowerShell.Security":{}, "Microsoft.PowerShell.Utility":{}, "Microsoft.WSMan.Management":{}, + "PackageManagement":{}, + "PowerShellGet":{}, "PSDesiredStateConfiguration":{}, "PSDiagnostics":{}, - "PSReadLine":{}, - "PackageManagement":{}, - "Pester":{}, - "PowerShellGet":{} - + "PSReadLine":{} } } } From 102d3fb1cbe5db4e5d3620b715a5f59c641b0d15 Mon Sep 17 00:00:00 2001 From: Sean Wheeler Date: Fri, 12 Jan 2018 12:37:58 -0800 Subject: [PATCH 3/4] removing unneeded index pages --- .openpublishing.redirection.json | 15 ++++++++ .../core-powershell/console-guide.md | 12 ------- .../core-powershell/ise-guide.md | 36 ------------------- .../understanding-concepts-reference.md | 25 ------------- reference/docs-conceptual/toc.yml | 6 ---- 5 files changed, 15 insertions(+), 79 deletions(-) delete mode 100644 reference/docs-conceptual/core-powershell/console-guide.md delete mode 100644 reference/docs-conceptual/core-powershell/ise-guide.md delete mode 100644 reference/docs-conceptual/getting-started/understanding-concepts-reference.md diff --git a/.openpublishing.redirection.json b/.openpublishing.redirection.json index daed14f40454..dfd5a347b34e 100644 --- a/.openpublishing.redirection.json +++ b/.openpublishing.redirection.json @@ -15,6 +15,21 @@ "redirect_url": "/powershell/wmf/readme", "redirect_document_id": "False" }, + { + "source_path": "reference/docs-conceptual/core-powershell/console-guide.md", + "redirect_url": "/powershell/scripting/core-powershell/console/powershell.exe-command-line-help", + "redirect_document_id": "False" + }, + { + "source_path": "reference/docs-conceptual/core-powershell/ise-guide.md", + "redirect_url": "/powershell/scripting/core-powershell/ise/introducing-the-windows-powershell-ise", + "redirect_document_id": "False" + }, + { + "source_path": "reference/docs-conceptual/getting-started/understanding-concepts-reference.md", + "redirect_url": "/powershell/scripting/getting-started/fundamental/about-windows-powershell", + "redirect_document_id": "False" + }, { "source_path": "reference/virtual-directory/index.md", "redirect_url": "/powershell/scripting/powershell-scripting", diff --git a/reference/docs-conceptual/core-powershell/console-guide.md b/reference/docs-conceptual/core-powershell/console-guide.md deleted file mode 100644 index 14ce91ffdc25..000000000000 --- a/reference/docs-conceptual/core-powershell/console-guide.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -ms.date: 2017-06-05 -keywords: powershell,cmdlet -title: console guide ---- - -# PowerShell Console Window Guide - -Find in this guide: -- [PowerShell.exe Command Line Help](console/PowerShell.exe-Command-Line-Help.md) -- [Using Tab Expansion](console/Using-Tab-Expansion.md) - diff --git a/reference/docs-conceptual/core-powershell/ise-guide.md b/reference/docs-conceptual/core-powershell/ise-guide.md deleted file mode 100644 index 4356c2494e82..000000000000 --- a/reference/docs-conceptual/core-powershell/ise-guide.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -ms.date: 2017-06-05 -keywords: powershell,cmdlet -title: ise guide ---- - -# ISE Guide - -- [How to Create a PowerShell Tab in Windows PowerShell ISE](ise/How-to-Create-a-PowerShell-Tab-in-Windows-PowerShell-ISE.md) -- [How to Debug Scripts in Windows PowerShell ISE](ise/How-to-Debug-Scripts-in-Windows-PowerShell-ISE.md) -- [How to Use Profiles in Windows PowerShell ISE](ise/How-to-Use-Profiles-in-Windows-PowerShell-ISE.md) -- [How to Use Tab Completion in the Script Pane and Console Pane](ise/How-to-Use-Tab-Completion-in-the-Script-Pane-and-Console-Pane.md) -- [How to Use the Console Pane in the Windows PowerShell ISE](ise/How-to-Use-the-Console-Pane-in-the-Windows-PowerShell-ISE.md) -- [How to Write and Run Scripts in the Windows PowerShell ISE](ise/How-to-Write-and-Run-Scripts-in-the-Windows-PowerShell-ISE.md) -- [Introducing the Windows PowerShell ISE](ise/Introducing-the-Windows-PowerShell-ISE.md) -- [ISE Module](ise/ISE-Module.md) -- [Keyboard Shortcuts for the Windows PowerShell ISE](ise/Keyboard-Shortcuts-for-the-Windows-PowerShell-ISE.md) -- [Purpose of the Windows PowerShell ISE Scripting Object Model](ise/Purpose-of-the-Windows-PowerShell-ISE-Scripting-Object-Model.md) -- [The ISE Object Model Hierarchy](ise/The-ISE-Object-Model-Hierarchy.md) -- [The ISEAddOnTool Object](ise/The-ISEAddOnTool-Object.md) -- [The ISEAddOnToolCollection Object](ise/The-ISEAddOnToolCollection-Object.md) -- [The ISEEditor Object](ise/The-ISEEditor-Object.md) -- [The ISEFile Object](ise/The-ISEFile-Object.md) -- [The ISEFileCollection Object](ise/The-ISEFileCollection-Object.md) -- [The ISEMenuItem Object](ise/The-ISEMenuItem-Object.md) -- [The ISEMenuItemCollection Object](ise/The-ISEMenuItemCollection-Object.md) -- [The ISEOptions Object](ise/The-ISEOptions-Object.md) -- [The ISESnippetCollection Object](ise/The-ISESnippetCollection-Object.md) -- [The ISESnippetObject](ise/The-ISESnippetObject.md) -- [The ObjectModelRoot Object](ise/The-ObjectModelRoot-Object.md) -- [The PowerShellTab Object](ise/The-PowerShellTab-Object.md) -- [The PowerShellTabCollection Object](ise/The-PowerShellTabCollection-Object.md) -- [The Windows PowerShell ISE Scripting Object Model](ise/The-Windows-PowerShell-ISE-Scripting-Object-Model.md) -- [Using the Windows PowerShell ISE](ise/Using-the-Windows-PowerShell-ISE.md) -- [Windows PowerShell ISE Object Model Reference](ise/Windows-PowerShell-ISE-Object-Model-Reference.md) - diff --git a/reference/docs-conceptual/getting-started/understanding-concepts-reference.md b/reference/docs-conceptual/getting-started/understanding-concepts-reference.md deleted file mode 100644 index 75f3180da47b..000000000000 --- a/reference/docs-conceptual/getting-started/understanding-concepts-reference.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -ms.date: 2017-06-05 -keywords: powershell,cmdlet -title: understanding concepts reference ---- - -# Understanding Concepts - -* Objects in PowerShell -* [The Pipeline](./fundamental/understanding-the-windows-powershell-pipeline.md) -* Command Parsing -* Evaluating expressions -* Quoting and Escaping -* Operators -* [Variables and assignment](./fundamental/using-variables-to-store-objects.md) -* Command or cmdlet execution -* Native apps execution and parameter passing -* [Implicit and explicit output formatting](./cookbooks/using-format-commands-to-change-output-view.md) -* Developing a Formatting File -* Scripting language elements -* Integration with OS and Services -* Providers -* Drivers -* [Updating help](/powershell/module/Microsoft.PowerShell.Core/Update-Help) - diff --git a/reference/docs-conceptual/toc.yml b/reference/docs-conceptual/toc.yml index ef6d0676491c..95cefcc2907e 100644 --- a/reference/docs-conceptual/toc.yml +++ b/reference/docs-conceptual/toc.yml @@ -11,8 +11,6 @@ href: core-powershell/console/powershell.exe-command-line-help.md - name: Using Tab Expansion href: core-powershell/console/using-tab-expansion.md - - name: Console Guide - href: core-powershell/console-guide.md - name: ISE href: core-powershell/ise/introducing-the-windows-powershell-ise.md items: @@ -70,8 +68,6 @@ href: core-powershell/ise/using-the-windows-powershell-ise.md - name: Windows PowerShell ISE Object Model Reference href: core-powershell/ise/windows-powershell-ise-object-model-reference.md - - name: ISE Guide - href: core-powershell/ise-guide.md - name: Visual Studio Code items: - name: Using Visual Studio Code @@ -211,8 +207,6 @@ href: getting-started/getting-started-with-windows-powershell.md - name: More PowerShell learning href: getting-started/more-powershell-learning.md - - name: Understanding concepts reference - href: getting-started/understanding-concepts-reference.md - name: Setup href: '' items: From c9469f78654453f66279258bbaf3a5c2df9f800e Mon Sep 17 00:00:00 2001 From: Sean Wheeler Date: Fri, 12 Jan 2018 12:53:57 -0800 Subject: [PATCH 4/4] fixing typos --- dsc/configDataCredentials.md | 4 ++-- reference/docfx.json | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dsc/configDataCredentials.md b/dsc/configDataCredentials.md index b0fc60dbad4b..4a998aa4eca8 100644 --- a/dsc/configDataCredentials.md +++ b/dsc/configDataCredentials.md @@ -283,8 +283,8 @@ DomainCredentialExample -DomainCredential $cred -ConfigurationData $cd > [!NOTE] > `NodeName` cannot equal asterisk, a specific node name is mandatory. -**Microsoft advises to avoid plain text passwords -due to the significant security risk.** +**Microsoft advises to avoid plain text passwords due to the significant security risk.** + An exception would be when using the Azure Automation DSC service, only because the data is always stored encrypted (in transit, at rest in the service, and at rest on the node). diff --git a/reference/docfx.json b/reference/docfx.json index abe02ab6866c..ffb21c5245ab 100644 --- a/reference/docfx.json +++ b/reference/docfx.json @@ -2,32 +2,32 @@ "build": { "content": [ { "files": [ "bread-pscore/toc.yml" ] }, - // version 3 definitions + { "files": [ "toc.yml" ], "src": "docs-conceptual", "version": "powershell-3.0", "dest": "scripting/powershell-3.0" }, { "files": [ "**/*.md" ], "src": "docs-conceptual", "version": "powershell-3.0", "dest": "scripting" }, { "files": [ "toc.yml" ], "src": "3.0", "version": "powershell-3.0", "dest": "module/psdocs" }, { "files": [ "**/*.md" ], "src": "3.0", "version": "powershell-3.0", "exclude": [ "docs-conceptual/**" ], "dest": "module" }, - // version 4 definitions + { "files": [ "toc.yml" ], "src": "docs-conceptual", "version": "powershell-4.0", "dest": "scripting/powershell-4.0" }, { "files": [ "**/*.md" ], "src": "docs-conceptual", "version": "powershell-4.0", "dest": "scripting" }, { "files": [ "toc.yml" ], "src": "4.0", "version": "powershell-4.0", "dest": "module/psdocs" }, { "files": [ "**/*.md" ], "src": "4.0", "version": "powershell-4.0", "exclude": [ "docs-conceptual/**" ], "dest": "module" }, - // version 5 definitions + { "files": [ "toc.yml" ], "src": "docs-conceptual", "version": "powershell-5.0", "dest": "scripting/powershell-5.0" }, { "files": [ "**/*.md" ], "src": "docs-conceptual", "version": "powershell-5.0", "dest": "scripting" }, { "files": [ "toc.yml" ], "src": "5.0", "version": "powershell-5.0", "dest": "module/psdocs" }, { "files": [ "**/*.md" ], "src": "5.0", "version": "powershell-5.0", "exclude": [ "docs-conceptual/**" ], "dest": "module" }, - // version 5.1 definitions + { "files": [ "toc.yml" ], "src": "docs-conceptual", "version": "powershell-5.1", "dest": "scripting/powershell-5.1" }, { "files": [ "**/*.md" ], "src": "docs-conceptual", "version": "powershell-5.1", "dest": "scripting" }, { "files": [ "toc.yml" ], "src": "5.1", "version": "powershell-5.1", "dest": "module/psdocs" }, { "files": [ "**/*.md" ], "src": "5.1", "version": "powershell-5.1", "exclude": [ "docs-conceptual/**" ], "dest": "module" }, - // version 6 definitions + { "files": [ "toc.yml" ], "src": "docs-conceptual", "version": "powershell-6", "dest": "scripting/powershell-6" }, { "files": [ "**/*.md" ], "src": "docs-conceptual", "version": "powershell-6", "dest": "scripting" }, { "files": [ "toc.yml" ], "src": "6", "version": "powershell-6", "dest": "module/psdocs" }, { "files": [ "**/*.md" ], "src": "6", "version": "powershell-6", "exclude": [ "docs-conceptual/**" ], "dest": "module" }, - // virtual folder definitions + { "files": [ "**/*.md" ], "src": "virtual-directory", "dest": "scripting" }, { "files": [ "**/*.md" ], "src": "virtual-directory-module", "dest": "module" } ],