Skip to content

Commit 0a0495d

Browse files
committed
Added links to cmdlets and updated links
1 parent 6001b29 commit 0a0495d

9 files changed

Lines changed: 187 additions & 164 deletions

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,13 @@ Visit [Manage SQL Server on Linux with PowerShell Core](../linux/sql-server-linu
158158

159159
- [SqlServerDsc](https://www.powershellgallery.com/packages/SqlServerDsc/) - Module with DSC resources for deployment and configuration of Microsoft SQL Server.
160160

161+
## Cmdlet reference
162+
163+
- [SqlServer cmdlets](https://docs.microsoft.com/powershell/module/sqlserver)
164+
- [SQLPS cmdlets](https://docs.microsoft.com/powershell/module/sqlps)
165+
161166
## Next steps
162167

163168
- [SQL Server PowerShell](sql-server-powershell.md)
169+
- [SQL Server PowerShell cmdlets](https://docs.microsoft.com/powershell/module/sqlserver)
164170
- [Use PowerShell with Azure Data Studio](../azure-data-studio/extensions/powershell-extension.md)

docs/powershell/encode-and-decode-sql-server-identifiers.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,14 @@ The **Encode-Sqlname** and **Decode-Sqlname** cmdlets only encode or decode the
3838

3939
## Encoding an Identifier
4040

41-
**To encode a SQL Server identifier in a PowerShell path**
41+
### To encode a SQL Server identifier in a PowerShell path
4242

4343
- Use one of two methods to encode a SQL Server identifier:
4444
- Specify the hexadecimal code for the unsupported character using the syntax %XX, where XX is the hexadecimal code.
4545
- Pass the identifier as a quoted string to the **Encode-Sqlname** cmdlet
4646

4747
### Examples (Encoding)
48+
4849
This example specifies the encoded version of the ":" character (%3A):
4950

5051
```powershell
@@ -57,9 +58,9 @@ Alternatively, you can use **Encode-SqlName** to build a name supported by Windo
5758
Set-Location (Encode-SqlName "Table:Test")
5859
```
5960

60-
## <a name="DecodeIdent"></a> Decoding an Identifier
61+
## Decoding an Identifier
6162

62-
**To decode a SQL Server identifier from a PowerShell path**
63+
### To decode a SQL Server identifier from a PowerShell path
6364

6465
Use the **Decode-Sqlname** cmdlet to replace the hexadecimal encodings with the characters represented by the encoding.
6566

docs/powershell/escape-sql-server-identifiers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "Escape SQL Server Identifiers | Microsoft Docs"
2+
title: Escape SQL Server Identifiers
33
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.
44
ms.prod: sql
55
ms.technology: sql-server-powershell

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Load the SMO Assemblies in Windows PowerShell
3-
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.
3+
description: Learn how to load the SQL Server Management Object (SMO) assemblies in Windows PowerShell scripts that don't use the SQL Server PowerShell provider.
44
ms.prod: sql
55
ms.technology: sql-server-powershell
66
ms.topic: conceptual
@@ -16,7 +16,7 @@ ms.date: 10/14/2020
1616

1717
[!INCLUDE[SQL Server Azure SQL Database Synapse Analytics PDW ](../includes/applies-to-version/sql-asdb-asdbmi-asa-pdw.md)]
1818

19-
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.
19+
This article describes how to load the SQL Server Management Object (SMO) assemblies in Windows PowerShell scripts that don't use the SQL Server PowerShell provider.
2020

2121
> [!NOTE]
2222
> 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.
@@ -29,7 +29,7 @@ There are two cases where you may need to load the SMO assemblies directly:
2929

3030
- 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.
3131

32-
- You want to port SMO code from another language, such as C# or Visual Basic, which does not use the provider or cmdlets.
32+
- You want to port SMO code from another language, such as C# or Visual Basic, which doesn't use the provider or cmdlets.
3333

3434
## Example: Loading the SQL Server Management Objects
3535

@@ -38,7 +38,7 @@ The following code loads the SMO assemblies:
3838
```powershell
3939
# Loads the SQL Server Management Objects (SMO)
4040
41-
$ErrorActionPreference = "Stop"
41+
$ErrorActionPreference = "Stop"
4242
4343
$sqlpsreg="HKLM:\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.SqlServer.Management.PowerShell.sqlps"
4444
Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
---
2-
title: "PowerShell: Manage authentication"
2+
title: Manage authentication to SQL Server in PowerShell
33
description: Learn how to use SQL Server Authentication rather than Windows Authentication (the default) when connecting to an instance of the Database Engine.
44
titleSuffix: SQL Server on Linux
5-
ms.custom: seo-lt-2019
6-
ms.date: "03/14/2017"
75
ms.prod: sql
8-
ms.reviewer: matteot, drskwier
96
ms.technology: sql-server-powershell
107
ms.topic: conceptual
118
ms.assetid: ab9212a6-6628-4f08-a38c-d3156e05ddea
129
author: markingmyname
1310
ms.author: maghan
11+
ms.reviewer: matteot, drskwier
12+
ms.custom: seo-lt-2019
13+
ms.date: 10/14/2020
1414
---
1515

16-
# PowerShell: Manage authentication to SQL Server
16+
# Manage authentication to SQL Server in PowerShell
1717

1818
[!INCLUDE[SQL Server Azure SQL Database Synapse Analytics PDW ](../includes/applies-to-version/sql-asdb-asdbmi-asa-pdw.md)]
1919

@@ -27,26 +27,26 @@ By default, the [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)] PowerShel
2727
## Permissions
2828

2929
All actions you can perform in an instance of the [!INCLUDE[ssDE](../includes/ssde-md.md)] are controlled by the permissions granted to the authentication credentials used to connect to the instance. By default, the [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)] provider and cmdlets use the Windows account under which it is running to make a Windows Authentication connection to the [!INCLUDE[ssDE](../includes/ssde-md.md)].
30-
31-
To make a [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)] Authentication connection you must supply a SQL Server Authentication login ID and password. When using the [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)] provider, you must associate the [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)] login credentials with a virtual drive, and then use the change directory command (**cd**) to connect to that drive. In Windows PowerShell, security credentials can only be associated with virtual drives.
32-
30+
31+
To make a [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)] Authentication connection you must supply a SQL Server Authentication login ID and password. When using the [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)] provider, you must associate the [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)] login credentials with a virtual drive, and then use the change directory command (**cd**) to connect to that drive. In Windows PowerShell, security credentials can only be associated with virtual drives.
32+
3333
## SQL Server Authentication Using a Virtual Drive
3434

35-
**To create a virtual drive associated with a SQL Server Authentication login**
35+
### To create a virtual drive associated with a SQL Server Authentication login
3636

37-
1. Create a function that:
37+
1. Create a function that:
38+
39+
1. Has parameters for the name to give the virtual drive, the login ID, and the provider path to associate with the virtual drive.
3840

39-
1. Has parameters for the name to give the virtual drive, the login ID, and the provider path to associate with the virtual drive.
40-
4141
2. Uses **read-host** to prompt the user for the password.
42-
42+
4343
3. Uses **new-object** to create a credentials object.
44-
44+
4545
4. Uses **new-psdrive** to create a virtual drive with the supplied credentials.
46-
46+
4747
2. Invoke the function to create a virtual drive with the supplied credentials.
4848

49-
### Example (Virtual Drive)
49+
#### Example (Virtual Drive)
5050

5151
This example creates a function named **sqldrive** that you can use to create a virtual drive that is associated with the specified [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)] Authentication login and instance.
5252

@@ -68,26 +68,28 @@ sqldrive SQLAuth
6868
6969
## CD to the virtual drive, which invokes the supplied authentication credentials.
7070
cd SQLAuth
71-
```
72-
73-
## <a name="SQLAuthInvSqlCmd"></a> SQL Server Authentication Using Invoke-Sqlcmd
74-
**To use Invoke-Sqlcmd with SQL Server Authentication**
75-
76-
1. Use the **-Username** parameter to specify a login ID, and the **-Password** parameter to specify the associated password.
77-
78-
### Example (Invoke-Sqlcmd)
79-
This example uses the read-host cmdlet to prompt the user for a password, and then connects using SQL Server Authentication.
80-
81-
```
71+
```
72+
73+
## SQL Server Authentication Using Invoke-Sqlcmd
74+
75+
### To use Invoke-Sqlcmd with SQL Server Authentication
76+
77+
1. Use the **-Username** parameter to specify a login ID, and the **-Password** parameter to specify the associated password.
78+
79+
#### Example (Invoke-Sqlcmd)
80+
81+
This example uses the read-host cmdlet to prompt the user for a password, and then connects using SQL Server Authentication.
82+
83+
```powershell
8284
## Prompt the user for their password.
8385
$pwd = read-host -AsSecureString -Prompt "Password"
8486
8587
Invoke-Sqlcmd -Query "SELECT GETDATE() AS TimeOfQuery;" -ServerInstance "MyComputer\MyInstance" -Username "MyLogin" -Password $pwd
86-
```
87-
88-
## See Also
89-
[SQL Server PowerShell](sql-server-powershell.md)
90-
[SQL Server PowerShell Provider](sql-server-powershell-provider.md)
91-
[Invoke-Sqlcmd cmdlet](invoke-sqlcmd-cmdlet.md)
92-
93-
88+
```
89+
90+
## See Also
91+
92+
- [SQL Server PowerShell](sql-server-powershell.md)
93+
- [SQL Server PowerShell Provider](sql-server-powershell-provider.md)
94+
- [Invoke-Sqlcmd cmdlet](https://docs.microsoft.com/powershell/module/sqlserver/invoke-sqlcmd)
95+
- [Use PowerShell with Azure Data Studio](../azure-data-studio/extensions/powershell-extension.md)
Lines changed: 39 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
---
2-
title: "Manage Tab Completion (SQL Server PowerShell) | Microsoft Docs"
2+
title: Manage Tab Completion (SQL Server PowerShell)
33
description: Learn how to control Windows PowerShell tab completion by making proper use of three variables in the SQL Server PowerShell modules.
4-
ms.custom: ""
5-
ms.date: "03/14/2017"
64
ms.prod: sql
7-
ms.reviewer: matteot, drskwier
85
ms.technology: sql-server-powershell
96
ms.topic: conceptual
107
ms.assetid: 6296848a-890f-4ad3-8d9f-92ed6a79aa00
118
author: markingmyname
129
ms.author: maghan
10+
ms.reviewer: matteot, drskwier
11+
ms.custom: ""
12+
ms.date: 10/14/2020
1313
---
14-
# Manage Tab Completion (SQL Server PowerShell)
14+
15+
# Manage Tab Completion with SQL Server PowerShell
16+
1517
[!INCLUDE[SQL Server Azure SQL Database Synapse Analytics PDW ](../includes/applies-to-version/sql-asdb-asdbmi-asa-pdw.md)]
1618

1719
The [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)] PowerShell snap-ins introduce three variables (**$SqlServerMaximumTabCompletion**, **$SqlServerMaximumChildItems**, and **$SqlServerIncludeSystemObjects**) to control Windows PowerShell tab completion. Tab completion reduces the amount of typing you must do by returning tables of items whose names start with the string you are typing.
@@ -20,36 +22,41 @@ The [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)] PowerShell snap-ins i
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).
23-
25+
2426
With Windows PowerShell tab-completion, when you have typed part of a path or cmdlet name, you can hit the Tab key to get a list of the items whose names match what you have already typed. You can then select the item you want from the list without having to type the rest of the name.
25-
27+
2628
If you are working in a database that has many objects, the tab-completion lists can become large. Some [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)] object types, such as views, also have large numbers of system objects.
27-
28-
The [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)] snap-ins introduces three system variables that you can use to control the amount of information presented by tab-completion and **Get-ChildItem**.
29-
30-
**$SqlServerMaximumTabCompletion =** *n*
31-
Specifies the maximum number of objects to include in a tab-completion list. If you select Tab at a path node having more than *n* objects, the tab-completion list is truncated at *n*. *n* is an integer. 0 is the default setting, and means there is no limit to the number of objects listed.
32-
33-
**$SqlServerMaximumChildItems =** *n*
34-
Specifies the maximum number of objects displayed by **Get-ChildItem**. If **Get-ChildItem** is run at a path node having more than *n* objects, the list is truncated at *n*. *n* is an integer. 0 is the default setting, and means there is no limit to the number of objects listed.
35-
36-
**$SqlServerIncludeSystemObjects =** { **$True** | **$False** }
37-
If **$True**, system objects are displayed by tab-completion and **Get-ChildItem**. If **$False**, no system objects are displayed. The default setting is **$False**.
38-
39-
## Set the SQL Server Tab Completion Variables
40-
For any of the variables you want to change from the default value, set the variable to the new value.
41-
42-
### Example (PowerShell)
43-
The following example sets all three variables and lists their settings:
44-
45-
```
29+
30+
The [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)] snap-ins introduces three system variables that you can use to control the amount of information presented by tab-completion and **Get-ChildItem**.
31+
32+
## $SqlServerMaximumTabCompletion =** *n*
33+
34+
Specifies the maximum number of objects to include in a tab-completion list. If you select Tab at a path node having more than *n* objects, the tab-completion list is truncated at *n*. *n* is an integer. 0 is the default setting, and means there is no limit to the number of objects listed.
35+
36+
## $SqlServerMaximumChildItems =** *n*
37+
38+
Specifies the maximum number of objects displayed by **Get-ChildItem**. If **Get-ChildItem** is run at a path node having more than *n* objects, the list is truncated at *n*. *n* is an integer. 0 is the default setting, and means there is no limit to the number of objects listed.
39+
40+
## $SqlServerIncludeSystemObjects =** { **$True** | **$False** }
41+
42+
If **$True**, system objects are displayed by tab-completion and **Get-ChildItem**. If **$False**, no system objects are displayed. The default setting is **$False**.
43+
44+
## Set the SQL Server Tab Completion Variables
45+
46+
For any of the variables you want to change from the default value, set the variable to the new value.
47+
48+
### Example (PowerShell)
49+
50+
The following example sets all three variables and lists their settings:
51+
52+
```powershell
4653
$SqlServerMaximumTabCompletion = 20
4754
$SqlServerMaximumChildItems = 10
4855
$SqlServerIncludeSystemObjects = $False
4956
dir variable:sqlserver*
50-
```
51-
52-
## See Also
53-
[SQL Server PowerShell](sql-server-powershell.md)
54-
55-
57+
```
58+
59+
## See Also
60+
61+
- [Install SQL Server PowerShell](download-sql-server-ps-module.md)
62+
- [SQL Server PowerShell](sql-server-powershell.md)

0 commit comments

Comments
 (0)