Skip to content

Commit 6001b29

Browse files
committed
[PowerShell] Reviewing and updating all PowrShell articles due to new release
1 parent c1270ab commit 6001b29

15 files changed

Lines changed: 152 additions & 148 deletions

docs/powershell/download-sql-server-ps-module.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
title: Download SQL Server PowerShell Module
3-
description: Learn how to install the SqlServer PowerShell module, which provides cmdlets that support the latest SQL features, and also contains updated versions of the cmdlets in the SQLPS module.
3+
description: Learn how to install the SqlServer PowerShell module, which provides cmdlets that support the latest SQL features, and also contains updated versions of the cmdlets in the SQLPS module.
44
ms.prod: sql
55
ms.technology: sql-server-powershell
66
ms.topic: conceptual
77
author: markingmyname
88
ms.author: maghan
9-
ms.reviewer: matteot, aanelson
9+
ms.reviewer: matteot, drskwier
1010
ms.custom: ""
11-
ms.date: 06/11/2020
11+
ms.date: 10/14/2020
1212
---
1313

1414
# Install the SQL Server PowerShell module
@@ -120,7 +120,7 @@ If you run into problems installing, see the [Install-Module documentation](http
120120
To use a specific version of the module, import it with a specific version number similar to the following command:
121121

122122
```powershell
123-
Import-Module SqlServer -Version 21.1.18080
123+
Import-Module SqlServer -Version 21.1.18218
124124
```
125125

126126
## Pre-release versions of the SqlServer module
@@ -145,7 +145,7 @@ To install a specific pre-release version of the module, install it with a speci
145145
You can try to use the following command:
146146

147147
```powershell
148-
Install-Module SqlServer -RequiredVersion 21.1.18040-preview -AllowPrerelease
148+
Install-Module SqlServer -RequiredVersion 21.1.18218-preview -AllowPrerelease
149149
```
150150

151151
## SQL Server PowerShell on Linux
@@ -160,4 +160,5 @@ Visit [Manage SQL Server on Linux with PowerShell Core](../linux/sql-server-linu
160160

161161
## Next steps
162162

163-
[SQL Server PowerShell](sql-server-powershell.md)
163+
- [SQL Server PowerShell](sql-server-powershell.md)
164+
- [Use PowerShell with Azure Data Studio](../azure-data-studio/extensions/powershell-extension.md)
Lines changed: 61 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,78 @@
11
---
2-
title: "Encode and Decode SQL Server Identifiers | Microsoft Docs"
2+
title: Encode and Decode SQL Server Identifiers
33
description: Some characters that can appear in SQL Server-delimited identifiers are not supported in Windows PowerShell paths. Learn how to include them by representing them with their hexadecimal values.
4-
ms.custom: ""
5-
ms.date: "03/14/2017"
64
ms.prod: sql
7-
ms.reviewer: ""
85
ms.technology: sql-server-powershell
96
ms.topic: conceptual
107
ms.assetid: bb9fe0d3-e432-42d3-b324-64dc908b544a
118
author: markingmyname
129
ms.author: maghan
10+
ms.reviewer: matteot, drskwier
11+
ms.custom: ""
12+
ms.date: 10/14/2020
1313
---
14+
1415
# Encode and Decode SQL Server Identifiers
16+
1517
[!INCLUDE[SQL Server Azure SQL Database Synapse Analytics PDW ](../includes/applies-to-version/sql-asdb-asdbmi-asa-pdw.md)]
1618

17-
SQL Server-delimited identifiers sometimes contain characters not supported in Windows PowerShell paths. These characters can be specified by encoding their hexadecimal values.
19+
SQL Server-delimited identifiers sometimes contain characters not supported in Windows PowerShell paths. These characters can be specified by encoding their hexadecimal values.
1820

1921
> [!NOTE]
20-
> There are two SQL Server PowerShell modules; **SqlServer** and **SQLPS**. The **SQLPS** module is included with the SQL Server installation (for backwards compatibility), but is no longer being updated. The most up-to-date PowerShell module is the **SqlServer** module. The **SqlServer** module contains updated versions of the cmdlets in **SQLPS**, and also includes new cmdlets to support the latest SQL features.
22+
> There are two SQL Server PowerShell modules; **SqlServer** and **SQLPS**. The **SQLPS** module is included with the SQL Server installation (for backwards compatibility), but is no longer being updated. The most up-to-date PowerShell module is the **SqlServer** module. The **SqlServer** module contains updated versions of the cmdlets in **SQLPS**, and also includes new cmdlets to support the latest SQL features.
2123
> Previous versions of the **SqlServer** module *were* included with SQL Server Management Studio (SSMS), but only with the 16.x versions of SSMS. To use PowerShell with SSMS 17.0 and later, the **SqlServer** module must be installed from the PowerShell Gallery.
2224
> To install the **SqlServer** module, see [Install SQL Server PowerShell](download-sql-server-ps-module.md).
23-
24-
25-
Characters that are not supported in Windows PowerShell path names can be represented, or encoded, as the "%" character followed by the hexadecimal value for the bit pattern that represents the character, as in "**%**xx". Encoding can always be used to handle characters that are not supported in Windows PowerShell paths.
26-
27-
The **Encode-SqlName** cmdlet takes as input a [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)] identifier. It outputs a string with all the characters that are not supported by the Windows PowerShell language encoded with "%xx". The **Decode-SqlName** cmdlet takes as input an encoded [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)] identifier and returns the original identifier.
28-
29-
## <a name="LimitationsRestrictions"></a> Limitations and Restrictions
30-
The **Encode-Sqlname** and **Decode-Sqlname** cmdlets only encode or decode the characters that are allowed in SQL Server-delimited identifiers, but are not supported in PowerShell paths. The following are the characters encoded by **Encode-SqlName** and decoded by **Decode-SqlName**:
31-
32-
|||||||||||||
33-
|-|-|-|-|-|-|-|-|-|-|-|-|
25+
26+
Characters that are not supported in Windows PowerShell path names can be represented, or encoded, as the "%" character followed by the hexadecimal value for the bit pattern that represents the character, as in "**%**xx". Encoding can always be used to handle characters that are not supported in Windows PowerShell paths.
27+
28+
The **Encode-SqlName** cmdlet takes as input a [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)] identifier. It outputs a string with all the characters that are not supported by the Windows PowerShell language encoded with "%xx". The **Decode-SqlName** cmdlet takes as input an encoded [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)] identifier and returns the original identifier.
29+
30+
## Limitations and Restrictions
31+
32+
The **Encode-Sqlname** and **Decode-Sqlname** cmdlets only encode or decode the characters that are allowed in SQL Server-delimited identifiers, but are not supported in PowerShell paths. The following are the characters encoded by **Encode-SqlName** and decoded by **Decode-SqlName**:
33+
34+
|||||||||||||
35+
|-|-|-|-|-|-|-|-|-|-|-|-|
3436
|**Character**|\ |/|:|%|\<|>|*|?|[|]|&#124;|
35-
|**Hexadecimal Encoding**|%5C|%2F|%3A|%25|%3C|%3E|%2A|%3F|%5B|%5D|%7C|
36-
37-
## <a name="EncodeIdent"></a> Encoding an Identifier
38-
**To encode a SQL Server identifier in a PowerShell path**
39-
40-
- Use one of two methods to encode a SQL Server identifier:
41-
42-
- Specify the hexadecimal code for the unsupported character using the syntax %XX, where XX is the hexadecimal code.
43-
44-
- Pass the identifier as a quoted string to the **Encode-Sqlname** cmdlet
45-
46-
### Examples (Encoding)
47-
This example specifies the encoded version of the ":" character (%3A):
48-
49-
```
50-
Set-Location Table%3ATest
51-
```
52-
53-
Alternatively, you can use **Encode-SqlName** to build a name supported by Windows PowerShell:
54-
55-
```
56-
Set-Location (Encode-SqlName "Table:Test")
57-
```
58-
59-
## <a name="DecodeIdent"></a> Decoding an Identifier
60-
**To decode a SQL Server identifier from a PowerShell path**
61-
62-
Use the **Decode-Sqlname** cmdlet to replace the hexadecimal encodings with the characters represented by the encoding.
63-
64-
### Examples (Decoding)
65-
This example returns "Table:Test":
66-
67-
```
68-
Decode-SqlName "Table%3ATest"
69-
```
70-
71-
## See Also
72-
[SQL Server Identifiers in PowerShell](sql-server-identifiers-in-powershell.md)
73-
[SQL Server PowerShell Provider](sql-server-powershell-provider.md)
74-
[SQL Server PowerShell](sql-server-powershell.md)
75-
76-
37+
|**Hexadecimal Encoding**|%5C|%2F|%3A|%25|%3C|%3E|%2A|%3F|%5B|%5D|%7C|
38+
39+
## Encoding an Identifier
40+
41+
**To encode a SQL Server identifier in a PowerShell path**
42+
43+
- Use one of two methods to encode a SQL Server identifier:
44+
- Specify the hexadecimal code for the unsupported character using the syntax %XX, where XX is the hexadecimal code.
45+
- Pass the identifier as a quoted string to the **Encode-Sqlname** cmdlet
46+
47+
### Examples (Encoding)
48+
This example specifies the encoded version of the ":" character (%3A):
49+
50+
```powershell
51+
Set-Location Table%3ATest
52+
```
53+
54+
Alternatively, you can use **Encode-SqlName** to build a name supported by Windows PowerShell:
55+
56+
```powershell
57+
Set-Location (Encode-SqlName "Table:Test")
58+
```
59+
60+
## <a name="DecodeIdent"></a> Decoding an Identifier
61+
62+
**To decode a SQL Server identifier from a PowerShell path**
63+
64+
Use the **Decode-Sqlname** cmdlet to replace the hexadecimal encodings with the characters represented by the encoding.
65+
66+
### Examples (Decoding)
67+
68+
This example returns "Table:Test":
69+
70+
```powershell
71+
Decode-SqlName "Table%3ATest"
72+
```
73+
74+
## See Also
75+
76+
- [SQL Server Identifiers in PowerShell](sql-server-identifiers-in-powershell.md)
77+
- [SQL Server PowerShell Provider](sql-server-powershell-provider.md)
78+
- [SQL Server PowerShell](sql-server-powershell.md)
Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,46 @@
11
---
22
title: "Escape SQL Server Identifiers | Microsoft Docs"
3-
description: Some characters that can appear in SQL Server-delimited identifiers are not supported in Windows PowerShell paths. Learn how some of these can be escaped with the back-tick character.
4-
ms.custom: ""
5-
ms.date: "03/14/2017"
3+
description: Some characters that can appear in SQL Server-delimited identifiers aren't supported in Windows PowerShell paths. Learn how some of these can be escaped with the back-tick character.
64
ms.prod: sql
7-
ms.reviewer: ""
85
ms.technology: sql-server-powershell
96
ms.topic: conceptual
107
ms.assetid: 8a73e945-daa6-4e5d-93da-10f000f1f3a2
118
author: markingmyname
129
ms.author: maghan
10+
ms.reviewer: matteot, drskwier
11+
ms.custom: ""
12+
ms.date: 10/14/2020
1313
---
14+
1415
# Escape SQL Server Identifiers
16+
1517
[!INCLUDE[SQL Server Azure SQL Database Synapse Analytics PDW ](../includes/applies-to-version/sql-asdb-asdbmi-asa-pdw.md)]
1618

17-
You can often use the back-tick escape character (`) to escape characters that are allowed in [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)] delimited identifiers but not Windows PowerShell path names. Some characters, however, cannot be escaped. For example, you cannot escape the colon character (:) in Windows PowerShell. Identifiers with that character must be encoded. Encoding is more reliable than escaping because encoding works for all characters.
19+
You can often use the back-tick escape character (`) to escape characters that are allowed in [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)] delimited identifiers but not Windows PowerShell path names. Some characters, however, cannot be escaped. For example, you can't escape the colon character (:) in Windows PowerShell. Identifiers with that character must be encoded. Encoding is more reliable than escaping because encoding works for all characters.
1820

1921
> [!NOTE]
2022
> There are two SQL Server PowerShell modules; **SqlServer** and **SQLPS**. The **SQLPS** module is included with the SQL Server installation (for backwards compatibility), but is no longer being updated. The most up-to-date PowerShell module is the **SqlServer** module. The **SqlServer** module contains updated versions of the cmdlets in **SQLPS**, and also includes new cmdlets to support the latest SQL features.
2123
> Previous versions of the **SqlServer** module *were* included with SQL Server Management Studio (SSMS), but only with the 16.x versions of SSMS. To use PowerShell with SSMS 17.0 and later, the **SqlServer** module must be installed from the PowerShell Gallery.
2224
> To install the **SqlServer** module, see [Install SQL Server PowerShell](download-sql-server-ps-module.md).
2325
2426
The back-tick character (`) is usually on the key in the upper left of the keyboard, under the ESC key.
25-
26-
## Examples
27-
This is an example of escaping a # character:
28-
29-
```
27+
28+
## Examples
29+
30+
This is an example of escaping a # character:
31+
32+
```powershell
3033
cd SQLSERVER:\SQL\MyComputer\MyInstance\MyDatabase\MySchema\`#MyTempTable
31-
```
32-
33-
This is an example of escaping the parenthesis when specifying (local) as a computer name:
34-
35-
```
34+
```
35+
36+
This is an example of escaping the parenthesis when specifying (local) as a computer name:
37+
38+
```powershell
3639
Set-Location SQLSERVER:\SQL\`(local`)\DEFAULT
37-
```
38-
39-
## See Also
40-
[SQL Server Identifiers in PowerShell](sql-server-identifiers-in-powershell.md)
41-
[SQL Server PowerShell Provider](sql-server-powershell-provider.md)
42-
[SQL Server PowerShell](sql-server-powershell.md)
43-
44-
40+
```
41+
42+
## See Also
43+
44+
- [SQL Server Identifiers in PowerShell](sql-server-identifiers-in-powershell.md)
45+
- [SQL Server PowerShell Provider](sql-server-powershell-provider.md)
46+
- [SQL Server PowerShell](sql-server-powershell.md)

docs/powershell/how-to-enable-tcp-sqlps.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,6 @@ ms.date: 08/06/2020
8888
Restart-Service -Name MSSQLSERVER -Force
8989
```
9090

91-
92-
93-
94-
9591
## Next steps
9692

9793
- [Install the SQL Server PowerShell module](download-sql-server-ps-module.md)

docs/powershell/load-the-smo-assemblies-in-windows-powershell.md

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
---
2-
title: "Load the SMO Assemblies in Windows PowerShell | Microsoft Docs"
2+
title: Load the SMO Assemblies in Windows PowerShell
33
description: Learn how to load the SQL Server Management Object (SMO) assemblies in Windows PowerShell scripts that do not use the SQL Server PowerShell provider.
4-
ms.custom: ""
5-
ms.date: "03/14/2017"
64
ms.prod: sql
7-
ms.reviewer: ""
85
ms.technology: sql-server-powershell
96
ms.topic: conceptual
107
ms.assetid: 8ca42b69-da5a-47f4-9085-34e443f0e389
118
author: markingmyname
129
ms.author: maghan
10+
ms.reviewer: matteot, drskwier
11+
ms.custom: ""
12+
ms.date: 10/14/2020
1313
---
14+
1415
# Load the SMO Assemblies in Windows PowerShell
16+
1517
[!INCLUDE[SQL Server Azure SQL Database Synapse Analytics PDW ](../includes/applies-to-version/sql-asdb-asdbmi-asa-pdw.md)]
1618

1719
This article describes how to load the SQL Server Management Object (SMO) assemblies in Windows PowerShell scripts that do not use the SQL Server PowerShell provider.
18-
20+
1921
> [!NOTE]
2022
> There are two SQL Server PowerShell modules; **SqlServer** and **SQLPS**. The **SQLPS** module is included with the SQL Server installation (for backwards compatibility), but is no longer being updated. The most up-to-date PowerShell module is the **SqlServer** module. The **SqlServer** module contains updated versions of the cmdlets in **SQLPS**, and also includes new cmdlets to support the latest SQL features.
2123
> Previous versions of the **SqlServer** module *were* included with SQL Server Management Studio (SSMS), but only with the 16.x versions of SSMS. To use PowerShell with SSMS 17.0 and later, the **SqlServer** module must be installed from the PowerShell Gallery.
2224
> To install the **SqlServer** module, see [Install SQL Server PowerShell](download-sql-server-ps-module.md).
2325
24-
2526
The preferred mechanism for loading the SMO assemblies is to load the **SqlServer** module. The [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)] provider included in the module automatically loads the SMO assemblies, and also implements features that extend the usefulness of the SMO objects in PowerShell scripts.
26-
27+
2728
There are two cases where you may need to load the SMO assemblies directly:
28-
29-
- If your script references a SMO object before the first command that references the provider or cmdlets from the [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)] snap-ins.
30-
31-
- You want to port SMO code from another language, such as C# or Visual Basic, which does not use the provider or cmdlets.
32-
33-
## Example: Loading the SQL Server Management Objects
34-
The following code loads the SMO assemblies:
35-
36-
```
37-
#
29+
30+
- If your script references a SMO object before the first command that references the provider or cmdlets from the [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)] snap-ins.
31+
32+
- You want to port SMO code from another language, such as C# or Visual Basic, which does not use the provider or cmdlets.
33+
34+
## Example: Loading the SQL Server Management Objects
35+
36+
The following code loads the SMO assemblies:
37+
38+
```powershell
3839
# Loads the SQL Server Management Objects (SMO)
39-
#
40-
40+
4141
$ErrorActionPreference = "Stop"
4242
4343
$sqlpsreg="HKLM:\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.SqlServer.Management.PowerShell.sqlps"
@@ -52,7 +52,7 @@ else
5252
$sqlpsPath = [System.IO.Path]::GetDirectoryName($item.Path)
5353
}
5454
55-
$assemblylist =
55+
$assemblylist =
5656
"Microsoft.SqlServer.Management.Common",
5757
"Microsoft.SqlServer.Smo",
5858
"Microsoft.SqlServer.Dmf ",
@@ -82,11 +82,10 @@ foreach ($asm in $assemblylist)
8282
8383
Push-Location
8484
cd $sqlpsPath
85-
update-FormatData -prependpath SQLProvider.Format.ps1xml
85+
update-FormatData -prependpath SQLProvider.Format.ps1xml
8686
Pop-Location
87-
```
88-
89-
## See Also
90-
[SQL Server PowerShell](sql-server-powershell.md)
91-
92-
87+
```
88+
89+
## See Also
90+
91+
- [SQL Server PowerShell](sql-server-powershell.md)

0 commit comments

Comments
 (0)