# For ZC Files: $AcFiles = Get-ChildItem ".\*.*" -Recurse | Where-Object{$_.Extension -match '\.(?:zc|\d{2}#)'} $found_sns = @() "" foreach ($acf in $ACFiles){ Write-Progress -PercentComplete ($AcFiles.IndexOf($acf) / ($AcFiles.Count - 1) * 100) -Activity "Scanning for unique serial numbers in files..." -Status "Processing item $($AcFiles.IndexOf($acf)) of $($AcFiles.Count - 1)" $acf_sn = Select-String -Path $acf -Pattern '(?:Serial:|SN\s*)(\d{4,})' | % {$_.matches.groups[1].value} if ($found_sns.Count -eq 0 -OR -NOT $found_sns.Contains($acf_sn) -AND $acf_sn.Length -gt 0){ $found_sns += $acf_sn $found_sns.Count.ToString() + ': ' + $acf_sn } } "Done. Found " + $found_sns.Count.ToString() + " total SNs (see above). " # For SM3 or SM4 WAV Files: $AcFiles = Get-ChildItem ".\*.wav" -Recurse $found_sns = @() "" foreach ($acf in $ACFiles){ Write-Progress -PercentComplete ($AcFiles.IndexOf($acf) / ($AcFiles.Count - 1) * 100) -Activity "Scanning for unique serial numbers in files..." -Status "Processing item $($AcFiles.IndexOf($acf)) of $($AcFiles.Count - 1)" $acf_sn = Select-String -Path $acf -Pattern '((?:S\dU|SM\d)\d{4,})' | % {$_.matches.groups[1].value} if ($found_sns.Count -eq 0 -OR -NOT $found_sns.Contains($acf_sn) -AND $acf_sn.Length -gt 0){ $found_sns += $acf_sn $found_sns.Count.ToString() + ': ' + $acf_sn } } "Done. Found " + $found_sns.Count.ToString() + " total SNs (see above). "