You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/powershell/download-sql-server-ps-module.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -158,7 +158,13 @@ Visit [Manage SQL Server on Linux with PowerShell Core](../linux/sql-server-linu
158
158
159
159
-[SqlServerDsc](https://www.powershellgallery.com/packages/SqlServerDsc/) - Module with DSC resources for deployment and configuration of Microsoft SQL Server.
Copy file name to clipboardExpand all lines: docs/powershell/escape-sql-server-identifiers.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: "Escape SQL Server Identifiers | Microsoft Docs"
2
+
title: Escape SQL Server Identifiers
3
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.
Copy file name to clipboardExpand all lines: docs/powershell/load-the-smo-assemblies-in-windows-powershell.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
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.
4
4
ms.prod: sql
5
5
ms.technology: sql-server-powershell
6
6
ms.topic: conceptual
@@ -16,7 +16,7 @@ ms.date: 10/14/2020
16
16
17
17
[!INCLUDE[SQL Server Azure SQL Database Synapse Analytics PDW ](../includes/applies-to-version/sql-asdb-asdbmi-asa-pdw.md)]
18
18
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.
20
20
21
21
> [!NOTE]
22
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.
@@ -29,7 +29,7 @@ There are two cases where you may need to load the SMO assemblies directly:
29
29
30
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
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.
32
+
- You want to port SMO code from another language, such as C# or Visual Basic, which doesn't use the provider or cmdlets.
33
33
34
34
## Example: Loading the SQL Server Management Objects
35
35
@@ -38,7 +38,7 @@ The following code loads the SMO assemblies:
title: Manage authentication to SQL Server in PowerShell
3
3
description: Learn how to use SQL Server Authentication rather than Windows Authentication (the default) when connecting to an instance of the Database Engine.
4
4
titleSuffix: SQL Server on Linux
5
-
ms.custom: seo-lt-2019
6
-
ms.date: "03/14/2017"
7
5
ms.prod: sql
8
-
ms.reviewer: matteot, drskwier
9
6
ms.technology: sql-server-powershell
10
7
ms.topic: conceptual
11
8
ms.assetid: ab9212a6-6628-4f08-a38c-d3156e05ddea
12
9
author: markingmyname
13
10
ms.author: maghan
11
+
ms.reviewer: matteot, drskwier
12
+
ms.custom: seo-lt-2019
13
+
ms.date: 10/14/2020
14
14
---
15
15
16
-
# PowerShell: Manage authentication to SQL Server
16
+
# Manage authentication to SQL Server in PowerShell
17
17
18
18
[!INCLUDE[SQL Server Azure SQL Database Synapse Analytics PDW ](../includes/applies-to-version/sql-asdb-asdbmi-asa-pdw.md)]
19
19
@@ -27,26 +27,26 @@ By default, the [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)] PowerShel
27
27
## Permissions
28
28
29
29
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
+
33
33
## SQL Server Authentication Using a Virtual Drive
34
34
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
36
36
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.
38
40
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
-
41
41
2. Uses **read-host** to prompt the user for the password.
42
-
42
+
43
43
3. Uses **new-object** to create a credentials object.
44
-
44
+
45
45
4. Uses **new-psdrive** to create a virtual drive with the supplied credentials.
46
-
46
+
47
47
2. Invoke the function to create a virtual drive with the supplied credentials.
48
48
49
-
### Example (Virtual Drive)
49
+
####Example (Virtual Drive)
50
50
51
51
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.
52
52
@@ -68,26 +68,28 @@ sqldrive SQLAuth
68
68
69
69
## CD to the virtual drive, which invokes the supplied authentication credentials.
70
70
cd SQLAuth
71
-
```
72
-
73
-
## <aname="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.
title: "Manage Tab Completion (SQL Server PowerShell) | Microsoft Docs"
2
+
title: Manage Tab Completion (SQL Server PowerShell)
3
3
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"
6
4
ms.prod: sql
7
-
ms.reviewer: matteot, drskwier
8
5
ms.technology: sql-server-powershell
9
6
ms.topic: conceptual
10
7
ms.assetid: 6296848a-890f-4ad3-8d9f-92ed6a79aa00
11
8
author: markingmyname
12
9
ms.author: maghan
10
+
ms.reviewer: matteot, drskwier
11
+
ms.custom: ""
12
+
ms.date: 10/14/2020
13
13
---
14
-
# Manage Tab Completion (SQL Server PowerShell)
14
+
15
+
# Manage Tab Completion with SQL Server PowerShell
16
+
15
17
[!INCLUDE[SQL Server Azure SQL Database Synapse Analytics PDW ](../includes/applies-to-version/sql-asdb-asdbmi-asa-pdw.md)]
16
18
17
19
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
20
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.
21
23
> 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.
22
24
> To install the **SqlServer** module, see [Install SQL Server PowerShell](download-sql-server-ps-module.md).
23
-
25
+
24
26
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
+
26
28
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.
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.
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
46
53
$SqlServerMaximumTabCompletion = 20
47
54
$SqlServerMaximumChildItems = 10
48
55
$SqlServerIncludeSystemObjects = $False
49
56
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