locked
Unable to register SQLPS snap-in Windows 10 Enterprise RRS feed

  • Question

  • I have been having trouble ever since upgrading my work laptop to Win10. Since doing that, I keep having issues getting SQLPS to import/register. The ISE keeps asking for the PSProvider for SQLPS, but I'm not sure how to fix it. I am running sqlserver express 2012 on my local machine and I've created a DB (RefreshTest). I am able to connect to it fine from SQL Server Mgmt Studio, but not from within my script. I will include the main script that has the sqlps stuff in it. When I try to manually add the snap-in for sql server, I get "No snap-ins have been registered in Powershell 5". It sounds like I have multiple things going on, but I am nowhere near a PS expert. Any help would be appreciated.

    Brian

    Thursday, May 11, 2017 7:32 PM

All replies

  • There is no snap-in.  If the tools are installed then just use the commands. The module will be automatically loaded.

    To run the PS version of sqlps just type "SQLPS" at a cmd or PowerShell prompt.


    \_(ツ)_/

    Thursday, May 11, 2017 7:42 PM
  • Here is my code. Forgot to insert it before.
    <#
    	.NOTES
    	===========================================================================
    	 Created with: 	SAPIEN Technologies, Inc., PowerShell Studio 2015 v4.2.85
    	 Created on:   	2/7/2017 9:18 AM
    	 Created by:   	BEMBREE
    	 Organization: 	Legacy Health
    	 Filename:     	
    	===========================================================================
    	.DESCRIPTION
    		A description of the file.
    #>
    #region Import Assemblies
    #----------------------------------------------
    [void][Reflection.Assembly]::Load('mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
    [void][Reflection.Assembly]::Load('System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
    [void][Reflection.Assembly]::Load('System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
    [void][Reflection.Assembly]::Load('System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
    [void][Reflection.Assembly]::Load('System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
    [void][Reflection.Assembly]::Load('System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
    [void][Reflection.Assembly]::Load('System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
    [void][Reflection.Assembly]::Load('System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
    [void][Reflection.Assembly]::Load('System.ServiceProcess, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
    #endregion Import Assemblies
    
    <#Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
    Push-Location
    Add-PSSnapin SqlServerCmdletSnapin110
    Add-PSSnapin SqlServerProviderSnapin110
    Update-TypeData -PrependPath SQLProvider.Types.ps1xml
    Update-FormatData -PrependPath SQLProvider.Format.ps1xml
    Pop-Location
    #>
    Import-Module SQLPS -DisableNameChecking
    Get-Module -ListAvailable -Name Sqlps
    
    $datasource = "localhost\RefreshTest"
    $database = "RefreshTest"
    
    function main
    {
    	[void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") #.net library for drawing windows forms
    	
    	#Mainform
    	
    	if ($script:cancelButtonHit)
    	{
    		$global:ExitCode = 0 #Set the exit code for the Packager
    		exit
    	}
    
    	#load form objects
    	
    	$form = New-Object System.Windows.Forms.Form
    	$label = New-Object System.Windows.Forms.Label
    	$inputList = New-Object System.Windows.Forms.RichTextBox
    	$inputListScrollBar = New-Object System.Windows.Forms.VScrollBar
    	$outputList = New-Object System.Windows.Forms.RichTextBox
    	$outputListScrollBar = New-Object System.Windows.Forms.VScrollBar
    	$btnCancel = New-Object System.Windows.Forms.Button
    	$btnRun = New-Object System.Windows.Forms.Button
    	$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState
    	
    	$OnLoadFormEvent = {
    		#TODO: Initialize Form Controls here
    	}
    	
    	$btnCancel_Click = {
    		#on cancel button click
    		#form closes, script exits
    		$form.Close()
    		$script:cancelButtonHit = $true #variable for passing back to main() for cancel button click event because Sapien stinks at returning statements in custom forms
    	}
    	
    	$btnRun_Click = {
    				
    		$refreshList = $inputList.Text.ToUpper().Split("`n") | ForEach-Object { $_.Trim() }
    			
    		$refreshList | Out-File "Y:\RefreshTest\computers.txt" -Force
    		
    		$refreshData = Invoke-Expression "Y:\RefreshTest\RefreshTest.ps1"
    		
    		Export-RefreshData -refreshData $refreshData
    		
    		#Invoke-Expression .\Create-BuildSheets -refreshList $refreshData
    		
    		#$form.Close()
    		
    	}
    	
    	$Form_StateCorrection_Load =
    	{
    		#Correct the initial state of the form to prevent the .Net maximized form issue
    		$form.WindowState = $InitialFormWindowState
    	}
    	
    	$Form_StoreValues_Closing =
    	{
    		#Store the control values
    		$script:MainForm_richtextbox = $richtextbox.Text
    	}
    	
    	
    	$Form_Cleanup_FormClosed =
    	{
    		#Remove all event handlers from the controls
    		try
    		{
    			$btnCancel.remove_Click($btnCancel_Click)
    			$btnRun.remove_Click($btnRun_Click)
    			$form.remove_Load($OnLoadFormEvent)
    			$form.remove_Load($Form_StateCorrection_Load)
    			$form.remove_Closing($Form_StoreValues_Closing)
    			$form.remove_FormClosed($Form_Cleanup_FormClosed)
    		}
    		catch [Exception]
    		{
    			Write-Debug $_.Exception.Message
    		}
    	}
    	#endregion Generated Events
    	
    	$form.SuspendLayout()
    	
    	$form.Controls.Add($label)
    	$form.Controls.Add($inputList)
    	$form.Controls.Add($inputListScrollBar)
    	$form.Controls.Add($outputList)
    	$form.Controls.Add($outputListScrollBar)
    	$form.Controls.Add($btnRun)
    	$form.Controls.Add($btnCancel)
    	
    	$form.Location = '0, 0'
    	$form.ClientSize = '600, 671'
    	$form.Name = "form1"
    	$form.StartPosition = 'CenterScreen'
    	$form.Text = ""
    	$form.add_Load($OnLoadFormEvent)
    	
    	$label.Location = '0, 0'
    	$label.Name = "label"
    	$label.Size = '600, 80'
    	$label.TabIndex = 1
    	$label.Text = "Please enter list of computer names to create Refresh Build Sheets for"
    	$label.Font = "Calibri, 18"
    	$label.TextAlign = 'BottomLeft'
    	
    	$inputList.Location = '22, 95'
    	$inputList.Name = "inputList"
    	$inputList.Size = '250, 500'
    	$inputList.TabIndex = 3
    	
    	$inputListScrollBar.Location = '273, 95'
    	$inputListScrollBar.Name = "inputListScrollBar"
    	$inputListScrollBar.Size = '24, 500'
    		
    	$outputList.Location = '298, 95'
    	$outputList.Name = 'outputList'
    	$outputList.Size = '250, 500'
    	$outputList.TabIndex = 6
    	
    	$outputListScrollBar.Location = '549, 95'
    	$outputListScrollBar.Name = 'outputListScrollBar'
    	$outputListScrollBar.Size = '22, 500'
    	
    	$btnRun.Location = '100, 600'
    	$btnRun.Name = "btnRun"
    	$btnRun.Size = '75, 23'
    	$btnRun.TabIndex = 0
    	$btnRun.Text = "Run"
    	$btnRun.UseVisualStyleBackColor = $True
    	$btnRun.add_Click($btnRun_Click)
    	
    	
    	$btnCancel.Location = '400, 600'
    	$btnCancel.Name = "btnCancel"
    	$btnCancel.Size = '75, 23'
    	$btnCancel.TabIndex = 0
    	$btnCancel.Text = "Cancel"
    	$btnCancel.UseVisualStyleBackColor = $True
    	$btnCancel.add_Click($btnCancel_Click)
    	
    	$form.ResumeLayout()
    	
    		
    	return $form.ShowDialog()
    }
    
    function Export-RefreshData ($refreshData)
    {
    	#$computerNames = $refreshData
    	
    	#$refreshData = Select-Record -ComputerNames $computerNames
    	
    	#ask user to confirm they want to print out Build Sheets
    	
    	#$buildSheets = Create-BuildSheets -ComputerNames $refreshData
    	
    	#$buildSheets | Out-Printer
    	
    	foreach ($refreshPC in $refreshData)
    	{
    		if ($(Select-Record -ComputerName $refreshPC) -eq $null)
    		{
    			Add-Record -computerObj $refreshPC
    		}
    		else
    		{
    			Update-Record -computerObj $refreshPC
    		}
    	}
    	
    }
    
    
    function Select-Record ($ComputerName)
    {
    	$computerObj = @()  	#contains Refresh data for PC
    	
    	try
    	{
    			$selectQuery = "Select * from dbo.Refresh Where ComputerName = '$($computerName)'"
    					
    			#$computerObj = $(Invoke-Sqlcmd -Query $selectQuery -ServerInstance $datasource -Database $database)
    			$computerObj = $(Invoke-Sqlcmd -InputFile "Y:\RefreshTest\SelectQuery.sql")
    			return $computerObj
    	}
    	catch
    	{
    		Write-Debug $_.Exception.Message
    	}
    }
    
    
    function Add-Record ($computerObj)
    {
    	$ComputerName = $computerObj.ComputerName
    	$Model = $computerObj.Model
    	$Autologon = $computerObj.Autologon
    	$BCA = $computerObj.BCA
    	$NewWNum = $computerObj.NewWNum
    	$Description = $computerObj.Description
    	$Status = $computerObj.Status
    	$RefreshDate = $computerObj.RefreshDate
    	$InstallTech = $computerObj.InstallDate
    	$Building = $computerObj.Building
    	$Floor = $computerObj.Floor
    	$Dept = $computerObj.Dept
    	$OS = $computerObj.OperatingSystem
    	$Monitor1 = $computerObj.Monitor1
    	$Monitor2 = $computerObj.Monitor2
    	$Printers = $computerObj.Printers
    	$Adapter = $computerObj.Adapter
    	$MAC = $computerObj.MACAddress
    	$DHCP = $computerObj.DHCPEnabled
    	$IP = $computerObj.IPAddress
    	$SubnetMask = $computerObj.SubnetMask
    	$Gateway = $computerObj.Gateway
    	$DNSPrimary = $computerObj.DNSPrimary
    	$DNSSecondary = $computerObj.DNSSecondary
    	$SCCMApps = $computerObj.SCCMApps
    	$ManualApps = $computerObj.ManualApps
    	$Notes = $computerObj.Notes
    	$TopConsoleUser = $computerObj.TopConsoleUser
    	$TCU_FirstName = $computerObj.TCU_FirstName
    	$TCU_LastName = $computerObj.TCU_LastName
    	$TCU_Site = $computerObj.TCU_Site
    	$TCU_Dept = $computerObj.TCU_Dept
    	$TCU_JobTitle = $computerObj.TCU_JobTitle
    	$MgrFirstName = $computerObj.MgrFirstName
    	$MgrLastName = $computerObj.MgrLastName
    	
    	<#$insertQuery = "Insert into dbo.Refresh (ComputerName,Model,Autologon,BCA,NewWNum,Description,Status,RefreshDate,InstallTech,Building,Floor,Dept,OperatingSystem,Monitor1,Monitor2,`
    											 Printers,Adapter,MACAddress,DHCPEnabled,IPAddress,SubnetMask,Gateway,DNSPrimary,DNSSecondary,SCCMApps,ManualApps,Notes,TopConsoleUser,`
    											 TCU_FirstName,TCU_LastName,TCU_Site,TCU_Dept,TCU_JobTitle,MgrFirstName,MgrLastName)
    					Values ($ComputerName,$Model,$Autologon,$BCA,$NewWNum,$Description,$Status,$RefreshDate,$InstallTech,$Building,$Floor,$Dept,`
    													$OS,$Monitor1,$Monitor2,$Printers,$Adapter,$MAC,$DHCP,$IP,$SubnetMask,$Gateway,$DNSPrimary,$DNSSecondary,$SCCMApps,`
    													$ManualApps,$Notes,$TopConsoleUser,$TCU_FirstName,$TCU_LastName,$TCU_Site,$TCU_Dept,$TCU_JobTitle,$MgrFirstName,$MgrLastName)"
    	#>
    	#$insertQuery = gc "Y:\RefreshTest\InsertQuery.sql"
    	
    	try
    	{
    		#Invoke-Sqlcmd -Query $insertQuery -ServerInstance $datasource -Database $database
    		Invoke-Sqlcmd -InputFile "Y:\RefreshTest\InsertQuery.sql"
    	}
    	catch
    	{
    		Write-Debug $_.Exception.Message
    	}
    	
    }
    
    
    function Update-Record ($computerObj)
    {
    	$ComputerName = $computerObj.ComputerName
    	$Model = $computerObj.Model
    	$Autologon = $computerObj.Autologon
    	$BCA = $computerObj.BCA
    	$NewWNum = $computerObj.NewWNum
    	$Description = $computerObj.Description
    	$Status = $computerObj.Status
    	$RefreshDate = $computerObj.RefreshDate
    	$InstallTech = $computerObj.InstallDate
    	$Building = $computerObj.Building
    	$Floor = $computerObj.Floor
    	$Dept = $computerObj.Dept
    	$OS = $computerObj.OperatingSystem
    	$Monitor1 = $computerObj.Monitor1
    	$Monitor2 = $computerObj.Monitor2
    	$Printers = $computerObj.Printers
    	$Adapter = $computerObj.Adapter
    	$MAC = $computerObj.MACAddress
    	$DHCP = $computerObj.DHCPEnabled
    	$IP = $computerObj.IPAddress
    	$SubnetMask = $computerObj.SubnetMask
    	$Gateway = $computerObj.Gateway
    	$DNSPrimary = $computerObj.DNSPrimary
    	$DNSSecondary = $computerObj.DNSSecondary
    	$SCCMApps = $computerObj.SCCMApps
    	$ManualApps = $computerObj.ManualApps
    	$Notes = $computerObj.Notes
    	$TopConsoleUser = $computerObj.TopConsoleUser
    	$TCU_FirstName = $computerObj.TCU_FirstName
    	$TCU_LastName = $computerObj.TCU_LastName
    	$TCU_Site = $computerObj.TCU_Site
    	$TCU_Dept = $computerObj.TCU_Dept
    	$TCU_JobTitle = $computerObj.TCU_JobTitle
    	$MgrFirstName = $computerObj.MgrFirstName
    	$MgrLastName = $computerObj.MgrLastName
    	
    	<#$updateQuery = "Update dbo.Refresh `
    		Set Model = $Model, Autologon = $Autologon, BCA = $BCA, NewWNum = $NewWNum, Description = $Description, Status = $Status, RefreshDate = $RefreshDate, `
    		InstallTech = $InstallTech, Building = $Building, Floor = $Floor, Dept = $$Dept, OperatingSystem = $OS, Monitor1 = $Monitor1, Monitor1 = $Monitor2, `
    		Printers = $Printers, Adapter = $Adapter, MACAddress = $MAC, DHCPEnabled = $DHCP, IPAddress = $IP, SubnetMask = $SubnetMask, Gateway = $Gateway, `DNSPrimary = $DNSPrimary, `
    		DNSSecondary = $DNSSecondary, SCCMApps = $SCCMApps, ManualApps = $ManualApps, Notes = $Notes, TopConsoleUser = $TopConsoleUser, TCU_FirstName = $TCU_FirstName, `
    		TCU_LastName = $TCU_LastName, TCU_Site = $TCU_Site, TCU_Dept = $TCU_Dept, TCU_JobTitle = $TCU_JobTitle, MgrFirstName = $MgrFirstName, MgrLastName = $MgrLastName `
    		Where ComputerName = $ComputerName"
    	#>
    	#$updateQuery = gc "Y:\RefreshTest\UpdateQuery.sql"
    	try
    	{
    		#Invoke-Sqlcmd -Query $updateQuery -ServerInstance $datasource -Database $database
    		Invoke-Sqlcmd -InputFile "Y:\RefreshTest\UpdateQuery.sql"
    	}
    	catch
    	{
    		Write-Debug $_.Exception.Message
    	}
    }
    
    main
    	

    Thursday, May 11, 2017 9:18 PM
  • As I noted.  You don't need to load all of that stuff.

    You do not need to do any of this on Windows 10:

    <#Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
    Push-Location
    Add-PSSnapin SqlServerCmdletSnapin110
    Add-PSSnapin SqlServerProviderSnapin110
    Update-TypeData -PrependPath SQLProvider.Types.ps1xml
    Update-FormatData -PrependPath SQLProvider.Format.ps1xml
    Pop-Location
    #>
    Import-Module SQLPS -DisableNameChecking
    Get-Module -ListAvailable -Name Sqlps

    PowerShell 5.1 loads all modules on demand assuming they are installed correctly.

    Open a command prompt and type the following:

    Invoke-SqlCmd -Database xxxx -Server yyyy -Query "select * from mytable"

    The modules will load and the query will be executed.  If you get errors then the tools are not correctly installed.

    Example:

    Windows PowerShell
    Copyright (C) 2016 Microsoft Corporation. All rights reserved.
    
    PS>get-module
    
    ModuleType Version    Name                                ExportedCommands
    ---------- -------    ----                                ----------------
    Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Con...
    Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
    Script     1.2        PSReadline                          {Get-PSReadlineKeyHandler, Get-PSReadlineOption, Remove-PS...
    
    
    PS>Invoke-SQlCmd -ServerInstance alpha\SqlExpress -Database localtest -Query 'select * from contacts'
    
    ContactID ContactType ContactName                ContactTitle
    --------- ----------- -----------                ------------
            1 Customer    Maria Anders               Sales Representative
            2 Customer    Ana Trujillo               ssss
            6 Customer    Hanna Moos                 Sales Representative
            8 Customer    Joe Smith                  Owner
            9 Customer    Laurence Lebihan           Owner
    
    PS>get-module
    
    ModuleType Version    Name                                ExportedCommands
    ---------- -------    ----                                ----------------
    Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Con...
    Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
    Script     1.2        PSReadline                          {Get-PSReadlineKeyHandler, Get-PSReadlineOption, Remove-PS...
    Manifest   2.0        SQLASCmdlets                        {Add-RoleMember, Backup-ASDatabase, Invoke-ASCmd, Invoke-P...
    Script     0.0        SqlServer
    Manifest   20.0       SqlServer                           {Add-SqlAvailabilityDatabase, Add-SqlAvailabilityGroupList...
    
    
    PS>
    
    

    Note that the SQLServer modules are loaded automatically.  You may get a different version if you don't have 2012 or later SQLServer installed.


    \_(ツ)_/

    Thursday, May 11, 2017 9:28 PM
  • There is no snap-in.  If the tools are installed then just use the commands. The module will be automatically loaded.

    To run the PS version of sqlps just type "SQLPS" at a cmd or PowerShell prompt.


    \_(ツ)_/


    I tried that, but an error comes up:

    sqlps : import-module : Cannot load Windows PowerShell snap-in X:\ircstm\PCTechs\~~TOOLBOX~~\Powershell Modules\SQLPS\Microsoft

    At line:1 char:1

    .SqlServer.Management.PSSnapins.dll because of the following error: Unable to load one or more of the requested types.

    Retrieve the LoaderExceptions property for more information.

    Loader Exceptions:

    Could not load file or assembly 'Microsoft.SqlServer.BatchParser, Version=11.0.0.0, Culture=neutral, PublicKeyToken=898

    45dcd8080cc91' or one of its dependencies. The system cannot find the file specified.

    Could not load file or assembly 'Microsoft.SqlServer.BatchParser, Version=11.0.0.0, Culture=neutral, PublicKeyToken=898

    45dcd8080cc91' or one of its dependencies. The system cannot find the file specified.

    Could not load file or assembly 'Microsoft.SqlServer.BatchParser, Version=11.0.0.0, Culture=neutral, PublicKeyToken=898

    45dcd8080cc91' or one of its dependencies. The system cannot find the file specified.

    Could not load file or assembly 'Microsoft.SqlServer.BatchParser, Version=11.0.0.0, Culture=neutral, PublicKeyToken=898

    45dcd8080cc91' or one of its dependencies. The system cannot find the file specified.

    At line:1 char:14

    Thursday, May 11, 2017 9:41 PM
  • As I noted.  You don't need to load all of that stuff.

    You do not need to do any of this on Windows 10:

    <#Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
    Push-Location
    Add-PSSnapin SqlServerCmdletSnapin110
    Add-PSSnapin SqlServerProviderSnapin110
    Update-TypeData -PrependPath SQLProvider.Types.ps1xml
    Update-FormatData -PrependPath SQLProvider.Format.ps1xml
    Pop-Location
    #>
    Import-Module SQLPS -DisableNameChecking
    Get-Module -ListAvailable -Name Sqlps

    PowerShell 5.1 loads all modules on demand assuming they are installed correctly.

    Open a command prompt and type the following:

    Invoke-SqlCmd -Database xxxx -Server yyyy -Query "select * from mytable"

    The modules will load and the query will be executed.  If you get errors then the tools are not correctly installed.

    Example:

    Windows PowerShell
    Copyright (C) 2016 Microsoft Corporation. All rights reserved.
    
    PS>get-module
    
    ModuleType Version    Name                                ExportedCommands
    ---------- -------    ----                                ----------------
    Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Con...
    Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
    Script     1.2        PSReadline                          {Get-PSReadlineKeyHandler, Get-PSReadlineOption, Remove-PS...
    
    
    PS>Invoke-SQlCmd -ServerInstance alpha\SqlExpress -Database localtest -Query 'select * from contacts'
    
    ContactID ContactType ContactName                ContactTitle
    --------- ----------- -----------                ------------
            1 Customer    Maria Anders               Sales Representative
            2 Customer    Ana Trujillo               ssss
            6 Customer    Hanna Moos                 Sales Representative
            8 Customer    Joe Smith                  Owner
            9 Customer    Laurence Lebihan           Owner
    
    PS>get-module
    
    ModuleType Version    Name                                ExportedCommands
    ---------- -------    ----                                ----------------
    Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Con...
    Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
    Script     1.2        PSReadline                          {Get-PSReadlineKeyHandler, Get-PSReadlineOption, Remove-PS...
    Manifest   2.0        SQLASCmdlets                        {Add-RoleMember, Backup-ASDatabase, Invoke-ASCmd, Invoke-P...
    Script     0.0        SqlServer
    Manifest   20.0       SqlServer                           {Add-SqlAvailabilityDatabase, Add-SqlAvailabilityGroupList...
    
    
    PS>
    

    Note that the SQLServer modules are loaded automatically.  You may get a different version if you don't have 2012 or later SQLServer installed.


    \_(ツ)_/

         I tried running the Get-Module command and while it shows sqlps, it didn't show any sqlserver modules, as well as not showing anything in ExportedCommands. Also, I tried doing the Invoke-Sqlcmd like you did, but it didn't recognize invoke-sqlcmd as "the name of a cmdlet..."
    Thursday, May 11, 2017 9:52 PM
  • You will need to upgrade your SQLTools to SSMS 2008R2 or later.  The older versions are no longer supported ad will not likely work on Windows 10 with PS 5.1.

    I uninstalled all earlier versions and installed SSMS 2016 and tools which give us many more CmdLets and better performance and loading.


    \_(ツ)_/

    • Proposed as answer by Hello_2018 Saturday, May 27, 2017 6:15 AM
    Thursday, May 11, 2017 10:25 PM