modules/Private/2.ProcessingFunctions/Build-ARIAutCacheFile.ps1
<#
.Synopsis Module responsible for creating the local cache files for the report in Automation. .DESCRIPTION This module receives the job names for the Azure Resources that were processed previously and creates the local cache files that will be used to build the Excel report. .Link https://github.com/microsoft/ARI/Modules/Private/2.ProcessingFunctions/Build-ARIAutCacheFiles.ps1 .COMPONENT This PowerShell Module is part of Azure Resource Inventory (ARI). .NOTES Version: 3.6.6 First Release Date: 15th Oct, 2024 Authors: Claudio Merola #> function Build-ARIAutCacheFile { Param($DefaultPath, $JobNames) Write-Output ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Processing Cache Folder.') $Counter = 0 Foreach ($Job in $JobNames) { $NewJobName = ($Job -replace 'ResourceJob_','') $TempJob = Receive-Job -Name $Job if (![string]::IsNullOrEmpty($TempJob.values)) { $JobJSONName = ($NewJobName+'.json') $JobFileName = Join-Path $DefaultPath 'ReportCache' $JobJSONName Write-Output ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Creating Cache File: '+ $JobFileName) $TempJob | ConvertTo-Json -Depth 40 | Out-File $JobFileName } Remove-Job -Name $Job | Out-Null Remove-Variable -Name TempJob $Counter++ } Clear-ARIMemory Write-Output ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Cache Files Created.') } |