88param (
99 [string ] [Parameter (Mandatory = $false )] $org = " miljodir" ,
1010 [string ] [Parameter (Mandatory = $false )] $advancedSecurityProduct ,
11- [string ] [Parameter (Mandatory = $false )] $workspaceId = " xxx"
11+ [string ] [Parameter (Mandatory = $false )] $workspaceId = " xxx" ,
12+ [int ] [Parameter (Mandatory = $false )] $inactiveDays = 90
1213)
1314
1415function Get-GitHubApiPages {
@@ -158,7 +159,7 @@ $advancedSecurityRepositories = Get-GitHubApiItems `
158159 - Endpoint " /orgs/$org /settings/billing/advanced-security?$ ( $advancedSecurityQueryParameters -join ' &' ) " `
159160 - CollectionProperties @ (" repositories" )
160161
161- $recentActivityCutoff = (Get-Date ).AddDays(-90 )
162+ $recentActivityCutoff = (Get-Date ).AddDays(- $inactiveDays )
162163$recentGithubPushers = $advancedSecurityRepositories `
163164 | ForEach-Object { $_.advanced_security_committers_breakdown } `
164165 | Group-Object user_login `
@@ -231,8 +232,8 @@ $allGithubUsers = $orgMembers | Select-Object -ExpandProperty login | Sort-Objec
231232# Successful Github Logins
232233$githubLoginQuery = @"
233234SigninLogs
234- | where AppDisplayName == "GitHub Enterprise Cloud"
235- | where TimeGenerated >= ago(90d )
235+ | where AppDisplayName startswith( "GitHub Enterprise Cloud")
236+ | where TimeGenerated >= ago($ ( $inactiveDays ) d )
236237| where ResultType !in ("50074","500121","70044","50105","50126")
237238| summarize arg_max(TimeGenerated, *) by UserPrincipalName
238239| sort by TimeGenerated asc
@@ -248,6 +249,6 @@ $missingNames = $allGithubUsers `
248249 | Select-Object ' GitHub com saml name' , ' GitHub com login' `
249250 | ForEach-Object { $_ .' GitHub com saml name' + " (" + $_ .' GitHub com login' + " )" }
250251
251- Write-Host " `n The following names have not signed in to the Github org for at least the past 90 days" - ForegroundColor Red
252+ Write-Host " `n The following names have not signed in to the Github org for at least the past $inactiveDays days" - ForegroundColor Red
252253Write-Host " Note that some users may have signed in to other orgs under the enterprise, and are still requiring a license." - ForegroundColor Yellow
253254$missingNames | ForEach-Object { Write-Host $_ }
0 commit comments