6

C:>$PSVersionTable.PSVersion.ToString() 5.1.18362.145

When I use Install-Module -Name SqlServer, it reports:

C:>Install-Module -Name SqlServer
PackageManagement\Install-Package : The following commands are already available on this system:'Decode-SqlName,Encode-SqlName,SQLSERVER:,Add-SqlAvailabilityData
base,Add-SqlAvailabilityGroupListenerStaticIp,Add-SqlFirewallRule,Backup-SqlDatabase,ConvertFrom-EncodedSqlName,ConvertTo-EncodedSqlName,Convert-UrnToPath,Disabl
e-SqlAlwaysOn,Enable-SqlAlwaysOn,Get-SqlCredential,Get-SqlDatabase,Get-SqlInstance,Get-SqlSmartAdmin,Invoke-PolicyEvaluation,Invoke-Sqlcmd,Join-SqlAvailabilityGr

Yes, those appear to be from the SQLPS module. Is it not possible to have two (2) modules with the same exported names?

Update:

Ok, -AllowClobber did avoid the error message. But now I appear to have commands available from both SqlServer and SQLPS.

C:>get-command -Sql

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Alias           Decode-SqlName                                     21.1.18121 SqlServer
Alias           Decode-SqlName                                     14.0       SQLPS
Alias           Encode-SqlName                                     21.1.18121 SqlServer
Alias           Encode-SqlName                                     14.0       SQLPS
Cmdlet          Add-SqlAvailabilityDatabase                        21.1.18121 SqlServer
Cmdlet          Add-SqlAvailabilityDatabase                        14.0       SQLPS

But, using Get-Command in a different way, only shows commands from the SqlServer module.

C:>Get-Command Get-Sqli*

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          Get-SqlInstance                                    21.1.18121 SqlServer
Cmdlet          Get-SqlInstance                                    14.0       SQLPS


C:>Get-Command Get-SqlInstance

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          Get-SqlInstance                                    21.1.18121 SqlServer
2
  • Why do you want sqlps in the first place? It's been superseded by sqlserver which is better in all ways. Commented Jun 18, 2019 at 2:18
  • I don't want SQLPS. I am trying to move on to SqlServer. I do not yet see a way to uninstall SQLPS. Commented Jun 18, 2019 at 3:29

1 Answer 1

2

You can:

Install-Module ... -AllowClobber

to override this error, possibly combined with

-Scope CurrentUser

To only install for a single user.

Or you can install Powershell Core to create a seperate powershell environment for the other module.

Sign up to request clarification or add additional context in comments.

1 Comment

I tried your suggestion. I have updated the question with the results.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.