Another way to extract the GUID to remove the French part code

This commit is contained in:
Atis 2024-08-13 14:55:37 +02:00 committed by GitHub
parent 1adc239c3a
commit 06afd16ebb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -24,12 +24,13 @@ Function Invoke-WPFUltimatePerformance {
# Extract the new GUID from the duplicateOutput # Extract the new GUID from the duplicateOutput
foreach ($line in $duplicateOutput) { foreach ($line in $duplicateOutput) {
if ($line -match "GUID du mode de gestion de l'alimentation\s*:\s*([a-fA-F0-9\-]+)") { if ($line -match "\b[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\b") {
$guid = $matches[1] $guid = $matches[0] # $matches[0] will contain the first match, which is the GUID
Write-Output "GUID: $guid has been extracted and stored in the variable." Write-Output "GUID: $guid has been extracted and stored in the variable."
break break
} }
} }
}
if (-not $guid) { if (-not $guid) {
Write-Output "No GUID found in the duplicateOutput. Check the output format." Write-Output "No GUID found in the duplicateOutput. Check the output format."