PowerShell 模块 SqlServer v21.1.18256 找不到 Get-SqlInstance cmdlet

问题描述 投票:0回答:0

如果安装了Powershell模块并且可以找到。为什么 cmdlet 没有被识别?

PS C:\> Get-SqlInstance -Credential laptop-ql9k5dk6\david -ServerInstance "(localdb)\MSSQLLocalDB"
Get-SqlInstance: The term 'Get-SqlInstance' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

PS C:\> Get-InstalledModule -Name SqlServer -AllVersions | select Name,Version

Name      Version
----      -------
SqlServer 21.1.18256

我不知道 Powershell

SqlServer
模块的位置。但是 env 路径适用于我到目前为止使用的所有内容:

$env:PSModulePath -split ";"
C:\Users\david\OneDrive\Documents\PowerShell\Modules
C:\Program Files\PowerShell\Modules
c:\program files\powershell\7\Modules
C:\Users\david\Documents\WindowsPowerShell\Modules
C:\Users\david\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\PowerShell
C:\Program Files\WindowsPowerShell\Modules
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
C:\Program Files (x86)\Microsoft SQL Server\150\Tools\PowerShell\Modules\
c:\Users\david\.vscode\extensions\ms-vscode.powershell-2023.1.0\modules
sql-server powershell module environment-variables
© www.soinside.com 2019 - 2024. All rights reserved.