无法安装 SQL Server PowerShell utilities


PowerShell交流中心分类: Powershell基础无法安装 SQL Server PowerShell utilities
0
^_^~~ asked 3年 ago

我的电脑需要安装SQL Server PowerShell utilities,但是在PowerShell ISE里面无法执行 Install-Module -Name sqlserver,可以麻烦帮忙看看吗?
PS C:\Users\tli> Install-Module -Name sqlserver
PackageManagement\Install-Package : The following commands are already available on this system:’Add-Rol
eMember,Add-SqlAvailabilityDatabase,Add-SqlAvailabilityGroupListenerStaticIp,Add-SqlFirewallRule,Backup-
ASDatabase,Backup-SqlDatabase,Convert-UrnToPath,Decode-SqlName,Disable-SqlAlwaysOn,Enable-SqlAlwaysOn,En
code-SqlName,Get-SqlCredential,Get-SqlDatabase,Get-SqlInstance,Get-SqlSmartAdmin,Invoke-ASCmd,Invoke-Pol
icyEvaluation,Invoke-ProcessCube,Invoke-ProcessDimension,Invoke-ProcessPartition,Invoke-Sqlcmd,Join-SqlA
vailabilityGroup,Merge-Partition,New-RestoreFolder,New-RestoreLocation,New-SqlAvailabilityGroup,New-SqlA
vailabilityGroupListener,New-SqlAvailabilityReplica,New-SqlBackupEncryptionOption,New-SqlCredential,New-
SqlHADREndpoint,Remove-RoleMember,Remove-SqlAvailabilityDatabase,Remove-SqlAvailabilityGroup,Remove-SqlA
vailabilityReplica,Remove-SqlCredential,Remove-SqlFirewallRule,Restore-ASDatabase,Restore-SqlDatabase,Re
sume-SqlAvailabilityDatabase,Set-SqlAuthenticationMode,Set-SqlAvailabilityGroup,Set-SqlAvailabilityGroup
Listener,Set-SqlAvailabilityReplica,Set-SqlCredential,Set-SqlHADREndpoint,Set-SqlNetworkConfiguration,Se
t-SqlSmartAdmin,Start-SqlInstance,Stop-SqlInstance,Suspend-SqlAvailabilityDatabase,Switch-SqlAvailabilit
yGroup,Test-SqlAvailabilityGroup,Test-SqlAvailabilityReplica,Test-SqlDatabaseReplicaState,Test-SqlSmartA
dmin’. This module ‘SqlServer’ may override the existing commands. If you still want to install this
module ‘SqlServer’, use -AllowClobber parameter.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.6.6\PSModule.psm1:9455 char:21
+ …          $null = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Microsoft.Power….InstallPackage:InstallPackage) [Ins
   tall-Package], Exception
    + FullyQualifiedErrorId : CommandAlreadyAvailable,Validate-ModuleCommandAlreadyAvailable,Microsoft.
   PowerShell.PackageManagement.Cmdlets.InstallPackage

×用微信扫描并分享
1 Answers
0
Best Answer
Mooser Lee 管理员 answered 3年 ago

从错误的提示看,你的系统中已经按照了该模块。你尝试用

 Import-Module -Name sqlserver 
^_^~~ replied 3年 ago

我用了Import-Module -Name sqlserver , 但是还是有报错
PS C:\Users\tli> import-module -name sqlserver

import-module : The specified module ‘sqlserver’ was not loaded because no valid module file was found in any
module directory.
At line:1 char:1
+ import-module -name sqlserver
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (sqlserver:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand