{"action":"created","comment":{"url":"https://api.github.com/repos/sqlcollaborative/dbatools/pulls/comments/92204111","pull_request_review_id":12714858,"id":92204111,"diff_hunk":"@@ -0,0 +1,130 @@\n+﻿Function Get-DbaRoleMember\r\n+{\r\n+<#\r\n+.SYNOPSIS\r\n+Get members of all roles on a Sql instance.\r\n+\r\n+.DESCRIPTION\r\n+Get members of all roles on a Sql instance.\r\n+\r\n+Default output includes columns SQLServer, Database, Role, Member.\r\n+\r\n+.PARAMETER SQLInstance\r\n+The SQL Server that you're connecting to.\r\n+\r\n+.PARAMETER IncludeServerLevel\r\n+Shows also information on Server Level Permissions.\r\n+\r\n+.PARAMETER NoFixedRole\r\n+Excludes all members of fixed roles.\r\n+\r\n+.PARAMETER Credential\r\n+Credential object used to connect to the SQL Server as a different user.\r\n+\r\n+.NOTES\r\n+Author: Klaas Vandenberghe ( @PowerDBAKlaas )\r\n+\r\n+dbatools PowerShell module (https://dbatools.io)\r\n+Copyright (C) 2016 Chrissy LeMaire\r\n+This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r\n+This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\r\n+You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.\r\n+\r\n+.LINK\r\n+ https://dbatools.io/Get-DbaRoleMember\r\n+\r\n+.EXAMPLE\r\n+Get-DbaRoleMember -SQLInstance ServerA\r\n+\r\n+Returns a custom object displaying SQLServer, Database, Role, Member for all DatabaseRoles.\r\n+\r\n+.EXAMPLE\r\n+Get-DbaRoleMember -SQLInstance ServerA\\sql987 | Out-Gridview\r\n+\r\n+Returns a gridview displaying SQLServer, Database, Role, Member for all DatabaseRoles.\r\n+\r\n+.EXAMPLE\r\n+Get-DbaRoleMember -SQLInstance ServerA\\sql987 -IncludeServerLevel\r\n+\r\n+Returns a gridview displaying SQLServer, Database, Role, Member for both ServerRoles and DatabaseRoles.\r\n+\r\n+#>\r\n+\t[CmdletBinding()]\r\n+\tParam (\r\n+\t\t[parameter(Mandatory = $true, ValueFromPipeline = $true)]\r\n+\t\t[Alias(\"sqlserver\",\"server\",\"instance\")]\r\n+\t\t[string[]]$sqlinstance,\r\n+\t\t[PsCredential]$sqlCredential,\r\n+\t\t[switch]$IncludeServerLevel,\r\n+\t\t[switch]$NoFixedRole\r\n+\t)\r\n+\r\n+    BEGIN {}\r\n+    PROCESS {\r\n+        foreach ($servername in $sqlinstance)\r\n+            {\r\n+            $server = $null\r\n+            $server = Connect-SqlServer -SqlServer $servername -SqlCredential $sqlCredential\r\n+            if ($Server.count -eq 1)\r\n+\t\t\t\t{\r\n+                if ($IncludeServerLevel)\r\n+                    {\r\n+                    Write-Verbose \"Server Role Members included\"\r\n+                    $instroles = $null\r\n+                    Write-Verbose \"Getting Server Roles on $($servername)\"\r\n+                    $instroles = $server.roles\r\n+                    if ($NoFixedRole)\r\n+                        {\r\n+                        $instroles =  $instroles | where { $_.isfixedrole -eq $false }\r\n+                        }\r\n+                    ForEach ($instrole in $instroles)\r\n+                        {\r\n+                        Write-Verbose \"Getting Server Role Members for $instrole on $($servername)\"\r\n+                        $irmembers = $null\r\n+                        $irmembers = $instrole.enumserverrolemembers()\r\n+                        ForEach ($irmem in $irmembers)\r\n+                            {\r\n+                            [PSCustomObject]@{  'SQLInstance' = $servername;\r\n+                                                'Database' = $null;\r\n+                                                'Role' = $instrole.name;\r\n+                                                'member' = $irmem.tostring();\r\n+                                                }\r\n+                            }\r\n+                        }\r\n+                    }\r\n+                $dbs = $null\r\n+                $dbs = $server.Databases\r\n+                foreach ($db in $dbs)\r\n+                    {\r\n+                    $dbroles = $null\r\n+                    Write-Verbose \"Getting Database Roles for $($db.name) on $($servername)\"\r\n+                    $dbroles = $db.roles\r\n+                    if ($NoFixedRole)\r\n+                        {\r\n+                        $dbroles =  $dbroles | where { $_.isfixedrole -eq $false }\r\n+                        }\r\n+                    foreach ($dbrole in $dbroles)\r\n+                        {\r\n+                        $dbmembers = $null\r\n+                        Write-Verbose \"Getting Database Role Members for $dbrole in $($db.name) on $($servername)\"\r","path":"functions/Get-DbaRoleMember.ps1","position":109,"original_position":109,"commit_id":"a905f54358faf72b51223cba278838f0fb2e6711","original_commit_id":"a905f54358faf72b51223cba278838f0fb2e6711","user":{"login":"ctrlbold","id":8278033,"avatar_url":"https://avatars.githubusercontent.com/u/8278033?v=3","gravatar_id":"","url":"https://api.github.com/users/ctrlbold","html_url":"https://github.com/ctrlbold","followers_url":"https://api.github.com/users/ctrlbold/followers","following_url":"https://api.github.com/users/ctrlbold/following{/other_user}","gists_url":"https://api.github.com/users/ctrlbold/gists{/gist_id}","starred_url":"https://api.github.com/users/ctrlbold/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctrlbold/subscriptions","organizations_url":"https://api.github.com/users/ctrlbold/orgs","repos_url":"https://api.github.com/users/ctrlbold/repos","events_url":"https://api.github.com/users/ctrlbold/events{/privacy}","received_events_url":"https://api.github.com/users/ctrlbold/received_events","type":"User","site_admin":false},"body":"Should just be $servername","created_at":"2016-12-13T16:17:07Z","updated_at":"2016-12-13T16:17:07Z","html_url":"https://github.com/sqlcollaborative/dbatools/pull/363#discussion_r92204111","pull_request_url":"https://api.github.com/repos/sqlcollaborative/dbatools/pulls/363","_links":{"self":{"href":"https://api.github.com/repos/sqlcollaborative/dbatools/pulls/comments/92204111"},"html":{"href":"https://github.com/sqlcollaborative/dbatools/pull/363#discussion_r92204111"},"pull_request":{"href":"https://api.github.com/repos/sqlcollaborative/dbatools/pulls/363"}}},"pull_request":{"url":"https://api.github.com/repos/sqlcollaborative/dbatools/pulls/363","id":96109881,"html_url":"https://github.com/sqlcollaborative/dbatools/pull/363","diff_url":"https://github.com/sqlcollaborative/dbatools/pull/363.diff","patch_url":"https://github.com/sqlcollaborative/dbatools/pull/363.patch","issue_url":"https://api.github.com/repos/sqlcollaborative/dbatools/issues/363","number":363,"state":"open","locked":false,"title":"Initial commit of Get-DbaRolemember - attempt 2","user":{"login":"PowerDBAKlaas","id":22813386,"avatar_url":"https://avatars.githubusercontent.com/u/22813386?v=3","gravatar_id":"","url":"https://api.github.com/users/PowerDBAKlaas","html_url":"https://github.com/PowerDBAKlaas","followers_url":"https://api.github.com/users/PowerDBAKlaas/followers","following_url":"https://api.github.com/users/PowerDBAKlaas/following{/other_user}","gists_url":"https://api.github.com/users/PowerDBAKlaas/gists{/gist_id}","starred_url":"https://api.github.com/users/PowerDBAKlaas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PowerDBAKlaas/subscriptions","organizations_url":"https://api.github.com/users/PowerDBAKlaas/orgs","repos_url":"https://api.github.com/users/PowerDBAKlaas/repos","events_url":"https://api.github.com/users/PowerDBAKlaas/events{/privacy}","received_events_url":"https://api.github.com/users/PowerDBAKlaas/received_events","type":"User","site_admin":false},"body":"Tests for tester:\r\n- [ ] Working/useful help content, including link to command on dbatools web site\r\n- [ ] All examples work as advertised\r\n- [ ] Does not contain template content\r\n- [ ] Does not contain excessive/unnecessary amounts of comments\r\n- [ ] Works remotely\r\n- [ ] Works locally\r\n- [ ] Works on lower versions or throws error specifying version not supported\r\n- [ ] Works with named instances\r\n- [ ] Works with clustered instances\r\n- [ ] Handles offline/read only databases\r\n- [ ] Supports multiple servers (at the command line or piped from Get-SqlRegisteredServerName)\r\n- [ ] No un-handled errors which stop the command working with multiple servers\r\n\r\n\r\n","created_at":"2016-12-01T15:28:47Z","updated_at":"2016-12-13T16:17:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f754fe729c535513e3b28ca2d58d30c1bf0ab5cd","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/sqlcollaborative/dbatools/pulls/363/commits","review_comments_url":"https://api.github.com/repos/sqlcollaborative/dbatools/pulls/363/comments","review_comment_url":"https://api.github.com/repos/sqlcollaborative/dbatools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sqlcollaborative/dbatools/issues/363/comments","statuses_url":"https://api.github.com/repos/sqlcollaborative/dbatools/statuses/a905f54358faf72b51223cba278838f0fb2e6711","head":{"label":"sqlcollaborative:New_Get-DbaRoleMember","ref":"New_Get-DbaRoleMember","sha":"a905f54358faf72b51223cba278838f0fb2e6711","user":{"login":"sqlcollaborative","id":22203347,"avatar_url":"https://avatars.githubusercontent.com/u/22203347?v=3","gravatar_id":"","url":"https://api.github.com/users/sqlcollaborative","html_url":"https://github.com/sqlcollaborative","followers_url":"https://api.github.com/users/sqlcollaborative/followers","following_url":"https://api.github.com/users/sqlcollaborative/following{/other_user}","gists_url":"https://api.github.com/users/sqlcollaborative/gists{/gist_id}","starred_url":"https://api.github.com/users/sqlcollaborative/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sqlcollaborative/subscriptions","organizations_url":"https://api.github.com/users/sqlcollaborative/orgs","repos_url":"https://api.github.com/users/sqlcollaborative/repos","events_url":"https://api.github.com/users/sqlcollaborative/events{/privacy}","received_events_url":"https://api.github.com/users/sqlcollaborative/received_events","type":"Organization","site_admin":false},"repo":{"id":30215226,"name":"dbatools","full_name":"sqlcollaborative/dbatools","owner":{"login":"sqlcollaborative","id":22203347,"avatar_url":"https://avatars.githubusercontent.com/u/22203347?v=3","gravatar_id":"","url":"https://api.github.com/users/sqlcollaborative","html_url":"https://github.com/sqlcollaborative","followers_url":"https://api.github.com/users/sqlcollaborative/followers","following_url":"https://api.github.com/users/sqlcollaborative/following{/other_user}","gists_url":"https://api.github.com/users/sqlcollaborative/gists{/gist_id}","starred_url":"https://api.github.com/users/sqlcollaborative/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sqlcollaborative/subscriptions","organizations_url":"https://api.github.com/users/sqlcollaborative/orgs","repos_url":"https://api.github.com/users/sqlcollaborative/repos","events_url":"https://api.github.com/users/sqlcollaborative/events{/privacy}","received_events_url":"https://api.github.com/users/sqlcollaborative/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sqlcollaborative/dbatools","description":"PowerShell module to help dbas be more productive","fork":false,"url":"https://api.github.com/repos/sqlcollaborative/dbatools","forks_url":"https://api.github.com/repos/sqlcollaborative/dbatools/forks","keys_url":"https://api.github.com/repos/sqlcollaborative/dbatools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sqlcollaborative/dbatools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sqlcollaborative/dbatools/teams","hooks_url":"https://api.github.com/repos/sqlcollaborative/dbatools/hooks","issue_events_url":"https://api.github.com/repos/sqlcollaborative/dbatools/issues/events{/number}","events_url":"https://api.github.com/repos/sqlcollaborative/dbatools/events","assignees_url":"https://api.github.com/repos/sqlcollaborative/dbatools/assignees{/user}","branches_url":"https://api.github.com/repos/sqlcollaborative/dbatools/branches{/branch}","tags_url":"https://api.github.com/repos/sqlcollaborative/dbatools/tags","blobs_url":"https://api.github.com/repos/sqlcollaborative/dbatools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sqlcollaborative/dbatools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sqlcollaborative/dbatools/git/refs{/sha}","trees_url":"https://api.github.com/repos/sqlcollaborative/dbatools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sqlcollaborative/dbatools/statuses/{sha}","languages_url":"https://api.github.com/repos/sqlcollaborative/dbatools/languages","stargazers_url":"https://api.github.com/repos/sqlcollaborative/dbatools/stargazers","contributors_url":"https://api.github.com/repos/sqlcollaborative/dbatools/contributors","subscribers_url":"https://api.github.com/repos/sqlcollaborative/dbatools/subscribers","subscription_url":"https://api.github.com/repos/sqlcollaborative/dbatools/subscription","commits_url":"https://api.github.com/repos/sqlcollaborative/dbatools/commits{/sha}","git_commits_url":"https://api.github.com/repos/sqlcollaborative/dbatools/git/commits{/sha}","comments_url":"https://api.github.com/repos/sqlcollaborative/dbatools/comments{/number}","issue_comment_url":"https://api.github.com/repos/sqlcollaborative/dbatools/issues/comments{/number}","contents_url":"https://api.github.com/repos/sqlcollaborative/dbatools/contents/{+path}","compare_url":"https://api.github.com/repos/sqlcollaborative/dbatools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sqlcollaborative/dbatools/merges","archive_url":"https://api.github.com/repos/sqlcollaborative/dbatools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sqlcollaborative/dbatools/downloads","issues_url":"https://api.github.com/repos/sqlcollaborative/dbatools/issues{/number}","pulls_url":"https://api.github.com/repos/sqlcollaborative/dbatools/pulls{/number}","milestones_url":"https://api.github.com/repos/sqlcollaborative/dbatools/milestones{/number}","notifications_url":"https://api.github.com/repos/sqlcollaborative/dbatools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sqlcollaborative/dbatools/labels{/name}","releases_url":"https://api.github.com/repos/sqlcollaborative/dbatools/releases{/id}","deployments_url":"https://api.github.com/repos/sqlcollaborative/dbatools/deployments","created_at":"2015-02-02T23:50:31Z","updated_at":"2016-12-12T21:44:23Z","pushed_at":"2016-12-13T16:10:05Z","git_url":"git://github.com/sqlcollaborative/dbatools.git","ssh_url":"git@github.com:sqlcollaborative/dbatools.git","clone_url":"https://github.com/sqlcollaborative/dbatools.git","svn_url":"https://github.com/sqlcollaborative/dbatools","homepage":"https://dbatools.io","size":2296,"stargazers_count":179,"watchers_count":179,"language":"PowerShell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":90,"mirror_url":null,"open_issues_count":125,"forks":90,"open_issues":125,"watchers":179,"default_branch":"master"}},"base":{"label":"sqlcollaborative:development","ref":"development","sha":"df8fdbaf8eed73ebe6b004927a38f761ee8f9834","user":{"login":"sqlcollaborative","id":22203347,"avatar_url":"https://avatars.githubusercontent.com/u/22203347?v=3","gravatar_id":"","url":"https://api.github.com/users/sqlcollaborative","html_url":"https://github.com/sqlcollaborative","followers_url":"https://api.github.com/users/sqlcollaborative/followers","following_url":"https://api.github.com/users/sqlcollaborative/following{/other_user}","gists_url":"https://api.github.com/users/sqlcollaborative/gists{/gist_id}","starred_url":"https://api.github.com/users/sqlcollaborative/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sqlcollaborative/subscriptions","organizations_url":"https://api.github.com/users/sqlcollaborative/orgs","repos_url":"https://api.github.com/users/sqlcollaborative/repos","events_url":"https://api.github.com/users/sqlcollaborative/events{/privacy}","received_events_url":"https://api.github.com/users/sqlcollaborative/received_events","type":"Organization","site_admin":false},"repo":{"id":30215226,"name":"dbatools","full_name":"sqlcollaborative/dbatools","owner":{"login":"sqlcollaborative","id":22203347,"avatar_url":"https://avatars.githubusercontent.com/u/22203347?v=3","gravatar_id":"","url":"https://api.github.com/users/sqlcollaborative","html_url":"https://github.com/sqlcollaborative","followers_url":"https://api.github.com/users/sqlcollaborative/followers","following_url":"https://api.github.com/users/sqlcollaborative/following{/other_user}","gists_url":"https://api.github.com/users/sqlcollaborative/gists{/gist_id}","starred_url":"https://api.github.com/users/sqlcollaborative/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sqlcollaborative/subscriptions","organizations_url":"https://api.github.com/users/sqlcollaborative/orgs","repos_url":"https://api.github.com/users/sqlcollaborative/repos","events_url":"https://api.github.com/users/sqlcollaborative/events{/privacy}","received_events_url":"https://api.github.com/users/sqlcollaborative/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sqlcollaborative/dbatools","description":"PowerShell module to help dbas be more productive","fork":false,"url":"https://api.github.com/repos/sqlcollaborative/dbatools","forks_url":"https://api.github.com/repos/sqlcollaborative/dbatools/forks","keys_url":"https://api.github.com/repos/sqlcollaborative/dbatools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sqlcollaborative/dbatools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sqlcollaborative/dbatools/teams","hooks_url":"https://api.github.com/repos/sqlcollaborative/dbatools/hooks","issue_events_url":"https://api.github.com/repos/sqlcollaborative/dbatools/issues/events{/number}","events_url":"https://api.github.com/repos/sqlcollaborative/dbatools/events","assignees_url":"https://api.github.com/repos/sqlcollaborative/dbatools/assignees{/user}","branches_url":"https://api.github.com/repos/sqlcollaborative/dbatools/branches{/branch}","tags_url":"https://api.github.com/repos/sqlcollaborative/dbatools/tags","blobs_url":"https://api.github.com/repos/sqlcollaborative/dbatools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sqlcollaborative/dbatools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sqlcollaborative/dbatools/git/refs{/sha}","trees_url":"https://api.github.com/repos/sqlcollaborative/dbatools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sqlcollaborative/dbatools/statuses/{sha}","languages_url":"https://api.github.com/repos/sqlcollaborative/dbatools/languages","stargazers_url":"https://api.github.com/repos/sqlcollaborative/dbatools/stargazers","contributors_url":"https://api.github.com/repos/sqlcollaborative/dbatools/contributors","subscribers_url":"https://api.github.com/repos/sqlcollaborative/dbatools/subscribers","subscription_url":"https://api.github.com/repos/sqlcollaborative/dbatools/subscription","commits_url":"https://api.github.com/repos/sqlcollaborative/dbatools/commits{/sha}","git_commits_url":"https://api.github.com/repos/sqlcollaborative/dbatools/git/commits{/sha}","comments_url":"https://api.github.com/repos/sqlcollaborative/dbatools/comments{/number}","issue_comment_url":"https://api.github.com/repos/sqlcollaborative/dbatools/issues/comments{/number}","contents_url":"https://api.github.com/repos/sqlcollaborative/dbatools/contents/{+path}","compare_url":"https://api.github.com/repos/sqlcollaborative/dbatools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sqlcollaborative/dbatools/merges","archive_url":"https://api.github.com/repos/sqlcollaborative/dbatools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sqlcollaborative/dbatools/downloads","issues_url":"https://api.github.com/repos/sqlcollaborative/dbatools/issues{/number}","pulls_url":"https://api.github.com/repos/sqlcollaborative/dbatools/pulls{/number}","milestones_url":"https://api.github.com/repos/sqlcollaborative/dbatools/milestones{/number}","notifications_url":"https://api.github.com/repos/sqlcollaborative/dbatools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sqlcollaborative/dbatools/labels{/name}","releases_url":"https://api.github.com/repos/sqlcollaborative/dbatools/releases{/id}","deployments_url":"https://api.github.com/repos/sqlcollaborative/dbatools/deployments","created_at":"2015-02-02T23:50:31Z","updated_at":"2016-12-12T21:44:23Z","pushed_at":"2016-12-13T16:10:05Z","git_url":"git://github.com/sqlcollaborative/dbatools.git","ssh_url":"git@github.com:sqlcollaborative/dbatools.git","clone_url":"https://github.com/sqlcollaborative/dbatools.git","svn_url":"https://github.com/sqlcollaborative/dbatools","homepage":"https://dbatools.io","size":2296,"stargazers_count":179,"watchers_count":179,"language":"PowerShell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":90,"mirror_url":null,"open_issues_count":125,"forks":90,"open_issues":125,"watchers":179,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sqlcollaborative/dbatools/pulls/363"},"html":{"href":"https://github.com/sqlcollaborative/dbatools/pull/363"},"issue":{"href":"https://api.github.com/repos/sqlcollaborative/dbatools/issues/363"},"comments":{"href":"https://api.github.com/repos/sqlcollaborative/dbatools/issues/363/comments"},"review_comments":{"href":"https://api.github.com/repos/sqlcollaborative/dbatools/pulls/363/comments"},"review_comment":{"href":"https://api.github.com/repos/sqlcollaborative/dbatools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sqlcollaborative/dbatools/pulls/363/commits"},"statuses":{"href":"https://api.github.com/repos/sqlcollaborative/dbatools/statuses/a905f54358faf72b51223cba278838f0fb2e6711"}}}}
{"actor":{"display_login":"ctrlbold"}}