Private/Show-IOWelcome.ps1
|
function Show-IOWelcome { [CmdletBinding()] param( [string]$UserPrincipalName, [string]$TenantId, [string]$TenantName, [string]$AuthFlow ) $ver = (Get-Module IdentityOps -ErrorAction SilentlyContinue).Version if (-not $ver) { $ver = '1.0.0' } $user = if ($UserPrincipalName) { $UserPrincipalName } else { 'Service Principal / Managed Identity' } $tenant = if ($TenantName) { "$TenantName ($TenantId)" } else { $TenantId } $w = 72 $border = [string]::new([char]0x2550, $w) $thin = [string]::new([char]0x2500, $w - 2) $V = [char]0x2551 function Pad([string]$t) { $max = $w - 2 if ($t.Length -gt $max) { $t = $t.Substring(0, $max) } return " $t$(' ' * ($max - $t.Length)) " } # Build ASCII art lines safely (avoid nested quote parsing issues) $art = @( ' ___ ____ _____ _ _ _____ ___ _______ __' ' |_ _| _ \| ____| \ | |_ _|_ _|_ _\ \ / /' ' | || | | | _| | \| | | | | | | | \ V / ' ' | || |_| | |___| |\ | | | | | | | | | ' ' |___|____/|_____|_| \_| |_| |___| |_| |_| ' ' ___ ____ ____ ' ' / _ \| _ \/ ___| ' ' | | | | |_) \___ \ ' ' | |_| | __/ ___) | ' ' \___/|_| |____/ ' ) Write-Host "" Write-Host " $([char]0x2554)$border$([char]0x2557)" -ForegroundColor Cyan Write-Host " $V$(Pad '')$V" -ForegroundColor Cyan foreach ($line in $art) { Write-Host " $V$(Pad $line)$V" -ForegroundColor Cyan } Write-Host " $V$(Pad '')$V" -ForegroundColor Cyan Write-Host " $V$(Pad " Microsoft Graph Identity Operations Toolkit v$ver")$V" -ForegroundColor Cyan Write-Host " $V$(Pad '')$V" -ForegroundColor Cyan Write-Host " $([char]0x2560)$border$([char]0x2563)" -ForegroundColor Cyan Write-Host " $V$(Pad " Connected as : $user")$V" -ForegroundColor Green Write-Host " $V$(Pad " Tenant : $tenant")$V" -ForegroundColor Green Write-Host " $V$(Pad " Auth Flow : $AuthFlow")$V" -ForegroundColor Green Write-Host " $V$(Pad " Connected at : $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')")$V" -ForegroundColor Green Write-Host " $([char]0x2560)$border$([char]0x2563)" -ForegroundColor Cyan Write-Host " $V$(Pad '')$V" -ForegroundColor Cyan Write-Host " $V$(Pad ' Quick Start Commands:')$V" -ForegroundColor Yellow Write-Host " $V$(Pad " $thin")$V" -ForegroundColor DarkGray Write-Host " $V$(Pad ' 1. Get-IOExpiringSecrets Find app secrets/certs near expiry')$V" -ForegroundColor White Write-Host " $V$(Pad ' 2. Get-IOStaleGuests Detect inactive guest accounts')$V" -ForegroundColor White Write-Host " $V$(Pad ' 3. Get-IOOrphanedApps Apps with zero owners assigned')$V" -ForegroundColor White Write-Host " $V$(Pad ' 4. Get-IOUsersWithoutMFA Users with no MFA methods')$V" -ForegroundColor White Write-Host " $V$(Pad ' 5. Get-IOOverPrivilegedApps Apps with excessive permissions')$V" -ForegroundColor White Write-Host " $V$(Pad '')$V" -ForegroundColor Cyan $tipLine = ' Tip: Add -ToCsv "report.csv" to any command for CSV export' Write-Host " $V$(Pad $tipLine)$V" -ForegroundColor DarkYellow Write-Host " $V$(Pad ' All: Get-Command -Module IdentityOps | Select-Object Name')$V" -ForegroundColor DarkYellow Write-Host " $V$(Pad '')$V" -ForegroundColor Cyan Write-Host " $([char]0x255A)$border$([char]0x255D)" -ForegroundColor Cyan Write-Host "" } |