Updates from: 08/13/2021 03:23:33
Service Microsoft Docs article Related commit history on GitHub Change details
Microsoft.PowerShell.Core About Pscustomobject (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/Microsoft.PowerShell.Core/About/about_PSCustomObject.md
+---
+description: Explains the differences between PSObject and PSCustomObject.
+Locale: en-US
Last updated : 08/10/2021
+online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_pscustomobject?view=powershell-5.1&WT.mc_id=ps-gethelp
+schema: 2.0.0
+ Title: about PSCustomObject
+---
+# about_PSCustomObject
+
+## Short description
+Explains the differences between **PSObject** and **PSCustomObject**.
+
+## Long description
+
+The `[pscustomobject]` type accelerator was added in PowerShell 4.0.
+
+Prior to adding this type accelerator, creating an object with member
+properties and values was more complicated. Originally, you had to use
+`New-Object` to create the object and `Add-Member` to add properties. For
+example:
+
+```powershell
+PS> $object1 = New-Object -TypeName psobject
+PS> Add-Member -InputObject $object1 -MemberType NoteProperty -Name one -Value 1
+PS> Add-Member -InputObject $object1 -MemberType NoteProperty -Name two -Value 2
+PS> $object1 | Get-Member
+
+ TypeName: System.Management.Automation.PSCustomObject
+
+Name MemberType Definition
+---- ---------- ----------
+Equals Method bool Equals(System.Object obj)
+GetHashCode Method int GetHashCode()
+GetType Method type GetType()
+ToString Method string ToString()
+one NoteProperty int one=1
+two NoteProperty int two=2
+
+PS> $object1
+
+one two
+--- ---
+ 1 2
+```
+
+Later, you could use the **Property** parameter of `New-Object` to pass a
+**Hashtable** containing the members and values. For example:
+
+```powershell
+PS> $object2 = New-Object -TypeName psobject -Property @{one=1; two=2}
+PS> $object2 | Get-Member
+
+ TypeName: System.Management.Automation.PSCustomObject
+
+Name MemberType Definition
+---- ---------- ----------
+Equals Method bool Equals(System.Object obj)
+GetHashCode Method int GetHashCode()
+GetType Method type GetType()
+ToString Method string ToString()
+one NoteProperty int one=1
+two NoteProperty int two=2
+
+PS> $object2
+
+one two
+--- ---
+ 1 2
+```
+
+Since PowerShell 3.0, casting a **Hashtable** to `[pscustomobject]` achieves
+the same result.
+
+```powershell
+PS> $object3 = [pscustomobject]@{one=1; two=2}
+PS> $object3 | Get-Member
+
+ TypeName: System.Management.Automation.PSCustomObject
+
+Name MemberType Definition
+---- ---------- ----------
+Equals Method bool Equals(System.Object obj)
+GetHashCode Method int GetHashCode()
+GetType Method type GetType()
+ToString Method string ToString()
+one NoteProperty int one=1
+two NoteProperty int two=2
+
+PS> $object3
+
+one two
+--- ---
+ 1 2
+```
+
+## Understanding the type accelerators
+
+`[psobject]` and `[pscustomobject]` are type accelerators.
+
+For more information, see [about_Type_Accelerators](about_type_accelerators.md).
+
+Even though you might think that `[pscustomobject]` should map to
+**System.Management.Automation.PSCustomObject**, the types are different.
+
+```powershell
+PS> [pscustomobject] -eq [System.Management.Automation.PSCustomObject]
+False
+```
+
+Both type accelerators are mapped to the same class, **PSObject**:
+
+```powershell
+PS> [pscustomobject]
+
+IsPublic IsSerial Name BaseType
+-------- -------- ---- --------
+True True PSObject System.Object
+
+PS> [psobject]
+
+IsPublic IsSerial Name BaseType
+-------- -------- ---- --------
+True True PSObject System.Object
+```
+
+When the `[pscustomobject]` type accelerator was added, it included extra code
+to handle conversion of **Hashtable** objects. This extra code is only invoked
+when a new object is being created. Therefore, you can't use
+`[pscustomobject]` for type coercion or type comparison, because all objects
+are treated as a **PSObject** types.
+
+For example, using the `-is` operator to check that an object returned by a
+cmdlet is a `[pscustomobject]` is the same as comparing it to `[psobject]`.
+
+```powershell
+PS> (Get-Item /) -is [pscustomobject]
+True
+
+PS> (Get-Item /) -is [psobject]
+True
+```
+
+When you cast any object to `[psobject]` you get the type of the original
+object. Therefore, casting anything other than a **Hashtable** to
+`[pscustomobject]` results in the same type.
+
+```powershell
+PS> ([PSObject]@{Property = 'Value'}).GetType().FullName
+System.Collections.Hashtable
+
+PS> ([pscustomobject]123).GetType().Name
+Int32
+
+PS> ([PSCustomObject]@{Property = 'Value'}).GetType().FullName
+System.Management.Automation.PSCustomObject
+```
+
+## See also
+
+- [about_Object_Creation](about_Object_Creation.md)
+- [about_Objects](about_Objects.md)
+- [System.Management.Automation.PSObject](xref:System.Management.Automation.PSObject)
+- [System.Management.Automation.PSCustomObject](xref:System.Management.Automation.PSCustomObject)
Microsoft.PowerShell.Core About Pscustomobject (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/Microsoft.PowerShell.Core/About/about_PSCustomObject.md
+---
+description: Explains the differences between PSObject and PSCustomObject.
+Locale: en-US
Last updated : 08/10/2021
+online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_pscustomobject?view=powershell-7.0&WT.mc_id=ps-gethelp
+schema: 2.0.0
+ Title: about PSCustomObject
+---
+# about_PSCustomObject
+
+## Short description
+Explains the differences between **PSObject** and **PSCustomObject**.
+
+## Long description
+
+The `[pscustomobject]` type accelerator was added in PowerShell 4.0.
+
+Prior to adding this type accelerator, creating an object with member
+properties and values was more complicated. Originally, you had to use
+`New-Object` to create the object and `Add-Member` to add properties. For
+example:
+
+```powershell
+PS> $object1 = New-Object -TypeName psobject
+PS> Add-Member -InputObject $object1 -MemberType NoteProperty -Name one -Value 1
+PS> Add-Member -InputObject $object1 -MemberType NoteProperty -Name two -Value 2
+PS> $object1 | Get-Member
+
+ TypeName: System.Management.Automation.PSCustomObject
+
+Name MemberType Definition
+---- ---------- ----------
+Equals Method bool Equals(System.Object obj)
+GetHashCode Method int GetHashCode()
+GetType Method type GetType()
+ToString Method string ToString()
+one NoteProperty int one=1
+two NoteProperty int two=2
+
+PS> $object1
+
+one two
+--- ---
+ 1 2
+```
+
+Later, you could use the **Property** parameter of `New-Object` to pass a
+**Hashtable** containing the members and values. For example:
+
+```powershell
+PS> $object2 = New-Object -TypeName psobject -Property @{one=1; two=2}
+PS> $object2 | Get-Member
+
+ TypeName: System.Management.Automation.PSCustomObject
+
+Name MemberType Definition
+---- ---------- ----------
+Equals Method bool Equals(System.Object obj)
+GetHashCode Method int GetHashCode()
+GetType Method type GetType()
+ToString Method string ToString()
+one NoteProperty int one=1
+two NoteProperty int two=2
+
+PS> $object2
+
+one two
+--- ---
+ 1 2
+```
+
+Since PowerShell 3.0, casting a **Hashtable** to `[pscustomobject]` achieves
+the same result.
+
+```powershell
+PS> $object3 = [pscustomobject]@{one=1; two=2}
+PS> $object3 | Get-Member
+
+ TypeName: System.Management.Automation.PSCustomObject
+
+Name MemberType Definition
+---- ---------- ----------
+Equals Method bool Equals(System.Object obj)
+GetHashCode Method int GetHashCode()
+GetType Method type GetType()
+ToString Method string ToString()
+one NoteProperty int one=1
+two NoteProperty int two=2
+
+PS> $object3
+
+one two
+--- ---
+ 1 2
+```
+
+## Understanding the type accelerators
+
+`[psobject]` and `[pscustomobject]` are type accelerators.
+
+For more information, see [about_Type_Accelerators](about_type_accelerators.md).
+
+Even though you might think that `[pscustomobject]` should map to
+**System.Management.Automation.PSCustomObject**, the types are different.
+
+```powershell
+PS> [pscustomobject] -eq [System.Management.Automation.PSCustomObject]
+False
+```
+
+Both type accelerators are mapped to the same class, **PSObject**:
+
+```powershell
+PS> [pscustomobject]
+
+IsPublic IsSerial Name BaseType
+-------- -------- ---- --------
+True True PSObject System.Object
+
+PS> [psobject]
+
+IsPublic IsSerial Name BaseType
+-------- -------- ---- --------
+True True PSObject System.Object
+```
+
+When the `[pscustomobject]` type accelerator was added, it included extra code
+to handle conversion of **Hashtable** objects. This extra code is only invoked
+when a new object is being created. Therefore, you can't use
+`[pscustomobject]` for type coercion or type comparison, because all objects
+are treated as a **PSObject** types.
+
+For example, using the `-is` operator to check that an object returned by a
+cmdlet is a `[pscustomobject]` is the same as comparing it to `[psobject]`.
+
+```powershell
+PS> (Get-Item /) -is [pscustomobject]
+True
+
+PS> (Get-Item /) -is [psobject]
+True
+```
+
+When you cast any object to `[psobject]` you get the type of the original
+object. Therefore, casting anything other than a **Hashtable** to
+`[pscustomobject]` results in the same type.
+
+```powershell
+PS> ([PSObject]@{Property = 'Value'}).GetType().FullName
+System.Collections.Hashtable
+
+PS> ([pscustomobject]123).GetType().Name
+Int32
+
+PS> ([PSCustomObject]@{Property = 'Value'}).GetType().FullName
+System.Management.Automation.PSCustomObject
+```
+
+## See also
+
+- [about_Object_Creation](about_Object_Creation.md)
+- [about_Objects](about_Objects.md)
+- [System.Management.Automation.PSObject](xref:System.Management.Automation.PSObject)
+- [System.Management.Automation.PSCustomObject](xref:System.Management.Automation.PSCustomObject)
Microsoft.PowerShell.Core About Pscustomobject (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/Microsoft.PowerShell.Core/About/about_PSCustomObject.md
+---
+description: Explains the differences between PSObject and PSCustomObject.
+Locale: en-US
Last updated : 08/10/2021
+online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_pscustomobject?view=powershell-7.1&WT.mc_id=ps-gethelp
+schema: 2.0.0
+ Title: about PSCustomObject
+---
+# about_PSCustomObject
+
+## Short description
+Explains the differences between **PSObject** and **PSCustomObject**.
+
+## Long description
+
+The `[pscustomobject]` type accelerator was added in PowerShell 4.0.
+
+Prior to adding this type accelerator, creating an object with member
+properties and values was more complicated. Originally, you had to use
+`New-Object` to create the object and `Add-Member` to add properties. For
+example:
+
+```powershell
+PS> $object1 = New-Object -TypeName psobject
+PS> Add-Member -InputObject $object1 -MemberType NoteProperty -Name one -Value 1
+PS> Add-Member -InputObject $object1 -MemberType NoteProperty -Name two -Value 2
+PS> $object1 | Get-Member
+
+ TypeName: System.Management.Automation.PSCustomObject
+
+Name MemberType Definition
+---- ---------- ----------
+Equals Method bool Equals(System.Object obj)
+GetHashCode Method int GetHashCode()
+GetType Method type GetType()
+ToString Method string ToString()
+one NoteProperty int one=1
+two NoteProperty int two=2
+
+PS> $object1
+
+one two
+--- ---
+ 1 2
+```
+
+Later, you could use the **Property** parameter of `New-Object` to pass a
+**Hashtable** containing the members and values. For example:
+
+```powershell
+PS> $object2 = New-Object -TypeName psobject -Property @{one=1; two=2}
+PS> $object2 | Get-Member
+
+ TypeName: System.Management.Automation.PSCustomObject
+
+Name MemberType Definition
+---- ---------- ----------
+Equals Method bool Equals(System.Object obj)
+GetHashCode Method int GetHashCode()
+GetType Method type GetType()
+ToString Method string ToString()
+one NoteProperty int one=1
+two NoteProperty int two=2
+
+PS> $object2
+
+one two
+--- ---
+ 1 2
+```
+
+Since PowerShell 3.0, casting a **Hashtable** to `[pscustomobject]` achieves
+the same result.
+
+```powershell
+PS> $object3 = [pscustomobject]@{one=1; two=2}
+PS> $object3 | Get-Member
+
+ TypeName: System.Management.Automation.PSCustomObject
+
+Name MemberType Definition
+---- ---------- ----------
+Equals Method bool Equals(System.Object obj)
+GetHashCode Method int GetHashCode()
+GetType Method type GetType()
+ToString Method string ToString()
+one NoteProperty int one=1
+two NoteProperty int two=2
+
+PS> $object3
+
+one two
+--- ---
+ 1 2
+```
+
+## Understanding the type accelerators
+
+`[psobject]` and `[pscustomobject]` are type accelerators.
+
+For more information, see [about_Type_Accelerators](about_type_accelerators.md).
+
+Even though you might think that `[pscustomobject]` should map to
+**System.Management.Automation.PSCustomObject**, the types are different.
+
+```powershell
+PS> [pscustomobject] -eq [System.Management.Automation.PSCustomObject]
+False
+```
+
+Both type accelerators are mapped to the same class, **PSObject**:
+
+```powershell
+PS> [pscustomobject]
+
+IsPublic IsSerial Name BaseType
+-------- -------- ---- --------
+True True PSObject System.Object
+
+PS> [psobject]
+
+IsPublic IsSerial Name BaseType
+-------- -------- ---- --------
+True True PSObject System.Object
+```
+
+When the `[pscustomobject]` type accelerator was added, it included extra code
+to handle conversion of **Hashtable** objects. This extra code is only invoked
+when a new object is being created. Therefore, you can't use
+`[pscustomobject]` for type coercion or type comparison, because all objects
+are treated as a **PSObject** types.
+
+For example, using the `-is` operator to check that an object returned by a
+cmdlet is a `[pscustomobject]` is the same as comparing it to `[psobject]`.
+
+```powershell
+PS> (Get-Item /) -is [pscustomobject]
+True
+
+PS> (Get-Item /) -is [psobject]
+True
+```
+
+When you cast any object to `[psobject]` you get the type of the original
+object. Therefore, casting anything other than a **Hashtable** to
+`[pscustomobject]` results in the same type.
+
+```powershell
+PS> ([PSObject]@{Property = 'Value'}).GetType().FullName
+System.Collections.Hashtable
+
+PS> ([pscustomobject]123).GetType().Name
+Int32
+
+PS> ([PSCustomObject]@{Property = 'Value'}).GetType().FullName
+System.Management.Automation.PSCustomObject
+```
+
+## See also
+
+- [about_Object_Creation](about_Object_Creation.md)
+- [about_Objects](about_Objects.md)
+- [System.Management.Automation.PSObject](xref:System.Management.Automation.PSObject)
+- [System.Management.Automation.PSCustomObject](xref:System.Management.Automation.PSCustomObject)
Microsoft.PowerShell.Core About Pscustomobject (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/Microsoft.PowerShell.Core/About/about_PSCustomObject.md
+---
+description: Explains the differences between PSObject and PSCustomObject.
+Locale: en-US
Last updated : 08/10/2021
+online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_pscustomobject?view=powershell-7.2&WT.mc_id=ps-gethelp
+schema: 2.0.0
+ Title: about PSCustomObject
+---
+# about_PSCustomObject
+
+## Short description
+Explains the differences between **PSObject** and **PSCustomObject**.
+
+## Long description
+
+The `[pscustomobject]` type accelerator was added in PowerShell 4.0.
+
+Prior to adding this type accelerator, creating an object with member
+properties and values was more complicated. Originally, you had to use
+`New-Object` to create the object and `Add-Member` to add properties. For
+example:
+
+```powershell
+PS> $object1 = New-Object -TypeName psobject
+PS> Add-Member -InputObject $object1 -MemberType NoteProperty -Name one -Value 1
+PS> Add-Member -InputObject $object1 -MemberType NoteProperty -Name two -Value 2
+PS> $object1 | Get-Member
+
+ TypeName: System.Management.Automation.PSCustomObject
+
+Name MemberType Definition
+---- ---------- ----------
+Equals Method bool Equals(System.Object obj)
+GetHashCode Method int GetHashCode()
+GetType Method type GetType()
+ToString Method string ToString()
+one NoteProperty int one=1
+two NoteProperty int two=2
+
+PS> $object1
+
+one two
+--- ---
+ 1 2
+```
+
+Later, you could use the **Property** parameter of `New-Object` to pass a
+**Hashtable** containing the members and values. For example:
+
+```powershell
+PS> $object2 = New-Object -TypeName psobject -Property @{one=1; two=2}
+PS> $object2 | Get-Member
+
+ TypeName: System.Management.Automation.PSCustomObject
+
+Name MemberType Definition
+---- ---------- ----------
+Equals Method bool Equals(System.Object obj)
+GetHashCode Method int GetHashCode()
+GetType Method type GetType()
+ToString Method string ToString()
+one NoteProperty int one=1
+two NoteProperty int two=2
+
+PS> $object2
+
+one two
+--- ---
+ 1 2
+```
+
+Since PowerShell 3.0, casting a **Hashtable** to `[pscustomobject]` achieves
+the same result.
+
+```powershell
+PS> $object3 = [pscustomobject]@{one=1; two=2}
+PS> $object3 | Get-Member
+
+ TypeName: System.Management.Automation.PSCustomObject
+
+Name MemberType Definition
+---- ---------- ----------
+Equals Method bool Equals(System.Object obj)
+GetHashCode Method int GetHashCode()
+GetType Method type GetType()
+ToString Method string ToString()
+one NoteProperty int one=1
+two NoteProperty int two=2
+
+PS> $object3
+
+one two
+--- ---
+ 1 2
+```
+
+## Understanding the type accelerators
+
+`[psobject]` and `[pscustomobject]` are type accelerators.
+
+For more information, see [about_Type_Accelerators](about_type_accelerators.md).
+
+Even though you might think that `[pscustomobject]` should map to
+**System.Management.Automation.PSCustomObject**, the types are different.
+
+```powershell
+PS> [pscustomobject] -eq [System.Management.Automation.PSCustomObject]
+False
+```
+
+Both type accelerators are mapped to the same class, **PSObject**:
+
+```powershell
+PS> [pscustomobject]
+
+IsPublic IsSerial Name BaseType
+-------- -------- ---- --------
+True True PSObject System.Object
+
+PS> [psobject]
+
+IsPublic IsSerial Name BaseType
+-------- -------- ---- --------
+True True PSObject System.Object
+```
+
+When the `[pscustomobject]` type accelerator was added, it included extra code
+to handle conversion of **Hashtable** objects. This extra code is only invoked
+when a new object is being created. Therefore, you can't use
+`[pscustomobject]` for type coercion or type comparison, because all objects
+are treated as a **PSObject** types.
+
+For example, using the `-is` operator to check that an object returned by a
+cmdlet is a `[pscustomobject]` is the same as comparing it to `[psobject]`.
+
+```powershell
+PS> (Get-Item /) -is [pscustomobject]
+True
+
+PS> (Get-Item /) -is [psobject]
+True
+```
+
+When you cast any object to `[psobject]` you get the type of the original
+object. Therefore, casting anything other than a **Hashtable** to
+`[pscustomobject]` results in the same type.
+
+```powershell
+PS> ([PSObject]@{Property = 'Value'}).GetType().FullName
+System.Collections.Hashtable
+
+PS> ([pscustomobject]123).GetType().Name
+Int32
+
+PS> ([PSCustomObject]@{Property = 'Value'}).GetType().FullName
+System.Management.Automation.PSCustomObject
+```
+
+## See also
+
+- [about_Object_Creation](about_Object_Creation.md)
+- [about_Objects](about_Objects.md)
+- [System.Management.Automation.PSObject](xref:System.Management.Automation.PSObject)
+- [System.Management.Automation.PSCustomObject](xref:System.Management.Automation.PSCustomObject)
dev-cross-plat Using Vscode https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/docs-conceptual/dev-cross-plat/vscode/using-vscode.md
--- Title: Using Visual Studio Code for PowerShell Development description: Using Visual Studio Code for PowerShell Development Previously updated : 11/07/2019 Last updated : 08/12/2021 --- # Using Visual Studio Code for PowerShell Development
-[Visual Studio Code][vscode] is a cross-platform script editor by Microsoft. Together with the
-[PowerShell extension][psext], it provides a rich and interactive script editing experience, making
-it easier to write reliable PowerShell scripts. Visual Studio Code with the PowerShell extension is
-the recommended editor for writing PowerShell scripts.
+[Visual Studio Code][vscode] (VS Code) is a cross-platform script editor by Microsoft. Together with
+the [PowerShell extension][psext], it provides a rich and interactive script editing experience,
+making it easier to write reliable PowerShell scripts. Visual Studio Code with the PowerShell
+extension is the recommended editor for writing PowerShell scripts.
It supports the following PowerShell versions: -- PowerShell 7 and up (Windows, macOS, and Linux)-- PowerShell Core 6 (Windows, macOS, and Linux)
+- PowerShell 7.0 and higher (Windows, macOS, and Linux)
- Windows PowerShell 5.1 (Windows-only) > [!NOTE]
For traditional Windows PowerShell workloads, see [Installing Windows PowerShell
> [!IMPORTANT] > The [Windows PowerShell ISE][ise] is still available for Windows. However, it is no longer in
-> active feature development. The ISE does not work with PowerShell 6 and higher. As a component of
+> active feature development. The ISE only works with PowerShell 5.1 and older. As a component of
> Windows, it continues to be officially supported for security and high-priority servicing fixes. > We have no plans to remove the ISE from Windows.
-## Editing with Visual Studio Code
+## Install VS Code and the PowerShell Extension
1. Install Visual Studio Code. For more information, see the overview [Setting up Visual Studio Code][vsc-setup]. There are installation instructions for each platform:
- - **Windows**: follow the installation instructions on the
- [Running Visual Studio Code on Windows][vsc-setup-win] page.
- - **macOS**: follow the installation instructions on the
- [Running Visual Studio Code on macOS][vsc-setup-macOS] page.
- - **Linux**: follow the installation instructions on the
- [Running Visual Studio Code on Linux][vsc-setup-linux] page.
+ - [Running Visual Studio Code on Windows][vsc-setup-win]
+ - [Running Visual Studio Code on macOS][vsc-setup-macOS]
+ - [Running Visual Studio Code on Linux][vsc-setup-linux]
1. Install the PowerShell Extension.
- 1. Launch the Visual Studio Code app by typing `code` in a console or `code-insiders`
- if you installed Visual Studio Code Insiders.
+ 1. Launch the VS Code app by typing `code` in a console or `code-insiders` if you installed
+ Visual Studio Code Insiders.
1. Launch **Quick Open** on Windows or Linux by pressing <kbd>Ctrl</kbd>+<kbd>P</kbd>. On macOS, press <kbd>Cmd</kbd>+<kbd>P</kbd>. 1. In Quick Open, type `ext install powershell` and press **Enter**. 1. The **Extensions** view opens on the Side Bar. Select the PowerShell extension from Microsoft.
- You should see a Visual Studio Code screen similar to the following image:
-
- ![Visual Studio Code - view of the PowerShell extension](media/using-vscode/vscode.png)
- 1. Click the **Install** button on the PowerShell extension from Microsoft.
- 1. After the install, if you see the **Install** button turn into **Reload**, Click on **Reload**.
- 1. After Visual Studio Code has reloaded, you're ready for editing.
+ 1. After the install, if you see the **Install** button turn into **Reload**, Click on
+ **Reload**.
+ 1. After VS Code has reloaded, you're ready for editing.
For example, to create a new file, click **File > New**. To save it, click **File > Save** and then provide a file name, such as `HelloWorld.ps1`. To close the file, click the `X` next to the file
-name. To exit Visual Studio Code, **File > Exit**.
+name. To exit VS Code, **File > Exit**.
### Installing the PowerShell Extension on Restricted Systems
Language server startup failed.
``` This problem can occur when PowerShell's execution policy is set by Windows Group Policy. To
-manually approve PowerShell Editor Services and the PowerShell extension for Visual Studio Code,
-open a PowerShell prompt and run the following command:
+manually approve PowerShell Editor Services and the PowerShell extension for VS Code, open a
+PowerShell prompt and run the following command:
```powershell Import-Module $HOME\.vscode\extensions\ms-vscode.powershell*\modules\PowerShellEditorServices\PowerShellEditorServices.psd1 ``` You're prompted with **Do you want to run software from this untrusted publisher?** Type `A` to run
-the file. Then, open Visual Studio Code and check that the PowerShell extension is functioning
-properly. If you still have problems getting started, let us know on [GitHub issues][ghi].
-
-> [!NOTE]
-> The PowerShell extension for Visual Studio Code does not support running in constrained language
-> mode. For more information, see [GitHub issue #606][i606].
+the file. Then, open VS Code and check that the PowerShell extension is functioning properly. If you
+still have problems getting started, let us know on [GitHub issues][ghi].
### Choosing a version of PowerShell to use with the extension
-With PowerShell Core installing side-by-side with Windows PowerShell, it's now possible to use a
-specific version of PowerShell with the PowerShell extension. This feature looks at a few well-known
-paths on different operating systems to discover installations of PowerShell.
+With PowerShell installing side-by-side with Windows PowerShell, it's now possible to use a specific
+version of PowerShell with the PowerShell extension. This feature looks at a few well-known paths on
+different operating systems to discover installations of PowerShell.
Use the following steps to choose the version:
Use the following steps to choose the version:
1. Choose the version of PowerShell you want to use from the list, for example: **PowerShell Core**. If you installed PowerShell to a non-typical location, it might not show up initially in the Session
-Menu. You can extend the session menu by [adding your own custom paths](#adding-your-own-powershell-paths-to-the-session-menu)
-as described below.
+Menu. You can extend the session menu by
+[adding your own custom paths](#adding-your-own-powershell-paths-to-the-session-menu) as described
+below.
> [!NOTE] > The PowerShell session menu can also be accessed from the green version number in the bottom right
as described below.
## Configuration settings for Visual Studio Code
-First, if you're not familiar with how to change settings in Visual Studio Code, we recommend
-reading [Visual Studio Code's settings][vsc-settings] documentation.
+First, if you're not familiar with how to change settings in VS Code, we recommend reading
+[Visual Studio Code's settings][vsc-settings] documentation.
After reading the documentation, you can add configuration settings in `settings.json`.
After reading the documentation, you can add configuration settings in `settings
} ```
-If you don't want these settings to affect all files types, Visual Studio Code also allows
-per-language configurations. Create a language-specific setting by putting settings in a
-`[<language-name>]` field. For example:
+If you don't want these settings to affect all files types, VS Code also allows per-language
+configurations. Create a language-specific setting by putting settings in a `[<language-name>]`
+field. For example:
```json {
per-language configurations. Create a language-specific setting by putting setti
``` > [!TIP]
-> For more information about file encoding in Visual Studio Code, see [Understanding file encoding][file-encoding].
->
-> Also, check out [How to replicate the ISE experience in Visual Studio Code][vsc-ise] for other
-> tips on how to configure Visual Studio Code for PowerShell editing.
+> For more information about file encoding in VS Code, see
+> [Understanding file encoding][file-encoding]. Also, check out
+> [How to replicate the ISE experience in VS Code][vsc-ise] for other tips on how to configure VS
+> Code for PowerShell editing.
### Adding your own PowerShell paths to the session menu
text displayed in the session menu (also known as the `versionName`):
} ```
-After you've configured this setting, restart Visual Studio Code or to reload the current Visual
-Studio Code window from the **Command Palette**, type **Developer: Reload Window**.
+After you've configured this setting, restart VS Code or to reload the current VS Code window from
+the **Command Palette**, type `Developer: Reload Window`.
If you open the session menu, you now see your additional PowerShell versions!
If you open the session menu, you now see your additional PowerShell versions!
> If you build PowerShell from source, this is a great way to test out your local build of > PowerShell.
-### Using an older version of the PowerShell Extension for Windows PowerShell v3 and v4
-
-The current PowerShell extension doesn't support [PowerShell v3 and v4][i1310]. However, you can
-use the last version of the extension that supports PowerShell v3 and v4.
-
-> [!CAUTION]
-> There will be no additional fixes to this older version of the extension. It's provided "AS IS"
-> but is available for you if you are still using Windows PowerShell v3 and Windows PowerShell v4.
-
-First, open the Extension pane and search for `PowerShell`. Then click the gear and select
-**Install another version...**.
-
-![Menu item - Install another version...](media/using-vscode/install-another-version.png)
-
-Then select the **2020.1.0** version. This version of the extension was the last version to
-support v3 and v4. Be sure to add the following setting so that your extension version doesn't
-update automatically:
-
-```json
-{
- "extensions.autoUpdate": false
-}
-```
-
-Version **2020.1.0** will work for the foreseeable future. However, Visual Studio Code could
-implement a change that breaks this version of the extension. Because of this, and lack of support,
-we recommend:
--- Upgrading to Windows PowerShell 5.1-- Install PowerShell 7, which is a side-by-side install to Windows PowerShell and works the
- best with the PowerShell extension
- ## Debugging with Visual Studio Code ### No-workspace debugging
-In Visual Studio Code version 1.9 (or higher), you can debug PowerShell scripts without opening the
-folder that contains the PowerShell script.
+In VS Code version 1.9 (or higher), you can debug PowerShell scripts without opening the folder that
+contains the PowerShell script.
1. Open the PowerShell script file with **File > Open File...** 1. Set a breakpoint - select a line then press <kbd>F9</kbd> 1. Press <kbd>F5</kbd> to start debugging
-You should see the Debug actions pane appear which allows you to break into the debugger,
-step, resume, and stop debugging.
+You should see the Debug actions pane appear which allows you to break into the debugger, step,
+resume, and stop debugging.
### Workspace debugging
Follow these steps to create a debug configuration file:
- **Interactive Session** - Debug commands executed from the Integrated Console - **Attach** - Attach the debugger to a running PowerShell Host Process
-Visual Studio Code creates a directory and a file `.vscode\launch.json` in the root of your
-workspace folder to store the debug configuration. If your files are in a Git repository, you
-typically want to commit the `launch.json` file. The contents of the `launch.json` file are:
+VS Code creates a directory and a file `.vscode\launch.json` in the root of your workspace folder to
+store the debug configuration. If your files are in a Git repository, you typically want to commit
+the `launch.json` file. The contents of the `launch.json` file are:
```json {
typically want to commit the `launch.json` file. The contents of the `launch.jso
This file represents the common debug scenarios. When you open this file in the editor, you see an **Add Configuration...** button. You can click this button to add more PowerShell debug configurations. One useful configuration to add is **PowerShell: Launch Script**. With this
-configuration, you can specify a file containing optional arguments that are used whenever you
-press <kbd>F5</kbd> no matter which file is active in the editor.
+configuration, you can specify a file containing optional arguments that are used whenever you press
+<kbd>F5</kbd> no matter which file is active in the editor.
After the debug configuration is established, you can select which configuration you want to use during a debug session. Select a configuration from the debug configuration drop-down in the **Debug** view's toolbar.
-## Troubleshooting the PowerShell extension for Visual Studio Code
+## Troubleshooting the PowerShell extension
-If you experience any issues using Visual Studio Code for PowerShell script development, see the
+If you experience any issues using VS Code for PowerShell script development, see the
[troubleshooting guide][troubleshooting] on GitHub. ## Useful resources There are a few videos and blog posts that may be helpful to get you started using the PowerShell
-extension for Visual Studio Code:
+extension for VS Code:
### Videos
If you're interested in contributing, Pull Requests are greatly appreciated. Fol
<!-- issues --> [ghi]: https://github.com/PowerShell/vscode-powershell/issues
-[i1310]: https://github.com/PowerShell/vscode-powershell/issues/1310
-[i606]: https://github.com/PowerShell/vscode-powershell/issues/606
<!-- product links --> [vsent]: https://visualstudio.microsoft.com/