{"action":"created","issue":{"url":"https://api.github.com/repos/sqlcollaborative/dbatools/issues/1004","repository_url":"https://api.github.com/repos/sqlcollaborative/dbatools","labels_url":"https://api.github.com/repos/sqlcollaborative/dbatools/issues/1004/labels{/name}","comments_url":"https://api.github.com/repos/sqlcollaborative/dbatools/issues/1004/comments","events_url":"https://api.github.com/repos/sqlcollaborative/dbatools/issues/1004/events","html_url":"https://github.com/sqlcollaborative/dbatools/issues/1004","id":218236918,"number":1004,"title":"Test-SqlPath does not accept multiple servers","user":{"login":"SQLDBAWithABeard","id":6729780,"avatar_url":"https://avatars3.githubusercontent.com/u/6729780?v=4","gravatar_id":"","url":"https://api.github.com/users/SQLDBAWithABeard","html_url":"https://github.com/SQLDBAWithABeard","followers_url":"https://api.github.com/users/SQLDBAWithABeard/followers","following_url":"https://api.github.com/users/SQLDBAWithABeard/following{/other_user}","gists_url":"https://api.github.com/users/SQLDBAWithABeard/gists{/gist_id}","starred_url":"https://api.github.com/users/SQLDBAWithABeard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SQLDBAWithABeard/subscriptions","organizations_url":"https://api.github.com/users/SQLDBAWithABeard/orgs","repos_url":"https://api.github.com/users/SQLDBAWithABeard/repos","events_url":"https://api.github.com/users/SQLDBAWithABeard/events{/privacy}","received_events_url":"https://api.github.com/users/SQLDBAWithABeard/received_events","type":"User","site_admin":false},"labels":[{"id":173004249,"url":"https://api.github.com/repos/sqlcollaborative/dbatools/labels/Type:%20Enhancement","name":"Type: Enhancement","color":"84b6eb","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2017-03-30T15:30:35Z","updated_at":"2018-02-27T22:08:17Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"### Is this a *feature* OR *bug*:\r\n\r\nfeature\r\n\r\n### System Details\r\n\r\n- Operating system name and version: Windows 10\r\n- Output from `$PSVersionTable`: \r\n\r\n```\r\nPS Presentations:\\> $PSVersionTable\r\n\r\nName                           Value\r\n----                           -----\r\nPSVersion                      5.1.14393.953\r\nPSEdition                      Desktop\r\nPSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}\r\nBuildVersion                   10.0.14393.953\r\nCLRVersion                     4.0.30319.42000\r\nWSManStackVersion              3.0\r\nPSRemotingProtocolVersion      2.3\r\nSerializationVersion           1.1.0.1\r\n```\r\n\r\n- Output of dbatools version:\r\n\r\n```\r\nPS Presentations:\\> (Get-Module dbatools -ListAvailable).Version\r\n\r\nMajor  Minor  Build  Revision\r\n-----  -----  -----  --------\r\n0      8      942    -1\r\n```\r\n\r\n- SQL Server version for source/target\r\n\r\nMultiple from SQL 2005 to SQL vNext (but that's not the point here ;-) )\r\n\r\n### Steps to Reproduce\r\n\r\nGet a list of SQL Servers\r\n$SQLServers = (Get-VM -ComputerName beardnuc).Where{$_.Name -like '*SQL*' -and $_.Name -notlike 'SQL2008Ser2008'}.Name\r\n\r\nrun Test-SqlPath against the array\r\nTest-SqlPath -SqlServer $SQLServers -Path '\\\\BeardNuc\\SQLBackups'\r\n\r\n\r\n### Action Results\r\n\r\nNew-Object : Cannot find an overload for \"Server\" and the argument count: \"10\".\r\nAt line:71 char:12\r\n+ ...   $server = New-Object Microsoft.SqlServer.Management.Smo.Server $Sql ...\r\n+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodException\r\n    + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand\r\n\r\nThe property 'ApplicationName' cannot be found on this object. Verify that the property exists and can be set.\r\n\r\nand then further errors\r\n\r\n### Expected Results\r\n\r\nPS Presentations:\\> Test-SqlPathRob -SqlServer $SQLServers -Path \\\\beardnuc\\sqlbackups\r\n\r\nServer            Result\r\n------            ------\r\n[SQL2005Ser2003]    True\r\n[SQL2012Ser08AG1]   True\r\n[SQL2012Ser08AG2]   True\r\n[SQL2012Ser08AG3]   True\r\n[SQL2014Ser12R2]    True\r\n[SQL2016N1]         True\r\n[SQL2016N2]         True\r\n[SQL2016N3]         True\r\n[SQLVnextN1]        True\r\n[SQLvNextN2]        True\r\n\r\n### Code ????\r\nI used this (without checking any guidelines ;-) ) to get the above results\r\n\r\nforeach($instance in $sqlServer)\r\n{\r\n\t$server = Connect-SqlServer -SqlServer $instance -SqlCredential $SqlCredential\r\n\t$sql = \"EXEC master.dbo.xp_fileexist '$path'\"\r\n\t$fileexist = $server.ConnectionContext.ExecuteWithResults($sql)\r\n\r\n\tif ($fileexist.tables.rows[0] -eq $true -or $fileexist.tables.rows[1] -eq $true)\r\n\t{\r\n\t\t$Result =  $true\r\n\t}\r\n\telse\r\n\t{\r\n\t\t$result = $false\r\n\t}\r\n        [PSCustomObject]@{\r\n    Server = $Server\r\n    Result = $Result\r\n    }\r\n}\r\n"},"comment":{"url":"https://api.github.com/repos/sqlcollaborative/dbatools/issues/comments/369044162","html_url":"https://github.com/sqlcollaborative/dbatools/issues/1004#issuecomment-369044162","issue_url":"https://api.github.com/repos/sqlcollaborative/dbatools/issues/1004","id":369044162,"user":{"login":"niphlod","id":122119,"avatar_url":"https://avatars2.githubusercontent.com/u/122119?v=4","gravatar_id":"","url":"https://api.github.com/users/niphlod","html_url":"https://github.com/niphlod","followers_url":"https://api.github.com/users/niphlod/followers","following_url":"https://api.github.com/users/niphlod/following{/other_user}","gists_url":"https://api.github.com/users/niphlod/gists{/gist_id}","starred_url":"https://api.github.com/users/niphlod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niphlod/subscriptions","organizations_url":"https://api.github.com/users/niphlod/orgs","repos_url":"https://api.github.com/users/niphlod/repos","events_url":"https://api.github.com/users/niphlod/events{/privacy}","received_events_url":"https://api.github.com/users/niphlod/received_events","type":"User","site_admin":false},"created_at":"2018-02-27T22:08:17Z","updated_at":"2018-02-27T22:08:17Z","author_association":"CONTRIBUTOR","body":"assigning myself. most of the scary part was done in https://github.com/sqlcollaborative/dbatools/pull/2715. \r\nFollowing the same deal, we'd just have to add a sqlinstance property to it.\r\nSumming up:\r\n- old days: one instance, one path, output --> bool\r\n- recent days: one instance, multiple paths, output --> pscustomobject with FilePath and FileExists props \r\n- future : one or multiple instances, multiple paths, output --> pscustomobject with FilePath, FileExists, sqlinstance, computername, instancename props\r\nShould not break one thing.\r\n"}}
{"actor":{"display_login":"niphlod"}}