Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Issue when running server with multiple sql instances. #6

@DDdgf

Description

@DDdgf
# Get a list of all SQL Instances on the current server;
$SQLInstances = Get-SQLInstance -ComputerName $env:COMPUTERNAME

The first instances returned will have it's Instance set to an array of all instances name
and will fail on the first Connect-SQL attempt

Loop through all SQL Instances and extract their DSC information;

foreach($sqlInstance in $SQLInstances)
{        
    $Script:sqlConnectionInfo = Connect-SQL -SQLServer $sqlInstance.sqlserver -SQLInstanceName **$sqlInstance.Instance**

Connect-SQL : Cannot process argument transformation on parameter 'SQLInstanceName'. Cannot convert value to type System.String.
At C:\Temp\SQLServerDSC.Reverse.ps1:86 char:100

  • ... LServer $sqlInstance.sqlserver -SQLInstanceName $sqlInstance.Instance
  •                                                 ~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidData: (:) [Connect-SQL], ParameterBindingArgumentTransformationException
    • FullyQualifiedErrorId : ParameterArgumentTransformationError,Connect-SQL

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions