Skip to content

Commit 442b63b

Browse files
committed
Update download-sql-server-ps-module.md
Updated install instructions to align with best practices of installing modules.
1 parent 4753f2e commit 442b63b

1 file changed

Lines changed: 13 additions & 14 deletions

File tree

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

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ There are two SQL Server PowerShell modules:
2727
- **SQLPS**: The SQLPS is the module used by [SQL Agent](sql-server-powershell.md#sql-server-agent) to run agent jobs in agent job steps using the PowerShell subsystem.
2828

2929
> [!NOTE]
30-
> The versions of the **SqlServer** module in the PowerShell Gallery support versioning and require PowerShell version 5.0 or greater.
30+
> The versions of the **SqlServer** module in the PowerShell Gallery support versioning and require PowerShell version 5.1 or greater.
3131
3232
For help topics, go to:
3333

@@ -48,33 +48,32 @@ For help topics, go to:
4848
You can use the [PowerShell extension](../azure-data-studio/extensions/powershell-extension.md), which provides rich PowerShell editor support in Azure Data Studio.
4949

5050
## Installing or updating the SqlServer module
51+
To install the SqlServer module from the PowerShell Gallery, start a [PowerShell](/powershell/scripting/overview) session and run `Install-Module SQLServer`.
5152

52-
To install the **SqlServer** module from the PowerShell Gallery, start a [PowerShell](/powershell/scripting/overview) session as an administrator. You can also start Azure Data Studio as an administrator and run these commands in a PowerShell session in the integrated terminal.
53-
54-
You can also use *Install-Module SQLServer -Scope CurrentUser* to run elevated permissions. This cmdlet is useful for users who aren't administrators in their environment. However, since the scope is limited to the current user, other users on the same machine can't use the module.
53+
```powershell
54+
Install-Module -Name SqlServer
55+
```
5556

56-
### Install the SqlServer module
57+
If running on Windows PowerShell you can use `Install-Module SQLServer -Scope CurrentUser` to install the module for just the current user and avoid needing elevated permissions.
5758

58-
Run the following command in your PowerShell session to install the SqlServer module for all users:
59+
### Install the SqlServer module for all users
60+
To install the SqlServer module for all users run the command below in an elevated PowerShell session; start a PowerShell session as administrator:
5961

6062
```powershell
6163
Install-Module -Name SqlServer
6264
```
6365

6466
### To view the versions of the SqlServer module installed
65-
6667
Execute the following command to see the versions of the SqlServer module that have been installed
6768

6869
```powershell
6970
Get-Module SqlServer -ListAvailable
7071
```
7172

72-
### Install for the current user rather than as an administrator
73-
74-
If you aren't able to run the PowerShell session as an administrator, install for the current user using the following command:
73+
To view the version of the SqlServer module loaded in the current session
7574

7675
```powershell
77-
Install-Module -Name SqlServer -Scope CurrentUser
76+
(Get-Module SqlServer).Version
7877
```
7978

8079
### To overwrite a previous version of the SqlServer module
@@ -93,7 +92,7 @@ Install-Module -Name SqlServer -AllowClobber
9392
When updated versions of the **SqlServer** module are available, you can install the newer version using the following command:
9493

9594
```powershell
96-
Install-Module -Name SqlServer -AllowClobber
95+
Update-Module -Name SqlServer -AllowClobber
9796
```
9897

9998
You can use the `Update-Module` command to install the newest version of the SQLServer PowerShell module, but that doesn't remove older versions. It installs the newer version side by side to allow you the ability to experiment with the latest version, yet still have older modules installed.
@@ -151,11 +150,11 @@ Install-Module SqlServer -RequiredVersion 21.1.18218-preview -AllowPrerelease
151150

152151
## SQL Server PowerShell on Linux
153152

154-
Visit [Manage SQL Server on Linux with PowerShell Core](../linux/sql-server-linux-manage-powershell-core.md) to see how to install SQL Server PowerShell on Linux.
153+
Visit [Manage SQL Server on Linux with PowerShell](../linux/sql-server-linux-manage-powershell-core.md) to see how to install SQL Server PowerShell on Linux.
155154

156155
## Other modules
157156

158-
- [Az.Sql](https://www.powershellgallery.com/packages/Az.Sql/) - SQL service cmdlets for Azure Resource Manager in Windows PowerShell and PowerShell Core.
157+
- [Az.Sql](https://www.powershellgallery.com/packages/Az.Sql/) - SQL service cmdlets for Azure Resource Manager in Windows PowerShell and PowerShell.
159158

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

0 commit comments

Comments
 (0)