diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Environment_Variables.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Environment_Variables.md index 03604c7c68e5..9bb7b138c7fe 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Environment_Variables.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Environment_Variables.md @@ -1,7 +1,7 @@ --- description: Describes how to access and manage environment variables in PowerShell. Locale: en-US -ms.date: 07/17/2023 +ms.date: 09/20/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Environment Variables @@ -192,6 +192,12 @@ VERBOSE: Performing the operation "Remove Item" on target "Item: Foo2". VERBOSE: Performing the operation "Remove Item" on target "Item: Foo". ``` +Use the `Get-ChildItem` cmdlet to see a full list of environment variables: + +```powershell +Get-ChildItem Env: +``` + For more information on using the **Environment** provider to manage environment variables, see [about_Environment_Provider][04]. diff --git a/reference/5.1/Microsoft.PowerShell.Host/Start-Transcript.md b/reference/5.1/Microsoft.PowerShell.Host/Start-Transcript.md index c6af60f01c7f..48a53cd2c989 100644 --- a/reference/5.1/Microsoft.PowerShell.Host/Start-Transcript.md +++ b/reference/5.1/Microsoft.PowerShell.Host/Start-Transcript.md @@ -72,6 +72,28 @@ This command starts a transcript in the `Transcript0.txt` file in `C:\transcript **NoClobber** parameter is used, the command prevents any existing files from being overwritten. If the `Transcript0.txt` file already exists, the command fails. +### Example 3: Start a transcript file with a unique name and store it on a file share + +The following example creates a transcript file with a name unique enough to be stored on in a +shared location. The filename is constructed from the user's name, the hostname of the computer +running PowerShell, the version of PowerShell, and the date and time. The transcript is stored in +the `\\Server01\Transcripts` file share. + +```powershell +$sharepath = '\\Server01\Transcripts' +$username = $env:USERNAME +$hostname = hostname +$version = $PSVersionTable.PSVersion.ToString() +$datetime = Get-Date -f 'yyyyMMddHHmmss' +$filename = "Transcript-${username}-${hostname}-${version}-${datetime}.txt" +$Transcript = Join-Path -Path $sharepath -ChildPath $filename +Start-Transcript +``` + +The full path to the transcript file is stored in the `$Transcript` preference variable. For more +information about the `$Transcript` preference variable, see +[about_Preference_Variables](../Microsoft.PowerShell.Core/About/about_Preference_Variables.md#transcript). + ## PARAMETERS ### -Append @@ -94,7 +116,7 @@ Accept wildcard characters: False ### -Force Allows the cmdlet to append the transcript to an existing read-only file. When used on a read-only -file, the cmdlet changes the file permission to read-write. The cmdlet cannot override security +file, the cmdlet changes the file permission to read-write. The cmdlet can't override security restrictions when this parameter is used. ```yaml @@ -128,9 +150,9 @@ Accept wildcard characters: False ### -LiteralPath Specifies a location to the transcript file. Unlike the **Path** parameter, the value of the -**LiteralPath** parameter is used exactly as it is typed. No characters are interpreted as -wildcards. If the path includes escape characters, enclose it in single quotation marks. Single -quotation marks inform PowerShell not to interpret any characters as escape sequences. +**LiteralPath** parameter is used exactly as it's typed. No characters are interpreted as wildcards. +If the path includes escape characters, enclose it in single quotation marks. Single quotation marks +inform PowerShell not to interpret any characters as escape sequences. ```yaml Type: System.String @@ -146,7 +168,7 @@ Accept wildcard characters: False ### -NoClobber -Indicates that this cmdlet does not overwrite an existing file. By default, if a transcript file +Indicates that this cmdlet doesn't overwrite an existing file. By default, if a transcript file exists in the specified path, `Start-Transcript` overwrites the file without warning. ```yaml @@ -180,14 +202,14 @@ Accept wildcard characters: False ### -Path -Specifies a location to the transcript file. Enter a path to a `.txt` file. Wildcards are not +Specifies a location to the transcript file. Enter a path to a `.txt` file. Wildcards aren't permitted. -If you do not specify a path, `Start-Transcript` uses the path in the value of the `$Transcript` -global variable. If you have not created this variable, `Start-Transcript` stores the transcripts in +If you don't specify a path, `Start-Transcript` uses the path in the value of the `$Transcript` +global variable. If you haven't created this variable, `Start-Transcript` stores the transcripts in the `$HOME\My Documents directory as \PowerShell_transcript..txt` files. -If any of the directories in the path do not exist, the command fails. +If any of the directories in the path don't exist, the command fails. ```yaml Type: System.String @@ -220,7 +242,7 @@ Accept wildcard characters: False ### -WhatIf Shows what would happen if the cmdlet runs. -The cmdlet is not run. +The cmdlet isn't run. ```yaml Type: System.Management.Automation.SwitchParameter @@ -238,7 +260,8 @@ Accept wildcard characters: False This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, --WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). +-WarningAction, and -WarningVariable. For more information, see +[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS @@ -262,3 +285,5 @@ information, see [about_Profiles](../Microsoft.PowerShell.Core/About/about_Profi ## RELATED LINKS [Stop-Transcript](Stop-Transcript.md) + +[about_Preference_Variables](../Microsoft.PowerShell.Core/About/about_Preference_Variables.md#transcript) diff --git a/reference/5.1/Microsoft.PowerShell.Management/Set-Service.md b/reference/5.1/Microsoft.PowerShell.Management/Set-Service.md index a973112f3448..7bfb67dd8e35 100644 --- a/reference/5.1/Microsoft.PowerShell.Management/Set-Service.md +++ b/reference/5.1/Microsoft.PowerShell.Management/Set-Service.md @@ -151,6 +151,23 @@ Set-Service -InputObject $S -Status Stopped in the variable, `$S`. `Set-Service` uses the **InputObject** parameter and specifies the object stored `$S`. The **Status** parameter sets the service to **Stopped**. +### Example 7: Set the startup type for multiple services + +The `Set-Service` cmdlet only accepts one service name at a time. However, you can pipe multiple +services to `Set-Service` to change the configuration of multiple services. + +```powershell +Get-Service SQLWriter,spooler | + Set-Service -StartupType Automatic -PassThru | + Select-Object Name, StartType +``` + +```Output +Name StartType +---- --------- +spooler Automatic +SQLWriter Automatic +``` ## PARAMETERS ### -ComputerName @@ -351,7 +368,8 @@ Accept wildcard characters: False This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, --WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). +-WarningAction, and -WarningVariable. For more information, see +[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/reference/5.1/Microsoft.PowerShell.Management/Split-Path.md b/reference/5.1/Microsoft.PowerShell.Management/Split-Path.md index 9d266b58e579..c01f21630586 100644 --- a/reference/5.1/Microsoft.PowerShell.Management/Split-Path.md +++ b/reference/5.1/Microsoft.PowerShell.Management/Split-Path.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Management -ms.date: 07/31/2023 +ms.date: 09/20/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/split-path?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: Split-Path @@ -60,7 +60,7 @@ Split-Path -LiteralPath [-Resolve] [-Credential ] [-Use ## DESCRIPTION The `Split-Path` cmdlet returns only the specified part of a path, such as the parent folder, a -subfolder, or a file name. It can also get items that are referenced by the split path and tell +subfolder, or a filename. It can also get items that are referenced by the split path and tell whether the path is relative or absolute. You can use this cmdlet to get or submit only a selected part of a path. @@ -79,7 +79,7 @@ HKCU: This command returns only the qualifier of the path. The qualifier is the drive. -### Example 2: Display file names +### Example 2: Display filenames ```powershell Split-Path -Path "C:\Test\Logs\*.log" -Leaf -Resolve @@ -92,25 +92,25 @@ Pass2.log ``` This command displays the files that are referenced by the split path. Because this path is split to -the last item, also known as the leaf, the command displays only the file names. +the last item, also known as the leaf, the command displays only the filenames. The **Resolve** parameter tells `Split-Path` to display the items that the split path references, instead of displaying the split path. -Like all `Split-Path` commands, this command returns strings. -It does not return **FileInfo** objects that represent the files. +Like all `Split-Path` commands, this command returns strings. It doesn't return **FileInfo** objects +that represent the files. ### Example 3: Get the parent container ```powershell -Split-Path -Path "C:\WINDOWS\system32\WindowsPowerShell\V1.0\about_*.txt" +Split-Path -Parent "C:\WINDOWS\system32\WindowsPowerShell\V1.0\about_*.txt" ``` ```Output C:\WINDOWS\system32\WindowsPowerShell\V1.0 ``` -This command returns only the parent containers of the path. Because it does not include any +This command returns only the parent containers of the path. Because it doesn't include any parameters to specify the split, `Split-Path` uses the split location default, which is **Parent**. ### Example 4: Determines whether a path is absolute @@ -124,12 +124,12 @@ False ``` This command determines whether the path is relative or absolute. In this case, because the path is -relative to the current folder, which is represented by a dot (`.`), it returns $False. +relative to the current folder, which is represented by a dot (`.`), it returns `$False`. ### Example 5: Change location to a specified path ```powershell -PS C:> Set-Location (Split-Path -Path $profile) +PS C:\> Set-Location (Split-Path -Path $profile) PS C:\Documents and Settings\User01\My Documents\WindowsPowerShell> ``` @@ -140,7 +140,7 @@ built-in `$Profile` variable. The **Parent** parameter is the default split loca Therefore, you can omit it from the command. The parentheses direct PowerShell to run the command first. This is a useful way to move to a folder that has a long path name. -### Example 6: Split a path by using the pipeline +### Example 6: Split a path using the pipeline ```powershell 'C:\Documents and Settings\User01\My Documents\My Pictures' | Split-Path @@ -150,17 +150,17 @@ first. This is a useful way to move to a folder that has a long path name. C:\Documents and Settings\User01\My Documents ``` -This command uses a pipeline operator (`|`) to send a path to `Split-Path`. -The path is enclosed in quotation marks to indicate that it is a single token. +This command uses a pipeline operator (`|`) to send a path to `Split-Path`. The path is enclosed in +quotation marks to indicate that it's a single token. ## PARAMETERS ### -Credential > [!NOTE] -> This parameter is not supported by any providers installed with PowerShell. -> To impersonate another user, or elevate your credentials when running this cmdlet, -> use [Invoke-Command](../Microsoft.PowerShell.Core/Invoke-Command.md). +> This parameter isn't supported by any providers installed with PowerShell. To impersonate another +> user, or elevate your credentials when running this cmdlet, use +> [Invoke-Command](../Microsoft.PowerShell.Core/Invoke-Command.md). ```yaml Type: System.Management.Automation.PSCredential @@ -176,8 +176,8 @@ Accept wildcard characters: False ### -IsAbsolute -Indicates that this cmdlet returns `$True` if the path is absolute and $False if it is relative. An -absolute path has a length greater than zero and does not use a dot (`.`) to indicate the current +Indicates that this cmdlet returns `$True` if the path is absolute and `$False` if it's relative. An +absolute path has a length greater than zero and doesn't use a dot (`.`) to indicate the current path. ```yaml @@ -231,8 +231,8 @@ Accept wildcard characters: False ### -NoQualifier Indicates that this cmdlet returns the path without the qualifier. For the FileSystem or registry -providers, the qualifier is the drive of the provider path, such as C: or HKCU:. For example, in the -path `C:\Test\Logs\Pass1.log`, it returns only \Test\Logs\Pass1.log. +providers, the qualifier is the drive of the provider path, such as `C:` or `HKCU:`. For example, in the +path `C:\Test\Logs\Pass1.log`, it returns only `\Test\Logs\Pass1.log`. ```yaml Type: System.Management.Automation.SwitchParameter @@ -249,7 +249,7 @@ Accept wildcard characters: False ### -Parent Indicates that this cmdlet returns only the parent containers of the item or of the container -specified by the path. For example, in the path `C:\Test\Logs\Pass1.log`, it returns C:\Test\Logs. +specified by the path. For example, in the path `C:\Test\Logs\Pass1.log`, it returns `C:\Test\Logs`. The **Parent** parameter is the default split location parameter. ```yaml @@ -284,7 +284,7 @@ Accept wildcard characters: True ### -Qualifier Indicates that this cmdlet returns only the qualifier of the specified path. For the FileSystem or -registry providers, the qualifier is the drive of the provider path, such as C: or HKCU:. +registry providers, the qualifier is the drive of the provider path, such as `C:` or `HKCU:`. ```yaml Type: System.Management.Automation.SwitchParameter @@ -336,7 +336,8 @@ Accept wildcard characters: False This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, --WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). +-WarningAction, and -WarningVariable. For more information, see +[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS @@ -349,7 +350,7 @@ You can pipe a string that contains a path to this cmdlet. ### System.String This cmdlet returns text strings. When you specify the **Resolve** parameter, it returns a -string that describes the location of the items. It does not return objects that represent the +string that describes the location of the items. It doesn't return objects that represent the items, such as a **FileInfo** or **RegistryKey** object. ### System.Boolean @@ -361,16 +362,16 @@ When you specify the **IsAbsolute** parameter, this cmdlet returns a **Boolean** - The split location parameters (**Qualifier**, **Parent**, **Leaf**, and **NoQualifier**) are exclusive. You can use only one in each command. - The cmdlets that contain the **Path** noun (the **Path** cmdlets) work with path names and return - the names in a concise format that all PowerShell providers can interpret. They are designed for +- The cmdlets that contain the **Path** noun (the **Path** cmdlets) work with path names and return + the names in a concise format that all PowerShell providers can interpret. They're designed for use in programs and scripts where you want to display all or part of a path name in a particular format. Use them in the way that you would use **Dirname**, **Normpath**, **Realpath**, **Join**, or other path manipulators. - You can use the **Path** cmdlets together with several providers. These include the FileSystem, +- You can use the **Path** cmdlets together with several providers. These include the FileSystem, Registry, and Certificate providers. - `Split-Path` is designed to work with the data exposed by any provider. To list the providers +- `Split-Path` is designed to work with the data exposed by any provider. To list the providers available in your session, type `Get-PSProvider`. For more information, see [about_Providers](../Microsoft.PowerShell.Core/About/about_Providers.md). ## RELATED LINKS diff --git a/reference/5.1/Microsoft.WSMan.Management/Remove-WSManInstance.md b/reference/5.1/Microsoft.WSMan.Management/Remove-WSManInstance.md index c3764e941a23..233ce45dc494 100644 --- a/reference/5.1/Microsoft.WSMan.Management/Remove-WSManInstance.md +++ b/reference/5.1/Microsoft.WSMan.Management/Remove-WSManInstance.md @@ -2,7 +2,7 @@ external help file: Microsoft.WSMan.Management.dll-Help.xml Locale: en-US Module Name: Microsoft.WSMan.Management -ms.date: 12/12/2022 +ms.date: 09/20/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.wsman.management/remove-wsmaninstance?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: Remove-WSManInstance @@ -19,9 +19,9 @@ Deletes a management resource instance. ``` Remove-WSManInstance [-ApplicationName ] [-ComputerName ] [-OptionSet ] - [-Port ] [-ResourceURI] [-SelectorSet] [-SessionOption ] [-UseSSL] - [-Credential ] [-Authentication ] [-CertificateThumbprint ] - [] + [-Port ] [-ResourceURI] [-SelectorSet] [-SessionOption ] + [-UseSSL] [-Credential ] [-Authentication ] + [-CertificateThumbprint ] [] ``` ### URI @@ -34,17 +34,20 @@ Remove-WSManInstance [-ConnectionURI ] [-OptionSet ] [-ResourceU ## DESCRIPTION -The `Remove-WSManInstance` cmdlet deletes an instance of a management resource that is specified in +The `Remove-WSManInstance` cmdlet deletes an instance of a management resource that's specified in the **ResourceURI** and **SelectorSet** parameters. -This cmdlet uses the WinRM connection/transport layer to delete the management resource instance. +This cmdlet uses the WinRM connection transport layer to delete the management resource instance. ## EXAMPLES ### Example 1: Delete a listener ```powershell -Remove-WSManInstance -ResourceUri winrm/config/Listener -SelectorSet Address=test.fabrikam.com;Transport=http +Remove-WSManInstance -ResourceUri winrm/config/Listener -SelectorSet @{ + Address = 'test.fabrikam.com' + Transport = 'http' +} ``` This command deletes the WS-Management HTTP listener on a computer. @@ -122,10 +125,10 @@ Specifies the digital public key certificate (X509) of a user account that has p this action. Enter the certificate thumbprint of the certificate. Certificates are used in client certificate-based authentication. They can be mapped only to local -user accounts; they do not work with domain accounts. +user accounts. Certificates don't work with domain accounts. -To get a certificate thumbprint, use the Get-Item or Get-ChildItem command in the Windows PowerShell -Cert: drive. +To get a certificate thumbprint, use the `Get-Item` or `Get-ChildItem` command in the PowerShell +`Cert:` drive. ```yaml Type: System.String diff --git a/reference/7.2/Microsoft.PowerShell.Core/About/about_Environment_Variables.md b/reference/7.2/Microsoft.PowerShell.Core/About/about_Environment_Variables.md index 1b24d04df14d..9f1d80b23b80 100644 --- a/reference/7.2/Microsoft.PowerShell.Core/About/about_Environment_Variables.md +++ b/reference/7.2/Microsoft.PowerShell.Core/About/about_Environment_Variables.md @@ -1,7 +1,7 @@ --- description: Describes how to access and manage environment variables in PowerShell. Locale: en-US -ms.date: 07/17/2023 +ms.date: 09/20/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Environment Variables @@ -200,6 +200,12 @@ VERBOSE: Performing the operation "Remove Item" on target "Item: Foo2". VERBOSE: Performing the operation "Remove Item" on target "Item: Foo". ``` +Use the `Get-ChildItem` cmdlet to see a full list of environment variables: + +```powershell +Get-ChildItem Env: +``` + For more information on using the **Environment** provider to manage environment variables, see [about_Environment_Provider][04]. diff --git a/reference/7.2/Microsoft.PowerShell.Host/Start-Transcript.md b/reference/7.2/Microsoft.PowerShell.Host/Start-Transcript.md index 36b7bcc1e0cf..1319cabbce3c 100644 --- a/reference/7.2/Microsoft.PowerShell.Host/Start-Transcript.md +++ b/reference/7.2/Microsoft.PowerShell.Host/Start-Transcript.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.ConsoleHost.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Host -ms.date: 12/12/2022 +ms.date: 09/20/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.host/start-transcript?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 title: Start-Transcript @@ -71,6 +71,28 @@ This command starts a transcript in the `Transcript0.txt` file in `C:\transcript **NoClobber** parameter is used, the command prevents any existing files from being overwritten. If the `Transcript0.txt` file already exists, the command fails. +### Example 3: Start a transcript file with a unique name and store it on a file share + +The following example creates a transcript file with a name unique enough to be stored on in a +shared location. The filename is constructed from the user's name, the hostname of the computer +running PowerShell, the version of PowerShell, and the date and time. The transcript is stored in +the `\\Server01\Transcripts` file share. + +```powershell +$sharepath = '\\Server01\Transcripts' +$username = $env:USERNAME +$hostname = hostname +$version = $PSVersionTable.PSVersion.ToString() +$datetime = Get-Date -f 'yyyyMMddHHmmss' +$filename = "Transcript-${username}-${hostname}-${version}-${datetime}.txt" +$Transcript = Join-Path -Path $sharepath -ChildPath $filename +Start-Transcript +``` + +The full path to the transcript file is stored in the `$Transcript` preference variable. For more +information about the `$Transcript` preference variable, see +[about_Preference_Variables](../Microsoft.PowerShell.Core/About/about_Preference_Variables.md#transcript). + ## PARAMETERS ### -Append @@ -93,7 +115,7 @@ Accept wildcard characters: False ### -Force Allows the cmdlet to append the transcript to an existing read-only file. When used on a read-only -file, the cmdlet changes the file permission to read-write. The cmdlet cannot override security +file, the cmdlet changes the file permission to read-write. The cmdlet can't override security restrictions when this parameter is used. ```yaml @@ -127,9 +149,9 @@ Accept wildcard characters: False ### -LiteralPath Specifies a location to the transcript file. Unlike the **Path** parameter, the value of the -**LiteralPath** parameter is used exactly as it is typed. No characters are interpreted as -wildcards. If the path includes escape characters, enclose it in single quotation marks. Single -quotation marks inform PowerShell not to interpret any characters as escape sequences. +**LiteralPath** parameter is used exactly as it's typed. No characters are interpreted as wildcards. +If the path includes escape characters, enclose it in single quotation marks. Single quotation marks +inform PowerShell not to interpret any characters as escape sequences. ```yaml Type: System.String @@ -145,7 +167,7 @@ Accept wildcard characters: False ### -NoClobber -Indicates that this cmdlet does not overwrite an existing file. By default, if a transcript file +Indicates that this cmdlet doesn't overwrite an existing file. By default, if a transcript file exists in the specified path, `Start-Transcript` overwrites the file without warning. ```yaml @@ -179,14 +201,14 @@ Accept wildcard characters: False ### -Path -Specifies a location to the transcript file. Enter a path to a `.txt` file. Wildcards are not +Specifies a location to the transcript file. Enter a path to a `.txt` file. Wildcards aren't permitted. -If you do not specify a path, `Start-Transcript` uses the path in the value of the `$Transcript` -global variable. If you have not created this variable, `Start-Transcript` stores the transcripts in +If you don't specify a path, `Start-Transcript` uses the path in the value of the `$Transcript` +global variable. If you haven't created this variable, `Start-Transcript` stores the transcripts in the `$HOME\My Documents directory as \PowerShell_transcript..txt` files. -If any of the directories in the path do not exist, the command fails. +If any of the directories in the path don't exist, the command fails. ```yaml Type: System.String @@ -236,7 +258,7 @@ Accept wildcard characters: False ### -WhatIf Shows what would happen if the cmdlet runs. -The cmdlet is not run. +The cmdlet isn't run. ```yaml Type: System.Management.Automation.SwitchParameter @@ -254,7 +276,8 @@ Accept wildcard characters: False This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, --WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). +-WarningAction, and -WarningVariable. For more information, see +[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS @@ -278,3 +301,5 @@ information, see [about_Profiles](../Microsoft.PowerShell.Core/About/about_Profi ## RELATED LINKS [Stop-Transcript](Stop-Transcript.md) + +[about_Preference_Variables](../Microsoft.PowerShell.Core/About/about_Preference_Variables.md#transcript) diff --git a/reference/7.2/Microsoft.PowerShell.Management/Set-Service.md b/reference/7.2/Microsoft.PowerShell.Management/Set-Service.md index d90610775955..adc6d9f09d27 100644 --- a/reference/7.2/Microsoft.PowerShell.Management/Set-Service.md +++ b/reference/7.2/Microsoft.PowerShell.Management/Set-Service.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Management -ms.date: 12/12/2022 +ms.date: 09/20/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/set-service?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 title: Set-Service @@ -202,6 +202,24 @@ The **SecurityDescriptor** is stored in the `$SDDL` variable. `Set-Service` uses parameter to specify the **BITS** service. The **SecurityDescriptorSddl** parameter uses `$SDDL` to change the **SecurityDescriptor** for the **BITS** service. +### Example 10: Set the startup type for multiple services + +The `Set-Service` cmdlet only accepts one service name at a time. However, you can pipe multiple +services to `Set-Service` to change the configuration of multiple services. + +```powershell +Get-Service SQLWriter,spooler | + Set-Service -StartupType Automatic -PassThru | + Select-Object Name, StartType +``` + +```Output +Name StartType +---- --------- +spooler Automatic +SQLWriter Automatic +``` + ## PARAMETERS ### -Credential @@ -341,7 +359,10 @@ Accept wildcard characters: False ### -SecurityDescriptorSddl -Specifies the **SecurityDescriptor** for the service in **Sddl** format. +Specifies the **SecurityDescriptor** for the service in **Sddl** format. The account calling +`Set-Service` with this parameter must have the WRITE_DAC and WRITE_OWNER permissions. For more +information, see +[Service security and access rights](/windows/win32/services/service-security-and-access-rights). ```yaml Type: System.String @@ -443,7 +464,8 @@ Accept wildcard characters: False This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, --WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). +-WarningAction, and -WarningVariable. For more information, see +[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/reference/7.2/Microsoft.PowerShell.Management/Split-Path.md b/reference/7.2/Microsoft.PowerShell.Management/Split-Path.md index e0bd3f3ce229..0e0b87736c95 100644 --- a/reference/7.2/Microsoft.PowerShell.Management/Split-Path.md +++ b/reference/7.2/Microsoft.PowerShell.Management/Split-Path.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Management -ms.date: 07/31/2023 +ms.date: 09/20/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/split-path?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 title: Split-Path @@ -72,7 +72,7 @@ Split-Path -LiteralPath [-Resolve] [-Credential ] [ [!NOTE] -> This parameter is not supported by any providers installed with PowerShell. To impersonate another -> user, or elevate your credentials when running this cmdlet, use [Invoke-Command](../Microsoft.PowerShell.Core/Invoke-Command.md). +> This parameter isn't supported by any providers installed with PowerShell. To impersonate another +> user, or elevate your credentials when running this cmdlet, use +> [Invoke-Command](../Microsoft.PowerShell.Core/Invoke-Command.md). ```yaml Type: System.Management.Automation.PSCredential @@ -206,8 +207,8 @@ Accept wildcard characters: False ### -IsAbsolute -Indicates that this cmdlet returns `$True` if the path is absolute and `$False` if it is relative. An -absolute path has a length greater than zero and does not use a dot (`.`) to indicate the current +Indicates that this cmdlet returns `$True` if the path is absolute and `$False` if it's relative. An +absolute path has a length greater than zero and doesn't use a dot (`.`) to indicate the current path. ```yaml @@ -382,7 +383,7 @@ You can pipe a string that contains a path to this cmdlet. ### System.String This cmdlet returns text strings. When you specify the **Resolve** parameter, it returns a -string that describes the location of the items. It does not return objects that represent the +string that describes the location of the items. It doesn't return objects that represent the items, such as a **FileInfo** or **RegistryKey** object. ### System.Boolean @@ -395,7 +396,7 @@ When you specify the **IsAbsolute** parameter, this cmdlet returns a **Boolean** and **NoQualifier**) are exclusive. You can use only one in each command. - The cmdlets that contain the **Path** noun (the **Path** cmdlets) work with path names and return - the names in a concise format that all PowerShell providers can interpret. They are designed for + the names in a concise format that all PowerShell providers can interpret. They're designed for use in programs and scripts where you want to display all or part of a path name in a particular format. Use them in the way that you would use **Dirname**, **Normpath**, **Realpath**, **Join**, or other path manipulators. diff --git a/reference/7.2/Microsoft.WSMan.Management/Remove-WSManInstance.md b/reference/7.2/Microsoft.WSMan.Management/Remove-WSManInstance.md index fabb0b4e4402..019f4f776570 100644 --- a/reference/7.2/Microsoft.WSMan.Management/Remove-WSManInstance.md +++ b/reference/7.2/Microsoft.WSMan.Management/Remove-WSManInstance.md @@ -2,7 +2,7 @@ external help file: Microsoft.WSMan.Management.dll-Help.xml Locale: en-US Module Name: Microsoft.WSMan.Management -ms.date: 12/12/2022 +ms.date: 09/20/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.wsman.management/remove-wsmaninstance?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 title: Remove-WSManInstance @@ -19,9 +19,9 @@ Deletes a management resource instance. ``` Remove-WSManInstance [-ApplicationName ] [-ComputerName ] [-OptionSet ] - [-Port ] [-ResourceURI] [-SelectorSet] [-SessionOption ] [-UseSSL] - [-Credential ] [-Authentication ] [-CertificateThumbprint ] - [] + [-Port ] [-ResourceURI] [-SelectorSet] [-SessionOption ] + [-UseSSL] [-Credential ] [-Authentication ] + [-CertificateThumbprint ] [] ``` ### URI @@ -36,17 +36,20 @@ Remove-WSManInstance [-ConnectionURI ] [-OptionSet ] [-ResourceU > **This cmdlet is only available on the Windows platform.** -The `Remove-WSManInstance` cmdlet deletes an instance of a management resource that is specified in +The `Remove-WSManInstance` cmdlet deletes an instance of a management resource that's specified in the **ResourceURI** and **SelectorSet** parameters. -This cmdlet uses the WinRM connection/transport layer to delete the management resource instance. +This cmdlet uses the WinRM connection transport layer to delete the management resource instance. ## EXAMPLES ### Example 1: Delete a listener ```powershell -Remove-WSManInstance -ResourceUri winrm/config/Listener -SelectorSet Address=test.fabrikam.com;Transport=http +Remove-WSManInstance -ResourceUri winrm/config/Listener -SelectorSet @{ + Address = 'test.fabrikam.com' + Transport = 'http' +} ``` This command deletes the WS-Management HTTP listener on a computer. @@ -124,10 +127,10 @@ Specifies the digital public key certificate (X509) of a user account that has p this action. Enter the certificate thumbprint of the certificate. Certificates are used in client certificate-based authentication. They can be mapped only to local -user accounts; they do not work with domain accounts. +user accounts. Certificates don't work with domain accounts. -To get a certificate thumbprint, use the Get-Item or Get-ChildItem command in the Windows PowerShell -Cert: drive. +To get a certificate thumbprint, use the `Get-Item` or `Get-ChildItem` command in the PowerShell +`Cert:` drive. ```yaml Type: System.String diff --git a/reference/7.3/Microsoft.PowerShell.Core/About/about_Environment_Variables.md b/reference/7.3/Microsoft.PowerShell.Core/About/about_Environment_Variables.md index 2f4710115fb1..ed057383dafe 100644 --- a/reference/7.3/Microsoft.PowerShell.Core/About/about_Environment_Variables.md +++ b/reference/7.3/Microsoft.PowerShell.Core/About/about_Environment_Variables.md @@ -1,7 +1,7 @@ --- description: Describes how to access and manage environment variables in PowerShell. Locale: en-US -ms.date: 07/17/2023 +ms.date: 09/20/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-7.3&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Environment Variables @@ -200,6 +200,12 @@ VERBOSE: Performing the operation "Remove Item" on target "Item: Foo2". VERBOSE: Performing the operation "Remove Item" on target "Item: Foo". ``` +Use the `Get-ChildItem` cmdlet to see a full list of environment variables: + +```powershell +Get-ChildItem Env: +``` + For more information on using the **Environment** provider to manage environment variables, see [about_Environment_Provider][04]. diff --git a/reference/7.3/Microsoft.PowerShell.Host/Start-Transcript.md b/reference/7.3/Microsoft.PowerShell.Host/Start-Transcript.md index 19407242423b..2336d6c45a2f 100644 --- a/reference/7.3/Microsoft.PowerShell.Host/Start-Transcript.md +++ b/reference/7.3/Microsoft.PowerShell.Host/Start-Transcript.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.ConsoleHost.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Host -ms.date: 12/12/2022 +ms.date: 09/20/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.host/start-transcript?view=powershell-7.3&WT.mc_id=ps-gethelp schema: 2.0.0 title: Start-Transcript @@ -71,6 +71,28 @@ This command starts a transcript in the `Transcript0.txt` file in `C:\transcript **NoClobber** parameter is used, the command prevents any existing files from being overwritten. If the `Transcript0.txt` file already exists, the command fails. +### Example 3: Start a transcript file with a unique name and store it on a file share + +The following example creates a transcript file with a name unique enough to be stored on in a +shared location. The filename is constructed from the user's name, the hostname of the computer +running PowerShell, the version of PowerShell, and the date and time. The transcript is stored in +the `\\Server01\Transcripts` file share. + +```powershell +$sharepath = '\\Server01\Transcripts' +$username = $env:USERNAME +$hostname = hostname +$version = $PSVersionTable.PSVersion.ToString() +$datetime = Get-Date -f 'yyyyMMddHHmmss' +$filename = "Transcript-${username}-${hostname}-${version}-${datetime}.txt" +$Transcript = Join-Path -Path $sharepath -ChildPath $filename +Start-Transcript +``` + +The full path to the transcript file is stored in the `$Transcript` preference variable. For more +information about the `$Transcript` preference variable, see +[about_Preference_Variables](../Microsoft.PowerShell.Core/About/about_Preference_Variables.md#transcript). + ## PARAMETERS ### -Append @@ -93,7 +115,7 @@ Accept wildcard characters: False ### -Force Allows the cmdlet to append the transcript to an existing read-only file. When used on a read-only -file, the cmdlet changes the file permission to read-write. The cmdlet cannot override security +file, the cmdlet changes the file permission to read-write. The cmdlet can't override security restrictions when this parameter is used. ```yaml @@ -127,9 +149,9 @@ Accept wildcard characters: False ### -LiteralPath Specifies a location to the transcript file. Unlike the **Path** parameter, the value of the -**LiteralPath** parameter is used exactly as it is typed. No characters are interpreted as -wildcards. If the path includes escape characters, enclose it in single quotation marks. Single -quotation marks inform PowerShell not to interpret any characters as escape sequences. +**LiteralPath** parameter is used exactly as it's typed. No characters are interpreted as wildcards. +If the path includes escape characters, enclose it in single quotation marks. Single quotation marks +inform PowerShell not to interpret any characters as escape sequences. ```yaml Type: System.String @@ -145,7 +167,7 @@ Accept wildcard characters: False ### -NoClobber -Indicates that this cmdlet does not overwrite an existing file. By default, if a transcript file +Indicates that this cmdlet doesn't overwrite an existing file. By default, if a transcript file exists in the specified path, `Start-Transcript` overwrites the file without warning. ```yaml @@ -179,14 +201,14 @@ Accept wildcard characters: False ### -Path -Specifies a location to the transcript file. Enter a path to a `.txt` file. Wildcards are not +Specifies a location to the transcript file. Enter a path to a `.txt` file. Wildcards aren't permitted. -If you do not specify a path, `Start-Transcript` uses the path in the value of the `$Transcript` -global variable. If you have not created this variable, `Start-Transcript` stores the transcripts in +If you don't specify a path, `Start-Transcript` uses the path in the value of the `$Transcript` +global variable. If you haven't created this variable, `Start-Transcript` stores the transcripts in the `$HOME\My Documents directory as \PowerShell_transcript..txt` files. -If any of the directories in the path do not exist, the command fails. +If any of the directories in the path don't exist, the command fails. ```yaml Type: System.String @@ -236,7 +258,7 @@ Accept wildcard characters: False ### -WhatIf Shows what would happen if the cmdlet runs. -The cmdlet is not run. +The cmdlet isn't run. ```yaml Type: System.Management.Automation.SwitchParameter @@ -254,7 +276,8 @@ Accept wildcard characters: False This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, --WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). +-WarningAction, and -WarningVariable. For more information, see +[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS @@ -278,3 +301,5 @@ information, see [about_Profiles](../Microsoft.PowerShell.Core/About/about_Profi ## RELATED LINKS [Stop-Transcript](Stop-Transcript.md) + +[about_Preference_Variables](../Microsoft.PowerShell.Core/About/about_Preference_Variables.md#transcript) diff --git a/reference/7.3/Microsoft.PowerShell.Management/Set-Service.md b/reference/7.3/Microsoft.PowerShell.Management/Set-Service.md index 80428fc4f9b8..df7c1c16579f 100644 --- a/reference/7.3/Microsoft.PowerShell.Management/Set-Service.md +++ b/reference/7.3/Microsoft.PowerShell.Management/Set-Service.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Management -ms.date: 12/12/2022 +ms.date: 09/20/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/set-service?view=powershell-7.3&WT.mc_id=ps-gethelp schema: 2.0.0 title: Set-Service @@ -202,6 +202,24 @@ The **SecurityDescriptor** is stored in the `$SDDL` variable. `Set-Service` uses parameter to specify the **BITS** service. The **SecurityDescriptorSddl** parameter uses `$SDDL` to change the **SecurityDescriptor** for the **BITS** service. +### Example 10: Set the startup type for multiple services + +The `Set-Service` cmdlet only accepts one service name at a time. However, you can pipe multiple +services to `Set-Service` to change the configuration of multiple services. + +```powershell +Get-Service SQLWriter,spooler | + Set-Service -StartupType Automatic -PassThru | + Select-Object Name, StartType +``` + +```Output +Name StartType +---- --------- +spooler Automatic +SQLWriter Automatic +``` + ## PARAMETERS ### -Credential @@ -446,7 +464,8 @@ Accept wildcard characters: False This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, --WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). +-WarningAction, and -WarningVariable. For more information, see +[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/reference/7.3/Microsoft.PowerShell.Management/Split-Path.md b/reference/7.3/Microsoft.PowerShell.Management/Split-Path.md index 166a81d32c8a..8eabe9271dfd 100644 --- a/reference/7.3/Microsoft.PowerShell.Management/Split-Path.md +++ b/reference/7.3/Microsoft.PowerShell.Management/Split-Path.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Management -ms.date: 07/31/2023 +ms.date: 09/20/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/split-path?view=powershell-7.3&WT.mc_id=ps-gethelp schema: 2.0.0 title: Split-Path @@ -72,7 +72,7 @@ Split-Path -LiteralPath [-Resolve] [-Credential ] [ [!NOTE] -> This parameter is not supported by any providers installed with PowerShell. To impersonate another -> user, or elevate your credentials when running this cmdlet, use [Invoke-Command](../Microsoft.PowerShell.Core/Invoke-Command.md). +> This parameter isn't supported by any providers installed with PowerShell. To impersonate another +> user, or elevate your credentials when running this cmdlet, use +> [Invoke-Command](../Microsoft.PowerShell.Core/Invoke-Command.md). ```yaml Type: System.Management.Automation.PSCredential @@ -206,8 +207,8 @@ Accept wildcard characters: False ### -IsAbsolute -Indicates that this cmdlet returns `$True` if the path is absolute and `$False` if it is relative. An -absolute path has a length greater than zero and does not use a dot (`.`) to indicate the current +Indicates that this cmdlet returns `$True` if the path is absolute and `$False` if it's relative. An +absolute path has a length greater than zero and doesn't use a dot (`.`) to indicate the current path. ```yaml @@ -382,7 +383,7 @@ You can pipe a string that contains a path to this cmdlet. ### System.String This cmdlet returns text strings. When you specify the **Resolve** parameter, it returns a -string that describes the location of the items. It does not return objects that represent the +string that describes the location of the items. It doesn't return objects that represent the items, such as a **FileInfo** or **RegistryKey** object. ### System.Boolean @@ -395,7 +396,7 @@ When you specify the **IsAbsolute** parameter, this cmdlet returns a **Boolean** and **NoQualifier**) are exclusive. You can use only one in each command. - The cmdlets that contain the **Path** noun (the **Path** cmdlets) work with path names and return - the names in a concise format that all PowerShell providers can interpret. They are designed for + the names in a concise format that all PowerShell providers can interpret. They're designed for use in programs and scripts where you want to display all or part of a path name in a particular format. Use them in the way that you would use **Dirname**, **Normpath**, **Realpath**, **Join**, or other path manipulators. diff --git a/reference/7.3/Microsoft.WSMan.Management/Remove-WSManInstance.md b/reference/7.3/Microsoft.WSMan.Management/Remove-WSManInstance.md index 59390c5032a0..c2bbca211128 100644 --- a/reference/7.3/Microsoft.WSMan.Management/Remove-WSManInstance.md +++ b/reference/7.3/Microsoft.WSMan.Management/Remove-WSManInstance.md @@ -2,7 +2,7 @@ external help file: Microsoft.WSMan.Management.dll-Help.xml Locale: en-US Module Name: Microsoft.WSMan.Management -ms.date: 12/12/2022 +ms.date: 09/20/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.wsman.management/remove-wsmaninstance?view=powershell-7.3&WT.mc_id=ps-gethelp schema: 2.0.0 title: Remove-WSManInstance @@ -19,9 +19,9 @@ Deletes a management resource instance. ``` Remove-WSManInstance [-ApplicationName ] [-ComputerName ] [-OptionSet ] - [-Port ] [-ResourceURI] [-SelectorSet] [-SessionOption ] [-UseSSL] - [-Credential ] [-Authentication ] [-CertificateThumbprint ] - [] + [-Port ] [-ResourceURI] [-SelectorSet] [-SessionOption ] + [-UseSSL] [-Credential ] [-Authentication ] + [-CertificateThumbprint ] [] ``` ### URI @@ -36,17 +36,20 @@ Remove-WSManInstance [-ConnectionURI ] [-OptionSet ] [-ResourceU > **This cmdlet is only available on the Windows platform.** -The `Remove-WSManInstance` cmdlet deletes an instance of a management resource that is specified in +The `Remove-WSManInstance` cmdlet deletes an instance of a management resource that's specified in the **ResourceURI** and **SelectorSet** parameters. -This cmdlet uses the WinRM connection/transport layer to delete the management resource instance. +This cmdlet uses the WinRM connection transport layer to delete the management resource instance. ## EXAMPLES ### Example 1: Delete a listener ```powershell -Remove-WSManInstance -ResourceUri winrm/config/Listener -SelectorSet Address=test.fabrikam.com;Transport=http +Remove-WSManInstance -ResourceUri winrm/config/Listener -SelectorSet @{ + Address = 'test.fabrikam.com' + Transport = 'http' +} ``` This command deletes the WS-Management HTTP listener on a computer. @@ -124,10 +127,10 @@ Specifies the digital public key certificate (X509) of a user account that has p this action. Enter the certificate thumbprint of the certificate. Certificates are used in client certificate-based authentication. They can be mapped only to local -user accounts; they do not work with domain accounts. +user accounts. Certificates don't work with domain accounts. -To get a certificate thumbprint, use the Get-Item or Get-ChildItem command in the Windows PowerShell -Cert: drive. +To get a certificate thumbprint, use the `Get-Item` or `Get-ChildItem` command in the PowerShell +`Cert:` drive. ```yaml Type: System.String diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Environment_Variables.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Environment_Variables.md index 2010879fcbf8..8bd610c4daac 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Environment_Variables.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Environment_Variables.md @@ -1,7 +1,7 @@ --- description: Describes how to access and manage environment variables in PowerShell. Locale: en-US -ms.date: 07/17/2023 +ms.date: 09/20/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Environment Variables @@ -200,6 +200,12 @@ VERBOSE: Performing the operation "Remove Item" on target "Item: Foo2". VERBOSE: Performing the operation "Remove Item" on target "Item: Foo". ``` +Use the `Get-ChildItem` cmdlet to see a full list of environment variables: + +```powershell +Get-ChildItem Env: +``` + For more information on using the **Environment** provider to manage environment variables, see [about_Environment_Provider][04]. diff --git a/reference/7.4/Microsoft.PowerShell.Host/Start-Transcript.md b/reference/7.4/Microsoft.PowerShell.Host/Start-Transcript.md index 5802be89ca5f..4be65785be62 100644 --- a/reference/7.4/Microsoft.PowerShell.Host/Start-Transcript.md +++ b/reference/7.4/Microsoft.PowerShell.Host/Start-Transcript.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.ConsoleHost.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Host -ms.date: 12/12/2022 +ms.date: 09/20/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.host/start-transcript?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: Start-Transcript @@ -71,6 +71,28 @@ This command starts a transcript in the `Transcript0.txt` file in `C:\transcript **NoClobber** parameter is used, the command prevents any existing files from being overwritten. If the `Transcript0.txt` file already exists, the command fails. +### Example 3: Start a transcript file with a unique name and store it on a file share + +The following example creates a transcript file with a name unique enough to be stored on in a +shared location. The filename is constructed from the user's name, the hostname of the computer +running PowerShell, the version of PowerShell, and the date and time. The transcript is stored in +the `\\Server01\Transcripts` file share. + +```powershell +$sharepath = '\\Server01\Transcripts' +$username = $env:USERNAME +$hostname = hostname +$version = $PSVersionTable.PSVersion.ToString() +$datetime = Get-Date -f 'yyyyMMddHHmmss' +$filename = "Transcript-${username}-${hostname}-${version}-${datetime}.txt" +$Transcript = Join-Path -Path $sharepath -ChildPath $filename +Start-Transcript +``` + +The full path to the transcript file is stored in the `$Transcript` preference variable. For more +information about the `$Transcript` preference variable, see +[about_Preference_Variables](../Microsoft.PowerShell.Core/About/about_Preference_Variables.md#transcript). + ## PARAMETERS ### -Append @@ -93,7 +115,7 @@ Accept wildcard characters: False ### -Force Allows the cmdlet to append the transcript to an existing read-only file. When used on a read-only -file, the cmdlet changes the file permission to read-write. The cmdlet cannot override security +file, the cmdlet changes the file permission to read-write. The cmdlet can't override security restrictions when this parameter is used. ```yaml @@ -127,9 +149,9 @@ Accept wildcard characters: False ### -LiteralPath Specifies a location to the transcript file. Unlike the **Path** parameter, the value of the -**LiteralPath** parameter is used exactly as it is typed. No characters are interpreted as -wildcards. If the path includes escape characters, enclose it in single quotation marks. Single -quotation marks inform PowerShell not to interpret any characters as escape sequences. +**LiteralPath** parameter is used exactly as it's typed. No characters are interpreted as wildcards. +If the path includes escape characters, enclose it in single quotation marks. Single quotation marks +inform PowerShell not to interpret any characters as escape sequences. ```yaml Type: System.String @@ -145,7 +167,7 @@ Accept wildcard characters: False ### -NoClobber -Indicates that this cmdlet does not overwrite an existing file. By default, if a transcript file +Indicates that this cmdlet doesn't overwrite an existing file. By default, if a transcript file exists in the specified path, `Start-Transcript` overwrites the file without warning. ```yaml @@ -179,14 +201,14 @@ Accept wildcard characters: False ### -Path -Specifies a location to the transcript file. Enter a path to a `.txt` file. Wildcards are not +Specifies a location to the transcript file. Enter a path to a `.txt` file. Wildcards aren't permitted. -If you do not specify a path, `Start-Transcript` uses the path in the value of the `$Transcript` -global variable. If you have not created this variable, `Start-Transcript` stores the transcripts in +If you don't specify a path, `Start-Transcript` uses the path in the value of the `$Transcript` +global variable. If you haven't created this variable, `Start-Transcript` stores the transcripts in the `$HOME\My Documents directory as \PowerShell_transcript..txt` files. -If any of the directories in the path do not exist, the command fails. +If any of the directories in the path don't exist, the command fails. ```yaml Type: System.String @@ -236,7 +258,7 @@ Accept wildcard characters: False ### -WhatIf Shows what would happen if the cmdlet runs. -The cmdlet is not run. +The cmdlet isn't run. ```yaml Type: System.Management.Automation.SwitchParameter @@ -254,7 +276,8 @@ Accept wildcard characters: False This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, --WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). +-WarningAction, and -WarningVariable. For more information, see +[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS @@ -278,3 +301,5 @@ information, see [about_Profiles](../Microsoft.PowerShell.Core/About/about_Profi ## RELATED LINKS [Stop-Transcript](Stop-Transcript.md) + +[about_Preference_Variables](../Microsoft.PowerShell.Core/About/about_Preference_Variables.md#transcript) diff --git a/reference/7.4/Microsoft.PowerShell.Management/Set-Service.md b/reference/7.4/Microsoft.PowerShell.Management/Set-Service.md index e53e7e32a1fb..545de3fdce88 100644 --- a/reference/7.4/Microsoft.PowerShell.Management/Set-Service.md +++ b/reference/7.4/Microsoft.PowerShell.Management/Set-Service.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Management -ms.date: 12/12/2022 +ms.date: 09/20/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/set-service?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: Set-Service @@ -202,6 +202,24 @@ The **SecurityDescriptor** is stored in the `$SDDL` variable. `Set-Service` uses parameter to specify the **BITS** service. The **SecurityDescriptorSddl** parameter uses `$SDDL` to change the **SecurityDescriptor** for the **BITS** service. +### Example 10: Set the startup type for multiple services + +The `Set-Service` cmdlet only accepts one service name at a time. However, you can pipe multiple +services to `Set-Service` to change the configuration of multiple services. + +```powershell +Get-Service SQLWriter,spooler | + Set-Service -StartupType Automatic -PassThru | + Select-Object Name, StartType +``` + +```Output +Name StartType +---- --------- +spooler Automatic +SQLWriter Automatic +``` + ## PARAMETERS ### -Credential @@ -446,7 +464,8 @@ Accept wildcard characters: False This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, --WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). +-WarningAction, and -WarningVariable. For more information, see +[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/reference/7.4/Microsoft.PowerShell.Management/Split-Path.md b/reference/7.4/Microsoft.PowerShell.Management/Split-Path.md index 8a1fb0597040..f664f6cd2a47 100644 --- a/reference/7.4/Microsoft.PowerShell.Management/Split-Path.md +++ b/reference/7.4/Microsoft.PowerShell.Management/Split-Path.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Management -ms.date: 07/31/2023 +ms.date: 09/20/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/split-path?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: Split-Path @@ -72,7 +72,7 @@ Split-Path -LiteralPath [-Resolve] [-Credential ] [ [!NOTE] -> This parameter is not supported by any providers installed with PowerShell. To impersonate another -> user, or elevate your credentials when running this cmdlet, use [Invoke-Command](../Microsoft.PowerShell.Core/Invoke-Command.md). +> This parameter isn't supported by any providers installed with PowerShell. To impersonate another +> user, or elevate your credentials when running this cmdlet, use +> [Invoke-Command](../Microsoft.PowerShell.Core/Invoke-Command.md). ```yaml Type: System.Management.Automation.PSCredential @@ -206,8 +207,8 @@ Accept wildcard characters: False ### -IsAbsolute -Indicates that this cmdlet returns `$True` if the path is absolute and `$False` if it is relative. An -absolute path has a length greater than zero and does not use a dot (`.`) to indicate the current +Indicates that this cmdlet returns `$True` if the path is absolute and `$False` if it's relative. An +absolute path has a length greater than zero and doesn't use a dot (`.`) to indicate the current path. ```yaml @@ -382,7 +383,7 @@ You can pipe a string that contains a path to this cmdlet. ### System.String This cmdlet returns text strings. When you specify the **Resolve** parameter, it returns a -string that describes the location of the items. It does not return objects that represent the +string that describes the location of the items. It doesn't return objects that represent the items, such as a **FileInfo** or **RegistryKey** object. ### System.Boolean @@ -395,7 +396,7 @@ When you specify the **IsAbsolute** parameter, this cmdlet returns a **Boolean** and **NoQualifier**) are exclusive. You can use only one in each command. - The cmdlets that contain the **Path** noun (the **Path** cmdlets) work with path names and return - the names in a concise format that all PowerShell providers can interpret. They are designed for + the names in a concise format that all PowerShell providers can interpret. They're designed for use in programs and scripts where you want to display all or part of a path name in a particular format. Use them in the way that you would use **Dirname**, **Normpath**, **Realpath**, **Join**, or other path manipulators. diff --git a/reference/7.4/Microsoft.WSMan.Management/Remove-WSManInstance.md b/reference/7.4/Microsoft.WSMan.Management/Remove-WSManInstance.md index 8663ca30f745..20fe7794814a 100644 --- a/reference/7.4/Microsoft.WSMan.Management/Remove-WSManInstance.md +++ b/reference/7.4/Microsoft.WSMan.Management/Remove-WSManInstance.md @@ -2,7 +2,7 @@ external help file: Microsoft.WSMan.Management.dll-Help.xml Locale: en-US Module Name: Microsoft.WSMan.Management -ms.date: 12/12/2022 +ms.date: 09/20/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.wsman.management/remove-wsmaninstance?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: Remove-WSManInstance @@ -19,9 +19,9 @@ Deletes a management resource instance. ``` Remove-WSManInstance [-ApplicationName ] [-ComputerName ] [-OptionSet ] - [-Port ] [-ResourceURI] [-SelectorSet] [-SessionOption ] [-UseSSL] - [-Credential ] [-Authentication ] [-CertificateThumbprint ] - [] + [-Port ] [-ResourceURI] [-SelectorSet] [-SessionOption ] + [-UseSSL] [-Credential ] [-Authentication ] + [-CertificateThumbprint ] [] ``` ### URI @@ -36,17 +36,20 @@ Remove-WSManInstance [-ConnectionURI ] [-OptionSet ] [-ResourceU > **This cmdlet is only available on the Windows platform.** -The `Remove-WSManInstance` cmdlet deletes an instance of a management resource that is specified in +The `Remove-WSManInstance` cmdlet deletes an instance of a management resource that's specified in the **ResourceURI** and **SelectorSet** parameters. -This cmdlet uses the WinRM connection/transport layer to delete the management resource instance. +This cmdlet uses the WinRM connection transport layer to delete the management resource instance. ## EXAMPLES ### Example 1: Delete a listener ```powershell -Remove-WSManInstance -ResourceUri winrm/config/Listener -SelectorSet Address=test.fabrikam.com;Transport=http +Remove-WSManInstance -ResourceUri winrm/config/Listener -SelectorSet @{ + Address = 'test.fabrikam.com' + Transport = 'http' +} ``` This command deletes the WS-Management HTTP listener on a computer. @@ -124,10 +127,10 @@ Specifies the digital public key certificate (X509) of a user account that has p this action. Enter the certificate thumbprint of the certificate. Certificates are used in client certificate-based authentication. They can be mapped only to local -user accounts; they do not work with domain accounts. +user accounts. Certificates don't work with domain accounts. -To get a certificate thumbprint, use the Get-Item or Get-ChildItem command in the Windows PowerShell -Cert: drive. +To get a certificate thumbprint, use the `Get-Item` or `Get-ChildItem` command in the PowerShell +`Cert:` drive. ```yaml Type: System.String diff --git a/reference/docs-conceptual/learn/deep-dives/everything-about-if.md b/reference/docs-conceptual/learn/deep-dives/everything-about-if.md index dadc59fc245f..63566185fabb 100644 --- a/reference/docs-conceptual/learn/deep-dives/everything-about-if.md +++ b/reference/docs-conceptual/learn/deep-dives/everything-about-if.md @@ -422,7 +422,7 @@ other values. if ( Get-Process Notepad* ) ``` -It evaluates to `$true` if there's a returned process and `$false` if there'sn'thing. It's +It evaluates to `$true` if there's a returned process and `$false` if there isn't. It's perfectly valid to use pipeline expressions or other PowerShell statements like this: ```powershell