Public/Invoke-RaidinessModule.ps1
|
function Invoke-RaidinessModule { <# .SYNOPSIS Runs one of the optional local module scripts and stores its JSON result next to the core evidence. .DESCRIPTION The optional modules read sources that Graph does not cover (Exchange/Purview, Teams, SharePoint admin, Power Platform). Each is a self-contained, read-only PowerShell script that signs in interactively with the module's own management shell and writes a single JSON result envelope. The report picks the envelope up automatically and switches the module's checks on. The SharePoint module signs in to <name>-admin.sharepoint.com and so needs the tenant name rather than the id. It is derived from a <name>.onmicrosoft.com -TenantId, or read from the Graph session's /organization when you are connected; -TenantName overrides both. .PARAMETER Name Which module to run. .PARAMETER TenantId Your tenant id or default domain, used for the module's sign-in and recorded in the result envelope. Taken from the Graph session when omitted. .PARAMETER TenantName The name before -admin.sharepoint.com (only the sharepoint-admin module uses it). Derived from -TenantId or the Graph session when omitted. .PARAMETER OutputPath Directory the result lands in. Default: ./raidiness-data .PARAMETER HashUpns Replace user names and e-mail addresses in the result with hashes (where the script supports it). The report counts owners and reviewers; it does not need to know them by name. .EXAMPLE Invoke-RaidinessModule -Name exchange-purview -TenantId contoso.onmicrosoft.com .EXAMPLE Invoke-RaidinessModule -Name sharepoint-admin -TenantName contoso -HashUpns #> [CmdletBinding()] param( [Parameter(Mandatory = $true)] [ValidateSet('exchange-purview', 'teams', 'sharepoint-admin', 'power-platform')] [string] $Name, [string] $TenantId, [string] $TenantName, [string] $OutputPath = './raidiness-data', [switch] $HashUpns ) $ErrorActionPreference = 'Stop' $tenant = Resolve-RaidinessTenant -TenantId $TenantId -TenantName $TenantName Invoke-RaidinessModuleScript -Name $Name -TenantId $tenant.TenantId -TenantName $tenant.TenantName -OutputPath $OutputPath -HashUpns:$HashUpns } |