Apr 07 2020 07:15 AM
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!
Jun 12 2023 09:03 PM