@@ -358,6 +358,23 @@ function Invoke-AADAssessmentDataCollection {
358
358
Remove-Item - Path (Join-Path $OutputDirectoryAAD " *" ) - Include " *Data.csv" - ErrorAction Ignore
359
359
}
360
360
361
+ # ## Package Output
362
+ if (! $SkipPackaging ) {
363
+ Write-AppInsightsTrace (" {0} - Package Output" -f $MyInvocation.MyCommand.Name ) - SeverityLevel Verbose - IncludeProcessStatistics - OrderedProperties (Get-ReferencedIdCacheDetail $ReferencedIdCache )
364
+ Write-Progress - Id 0 - Activity (' Microsoft Azure AD Assessment - {0}' -f $InitialTenantDomain ) - Status ' Packaging Data' - PercentComplete 95
365
+
366
+ # ## Remove pre existing package (zip) if it exists
367
+ if (Test-Path - Path $PackagePath ) { Remove-Item $PackagePath - Force }
368
+
369
+ # ## Package Output
370
+ # Compress-Archive (Join-Path $OutputDirectoryData '\*') -DestinationPath $PackagePath -Force -ErrorAction Stop
371
+ [System.IO.Compression.ZipFile ]::CreateFromDirectory($OutputDirectoryData , $PackagePath )
372
+ $PackageFileInfo = Get-Item $PackagePath
373
+ Write-AppInsightsTrace (" {0} - Package Complete" -f $MyInvocation.MyCommand.Name ) - SeverityLevel Verbose - IncludeProcessStatistics - OrderedProperties ((Get-ReferencedIdCacheDetail $ReferencedIdCache ) + [ordered ]@ { PackageSize = Format-NumberWithUnit $PackageFileInfo.Length ' B' ; PackageSizeInBytes = $PackageFileInfo.Length })
374
+
375
+ Remove-Item $OutputDirectoryData - Recurse - Force
376
+ }
377
+
361
378
# ## Complete
362
379
Write-Progress - Id 0 - Activity (' Microsoft Azure AD Assessment - {0}' -f $InitialTenantDomain ) - Completed
363
380
@@ -372,21 +389,6 @@ function Invoke-AADAssessmentDataCollection {
372
389
# Stop-Transcript
373
390
# $Error | Select-Object -Last ($Error.Count - $ErrorStartCount) | Export-Clixml -Path (Join-Path $OutputDirectoryData "PowerShell_errors.xml") -Depth 10
374
391
375
- if (! $SkipPackaging ) {
376
- Write-AppInsightsTrace (" {0} - Package" -f $MyInvocation.MyCommand.Name ) - SeverityLevel Verbose - IncludeProcessStatistics - OrderedProperties (Get-ReferencedIdCacheDetail $ReferencedIdCache )
377
-
378
- # ## Remove pre existing package (zip) if it exists
379
- if (Test-Path - Path $PackagePath ) {
380
- Remove-Item $PackagePath - Force
381
- }
382
-
383
- # ## Package Output
384
- # Compress-Archive (Join-Path $OutputDirectoryData '\*') -DestinationPath $PackagePath -Force -ErrorAction Stop
385
- [System.IO.Compression.ZipFile ]::CreateFromDirectory($OutputDirectoryData , $PackagePath )
386
-
387
- Remove-Item $OutputDirectoryData - Recurse - Force
388
- }
389
-
390
392
# ## Open Directory
391
393
try {
392
394
Invoke-Item $OutputDirectory - ErrorAction SilentlyContinue
0 commit comments