SqlServer PS module and SQLPS Clarification

%3CLINGO-SUB%20id%3D%22lingo-sub-1288525%22%20slang%3D%22en-US%22%3ESqlServer%20PS%20module%20and%20SQLPS%20Clarification%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1288525%22%20slang%3D%22en-US%22%3E%3CP%3EI've%20already%20started%20a%20thread%20last%20week%20about%20this%20on%20the%20SQL%20MSDN%20forums%20and%20have%20not%20gotten%20anywhere.%20So%20I'm%20hoping%20that%20since%20this%20might%20be%20more%20of%20PS%20thing%2C%20maybe%20you%20fine%20folks%20could%20shed%20some%20light.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EI%20understand%20that%20SqlServer%20has%20replaced%20SQLPS.%20I%20experienced%20this%20with%20SQL%202017.%20I'm%20now%20putting%20together%20a%20SQL%202019%20with%20Server%202019%20and%20I%20see%20that%20SQLPS%20is%20still%20part%20of%20the%20install.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3CEM%3EPS%20C%3A%5CWindows%5Csystem32%26gt%3B%20get-module%20sqlps%20-ListAvailable%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CEM%3EDirectory%3A%20C%3A%5CProgram%20Files%20(x86)%5CMicrosoft%20SQL%20Server%5C150%5CTools%5CPowerShell%5CModules%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CEM%3EModuleType%20Version%20Name%20ExportedCommands%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CEM%3E----------%20-------%20----%20----------------%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CEM%3EManifest%2015.0%20SQLPS%20%7BBackup-SqlDatabase%2C%20Save-SqlMigrationReport%2C%20Invoke-Polic...%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EBefore%20I%20do%20an%20install%20of%20SqlServer%20module%2C%20is%20it%20advised%20to%20uninstall%20SQLPS%20first%3F%20I%20did%20try%20to%20install%20SqlServer%20without%20trying%20to%20remove%20SQLPS%20and%20I'm%20then%20presented%20with%20all%20sorts%20of%20red%20text%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3CEM%3EPackageManagement%5CInstall-Package%20%3A%20The%20following%20commands%20are%20already%20available%20on%20this%20system%3A'Add-SqlAvailabilityDatabase%2CAdd-SqlAvailabilityGroupListenerStaticIp%2CAdd-SqlFirewallRule%2CBackup-SqlDatabase%2Cblah%20blah%20blah....'.%20This%20module%20'SqlServer'%20may%20override%20the%20existing%20commands.%20If%20you%20still%20want%20to%20install%20this%20module%20'SqlServer'%2C%20use%20-AllowClobber%20parameter.%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EShould%20one%20just%20-AllowClobber%3F%20When%20I%20do%20that%2C%20both%20SQLPS%20and%20SqlServer%20appear%20to%20be%20installed.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3ESomeone%20from%20that%20SQL%20forum%20did%20suggest%20to%20uninstall%20SQLPS.%20However%2C%20that%20brings%20up%20more%20issues.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EI%20attempted%20to%20Uninstall-Module%20and%20Remove-Module%20with%20no%20luck.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3CEM%3EPS%20C%3A%5CWindows%5Csystem32%26gt%3B%20Uninstall-Module%20-Name%20sqlpsPackageManagement%5CUninstall-Package%20%3A%20No%20match%20was%20found%20for%20the%20specified%20search%20criteria%20and%20module%20names%20'sqlps'.%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EAt%20C%3A%5CProgram%20Files%5CWindowsPowerShell%5CModules%5CPowerShellGet%5C1.0.0.1%5CPSModule.psm1%3A2194%20char%3A21%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E%2B%20...%20%24null%20%3D%20PackageManagement%5CUninstall-Package%20%40PSBoundParameters%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E%2B%20CategoryInfo%20%3A%20ObjectNotFound%3A%20(Microsoft.Power...ninstallPackage%3AUninstallPackage)%20%5BUninstall-Package%5D%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E%2C%20Exception%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E%2B%20FullyQualifiedErrorId%20%3A%20NoMatchFound%2CMicrosoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3Eand%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3CEM%3EPS%20C%3A%5CWindows%5Csystem32%26gt%3B%20Remove-Module%20-Name%20%22SQLPS%22%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3ERemove-Module%20%3A%20No%20modules%20were%20removed.%20Verify%20that%20the%20specification%20of%20modules%20to%20remove%20is%20correct%20and%20those%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3Emodules%20exist%20in%20the%20runspace.%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EAt%20line%3A1%20char%3A1%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E%2B%20Remove-Module%20-Name%20%22SQLPS%22%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E%2B%20CategoryInfo%20%3A%20ResourceUnavailable%3A%20(%3A)%20%5BRemove-Module%5D%2C%20InvalidOperationException%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E%2B%20FullyQualifiedErrorId%20%3A%20Modules_NoModulesRemoved%2CMicrosoft.PowerShell.Commands.RemoveModuleCommand%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EFrom%20what%20I%20can%20tell%20online%2C%20remove-module%20needs%20quotes%20while%20uninstall-module%20does%20not.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EPlease%20advise%20and%20thanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1288525%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESQL%20Server%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWindows%20PowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Contributor

I've already started a thread last week about this on the SQL MSDN forums and have not gotten anywhere. So I'm hoping that since this might be more of PS thing, maybe you fine folks could shed some light.


I understand that SqlServer has replaced SQLPS. I experienced this with SQL 2017. I'm now putting together a SQL 2019 with Server 2019 and I see that SQLPS is still part of the install.


PS C:\Windows\system32> get-module sqlps -ListAvailable

Directory: C:\Program Files (x86)\Microsoft SQL Server\150\Tools\PowerShell\Modules

ModuleType Version Name ExportedCommands

---------- ------- ---- ----------------

Manifest 15.0 SQLPS {Backup-SqlDatabase, Save-SqlMigrationReport, Invoke-Polic...


Before I do an install of SqlServer module, is it advised to uninstall SQLPS first? I did try to install SqlServer without trying to remove SQLPS and I'm then presented with all sorts of red text


PackageManagement\Install-Package : The following commands are already available on this system:'Add-SqlAvailabilityDatabase,Add-SqlAvailabilityGroupListenerStaticIp,Add-SqlFirewallRule,Backup-SqlDatabase,blah blah blah....'. This module 'SqlServer' may override the existing commands. If you still want to install this module 'SqlServer', use -AllowClobber parameter.


Should one just -AllowClobber? When I do that, both SQLPS and SqlServer appear to be installed.


Someone from that SQL forum did suggest to uninstall SQLPS. However, that brings up more issues.


I attempted to Uninstall-Module and Remove-Module with no luck.


PS C:\Windows\system32> Uninstall-Module -Name sqlpsPackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'sqlps'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2194 char:21
+ ... $null = PackageManagement\Uninstall-Package @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package]
, Exception
+ FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage


and


PS C:\Windows\system32> Remove-Module -Name "SQLPS"
Remove-Module : No modules were removed. Verify that the specification of modules to remove is correct and those
modules exist in the runspace.
At line:1 char:1
+ Remove-Module -Name "SQLPS"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [Remove-Module], InvalidOperationException
+ FullyQualifiedErrorId : Modules_NoModulesRemoved,Microsoft.PowerShell.Commands.RemoveModuleCommand


From what I can tell online, remove-module needs quotes while uninstall-module does not.


Please advise and thanks!

0 Replies