HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Is it normal for Install-Module SqlServer to clobber existing modules?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
modulesinstallsqlservermodulenormalforexistingclobber

Problem

I have a windows 10 box with SSMS 17. I had SSMS 2016 installed, but it is now uninstalled. When I go to install the SqlServer module I get this warning:

```
C:\WINDOWS\system32> install-module sqlserver -Scope AllUsers

Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy
value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): y
PackageManagement\Install-Package : The following commands are already available on this system:'Add-RoleMember,Add-SqlAvailabilityDatabase,Add-SqlAvailabilityGroupListenerStaticIp,Add-SqlAzu
reAuthenticationContext,Add-SqlColumnEncryptionKeyValue,Add-SqlFirewallRule,Add-SqlLogin,Backup-ASDatabase,Backup-SqlDatabase,Complete-SqlColumnMasterKeyRotation,ConvertFrom-EncodedSqlName,Co
nvertTo-EncodedSqlName,Convert-UrnToPath,Disable-SqlAlwaysOn,Enable-SqlAlwaysOn,Get-SqlAgent,Get-SqlAgentJob,Get-SqlAgentJobHistory,Get-SqlAgentJobSchedule,Get-SqlAgentJobStep,Get-SqlAgentSch
edule,Get-SqlColumnEncryptionKey,Get-SqlColumnMasterKey,Get-SqlCredential,Get-SqlDatabase,Get-SqlErrorLog,Get-SqlInstance,Get-SqlLogin,Get-SqlSmartAdmin,Grant-SqlAvailabilityGroupCreateAnyDat
abase,Invoke-ASCmd,Invoke-PolicyEvaluation,Invoke-ProcessASDatabase,Invoke-ProcessCube,Invoke-ProcessDimension,Invoke-ProcessPartition,Invoke-ProcessTable,Invoke-Sqlcmd,Invoke-SqlColumnMaster
KeyRotation,Join-SqlAvailabilityGroup,Merge-Partition,New-RestoreFolder,New-RestoreLocation,New-SqlAvailabilityGroup,New-SqlAvailabilityGroupListener,New-SqlAvailabilityReplica,New-SqlAzureKe
yVaultColumnMasterKeySettings,New-SqlBackupEncryptionOption,New-SqlCertificateStoreColumnMasterKeySettings,New-SqlCngColumnMasterKeySettings,New-SqlColumnEncryptionKey,New-SqlColumnEncryption
KeyEncryptedValue,New-SqlColumnEncryptionSettings,New-SqlColumnMasterKey,New-SqlColumnMasterK

Solution

This is likely left over from SSMS 2016 in the sense that included the sqlserver module, but MS was not placing it in version folders. Which modules from the PSGallery generally do now.

If you check Get-Module sqlserver -ListAvailable | select name, version, modulebase you will see which path they go to.

I have SSMS 2016, SSMS 17 and the sqlserver module from the PSGallery installed on my Windows 10 machine.

You can see that the 20.0 is just dumped inside of the SqlServer module folder. I did get the error you did when I installed the module from the PSGallery, which is to be expected since the functions are the same name.

Your option would be to remove the older version that came with SSMS 2016 or just use the -AllowClobber, which will be fine.

Context

StackExchange Database Administrators Q#174704, answer score: 6

Revisions (0)

No revisions yet.