Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues while passing Computer name parameter of type Dataplat.Dbatools.Parameter.DbaInstanceParameter[] using variable in update-dbainstance #9343

Closed
Poojacheshmish opened this issue May 8, 2024 · 2 comments
Labels
bugs life pending OP feedback Waiting for feedback from the OP of the issue

Comments

@Poojacheshmish
Copy link

Verified issue does not already exist?

No, I did not search

What error did you receive?

"Cannot convert
value "DEDA1W9262,DEDA1W9261" to type
"Dataplat.Dbatools.Parameter.DbaInstanceParameter". Error: "Failed to parse
instance name: DEDA1W9262,DEDA1W9261""
At C:\Users\sadm-X265343\Desktop\Final Code.ps1:20 char:34

  • Update-DbaInstance -ComputerName $Serverslist -Credential $Creds -KB ...
  •                              ~~~~~~~~~~~~
    
    • CategoryInfo : InvalidData: (:) [Update-DbaInstance], ParameterB
      indingArgumentTransformationException
    • FullyQualifiedErrorId : ParameterArgumentTransformationError,Update-DbaIn
      stance

Steps to Reproduce

# provide your command(s) executed pertaining to dbatools
# please include variable values (redacted or fake if needed) for reference
``
$Serverslist=DXXXX1W9262,DXXXX1W9261
$creds= pscredential
$patch=KB5033663

Update-DbaInstance -ComputerName $Serverslist -Credential $Creds -KB $Patch -Download -Path "C:\Temp\SQLPatches"  -Confirm:$false -Restart


### Please confirm that you are running the most recent version of dbatools

Major  Minor  Build  Revision
-----  -----  -----  --------
2      1      14     -1  

### Other details or mentions

-computerName works fine if you are passing single computer name not with mutliple remote machines

### What PowerShell host was used when producing this error

Windows PowerShell ISE (powershell_ise.exe)

### PowerShell Host Version

$PSVersionTable

Name                           Value                                            
----                           -----                                            
PSVersion                      5.1.17763.5576                                   
PSEdition                      Desktop                                          
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                          
BuildVersion                   10.0.17763.5576                                  
CLRVersion                     4.0.30319.42000                                  
WSManStackVersion              3.0                                              
PSRemotingProtocolVersion      2.3                                              
SerializationVersion           1.1.0.1  

### SQL Server Edition and Build number

SQL Server - Product version: 15.0.4365.2, file version: 2019.150.4365.2

### .NET Framework Version

.NET Framework 4.8.4645.0
@Poojacheshmish Poojacheshmish added bugs life triage required New issue that has not been reviewed by maintainers labels May 8, 2024
@andreasjordan
Copy link
Contributor

$Serverslist=DXXXX1W9262,DXXXX1W9261 is incorrect PowerShell syntax.

If you use $Serverslist='DXXXX1W9262', 'DXXXX1W9261', the command should work fine, because $Serverlist is an array containing two strings. If you use $Serverslist='DXXXX1W9262,DXXXX1W9261', then this is only one string that is not parsable as an instance name.

@andreasjordan andreasjordan added pending OP feedback Waiting for feedback from the OP of the issue and removed triage required New issue that has not been reviewed by maintainers labels May 11, 2024
@potatoqualitee
Copy link
Member

@andreasjordan that is certainly the problem, will close this. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugs life pending OP feedback Waiting for feedback from the OP of the issue
Projects
None yet
Development

No branches or pull requests

3 participants