Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No SQL Server PowerShell snapin installed despite installing SQL Server

I am using SQL Server 2012 SP1 developer edition. Lately I had a need to use SQL Server snapin but PowerShell claims not to have one. I made a research on the internet but I didn't find any working solution. Is there any way I can add it to PowerShell?

get-pssnapin -registered output:

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 output:

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
like image 519
Skylerdw Avatar asked Jul 22 '15 14:07

Skylerdw


1 Answers

In SQL Server 2012 the PowerShell functionality delivered by the product came in the form of a PowerShell module, so therefore you no longer need to work with the snapins.

To consume the SQL Server PowerShell module, you simply need to do this:

Import-Module "sqlps"

Or if you are using PowerShell v3+ then you just need to reference a member of that module and it'll be automatically loaded in.

like image 86
Thomas Stringer Avatar answered Oct 14 '22 23:10

Thomas Stringer