-
Notifications
You must be signed in to change notification settings - Fork 399
Closed
Labels
Description
Steps to reproduce
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[System.String]$UserName,
[Parameter(Mandatory = $true)]
[System.Security.SecureString]$Password,
[Parameter(Mandatory = $true)]
[System.String]$TenantId,
[Parameter(Mandatory = $false)]
[System.Int32]$DaysToKeep = 30,
[Parameter(Mandatory = $false)]
[System.String]$UsersLimit = 30,
[Parameter(Mandatory = $false)]
[bool]$Force = $false
)
#did not put the whole script because it's kinda big
$inactiveUsers = $users.value | Where-Object {
($_.accessLevel.licenseDisplayName -eq "Basic" -or $_.accessLevel.licenseDisplayName -eq "Basic + Test Plans" -or $_.accessLevel.licenseDisplayName -eq "Stakeholder") -and
($_.user.principalName -notin $usersWhitelist) -and
($_.user.mailAddress -ne $organizationOwnerEmail) -and
([DateTime]::Parse($_.lastAccessedDate) -lt (Get-Date).AddDays(-$DaysToKeep))
}
Expected behavior
No warnings
Actual behavior
Invoke-ScriptAnalyzer -Path .\RemoveInactiveUsers.ps1 -Recurse
RuleName Severity ScriptName Line Message
-------- -------- ---------- ---- -------
PSReviewUnusedParameter Warning RemoveInac 55 The parameter 'DaysToKeep' has been declared but not used.
tiveUsers.
ps1
If an unexpected error was thrown then please report the full error details using e.g. $error[0] | Select-Object *
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 7.3.4
PSEdition Core
GitCommitId 7.3.4
OS Microsoft Windows 10.0.19045
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }
1.21.0