Skip to content

Instantly share code, notes, and snippets.

@rbocchinfuso
Created December 17, 2014 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rbocchinfuso/9794307ab476f0d67468 to your computer and use it in GitHub Desktop.
Save rbocchinfuso/9794307ab476f0d67468 to your computer and use it in GitHub Desktop.
PowerShell Script to Merge NAR Files
#mergenar.ps1
$TempFile = "c:\temp\nar_out\Temp.nar"
$OutputFile = "c:\temp\nar_out\NAR_Merge.nar"
$NarFiles = Get-Childitem "c:\temp\nar_in"
$count =0
$count = $NarFiles | Measure-Object | select -ExpandProperty count
$filecount = 0
foreach($NFile in $NarFiles){
$pcomplete = $filecount / $count * 100
if($filecount -eq 0){Copy-Item $NFile.FullName $OutputFile}Else{
Write-Progress -Activity "Working..." -PercentComplete $pcomplete -CurrentOperation "$pcomplete% complete" -Status "Please wait."
Copy-Item $OutputFile $TempFile
Remove-Item $OutputFile
#write "Merging $OutputFile with $TempFile"
NaviSECCli.exe analyzer -archivemerge -data $TempFile $NFile.FullName -out $OutputFile | Out-Null
}
$filecount ++
$count++
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment