gpt4 book ai didi

sql-server - 尽管安装了 SQL Server,但未安装 SQL Server PowerShell 管理单元

转载 作者:行者123 更新时间:2023-12-02 23:36:06 25 4
gpt4 key购买 nike

我使用的是 SQL Server 2012 SP1 开发人员版。最近我需要使用 SQL Server 管理单元,但 PowerShell 声称没有。我在互联网上进行了研究,但没有找到任何可行的解决方案。有什么方法可以将其添加到 PowerShell 中吗?

get-pssnapin -registered 输出:

Name : CommonSnapIn          PSVersion : 2.0 Description : Common SnapIn
Name : ConfigurationSnapIn PSVersion : 2.0 Description : Configuration SnapIn
Name : DefinitionSnapIn PSVersion : 2.0 Description : Definition SnapIn
Name : DynoPortalSnapIn PSVersion : 2.0 Description : DynoPortal SnapIn
Name : FoldersSnapIn PSVersion : 2.0 Description : Folders SnapIn
Name : JournalSnapIn PSVersion : 2.0 Description : Journal SnapIn
Name : MembershipSnapIn PSVersion : 2.0 Description : Membership SnapIn
Name : MetadataSnapIn PSVersion : 2.0 Description : Metadata SnapIn
Name : NotificationSnapIn PSVersion : 2.0 Description : Notification SnapIn
Name : PersistenceSnapIn PSVersion : 2.0 Description : Foundation Persistence SnapIn
Name : ReportingSnapIn PSVersion : 2.0 Description : Reporting SnapIn

add-PSSnapin sqlservercmdletsnapin100 输出:

PS C:\Users\CRDM and Secure 3> add-PSSnapin sqlservercmdletsnapin100
add-PSSnapin : The Windows PowerShell snap-in 'sqlservercmdletsnapin100' is not installed on this computer.
At line:1 char:1
+ add-PSSnapin sqlservercmdletsnapin100
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (sqlservercmdletsnapin100:String) [Add-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

最佳答案

在 SQL Server 2012 中,产品提供的 PowerShell 功能以 PowerShell 模块的形式提供,因此您不再需要使用管理单元。

要使用 SQL Server PowerShell 模块,您只需执行以下操作:

Import-Module "sqlps"

或者,如果您使用的是 PowerShell v3+,那么您只需要引用该模块的成员,它就会自动加载。

关于sql-server - 尽管安装了 SQL Server,但未安装 SQL Server PowerShell 管理单元,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31566533/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com