0 0

Extract HWID for Windows Autopilot

md c:\HWID
Set-ExecutionPolicy Unrestricted -Force
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted
Install-Script -Name Get-WindowsAutopilotInfo -Force
Set-Location 'C:\Program Files\WindowsPowerShell\Scripts'
$s = (gwmi win32_bios).SerialNumber
./Get-WindowsAutopilotInfo.ps1 -OutputFile c:\HWID\$s-Autopilot-HWID.csv

Other method:
New-Item -Path c:\programdata\customscripts -ItemType Directory -Force -Confirm:$false | out-null
install-packageprovider -name nuget -minimumversion 2.8.5.201 -force | out-null
Save-Script -Name Get-WindowsAutoPilotInfo -Path c:\ProgramData\CustomScripts -force | out-null
$PCName = $env:COMPUTERNAME
c:\ProgramData\CustomScripts\Get-WindowsAutoPilotInfo.ps1 -OutputFile C:\$pcname.csv

Merge multiple CSV:
$mergedCsvPath = "C:\HWID\Merged.csv"
$firstIteration = $true

Get-ChildItem -File "C:\HWID\*HWID.csv" | ForEach-Object {
    $csvData = Import-Csv $_.FullName

    if ($firstIteration) {
        $header = $csvData[0].PSObject.Properties.Name -join ','
        Add-Content -Path $mergedCsvPath -Value $header
        $firstIteration = $false
    }

    $csvData | ForEach-Object {
        $formattedData = $_.PSObject.Properties.Value -join ','
        Add-Content -Path $mergedCsvPath -Value $formattedData
    }
}

Add Group Tag (Import using Intune):
Device Serial Number,Windows Product ID,Hardware Hash,Group Tag

Merge multiple CSV and add Group Tag:

$groupTag = "NL-CLI-L0000"
$mergedCsvPath = "C:\HWID\Merged.csv"
$firstIteration = $true

Get-ChildItem -File "C:\HWID\*HWID.csv" | ForEach-Object {
    $csvData = Import-Csv $_.FullName

    if ($firstIteration) {
        $header = ($csvData[0].PSObject.Properties.Name + "Group Tag") -join ','
        Add-Content -Path $mergedCsvPath -Value $header
        $firstIteration = $false
    }

    $csvData | ForEach-Object {
        $_ | Add-Member -MemberType NoteProperty -Name "Group Tag" -Value $groupTag -Force
        $formattedData = $_.PSObject.Properties.Value -join ','
        Add-Content -Path $mergedCsvPath -Value $formattedData
    }
}

Merge multiple CSV and add Group Tag Hybrid:

$groupTag = "Hybrid"
$mergedCsvPath = "G:\HWID\HybridMerged.csv"
$firstIteration = $true

Get-ChildItem -File "G:\HWID\*HWID.csv" | ForEach-Object {
    $csvData = Import-Csv $_.FullName

    if ($firstIteration) {
        $header = ($csvData[0].PSObject.Properties.Name + "Group Tag") -join ','
        Add-Content -Path $mergedCsvPath -Value $header
        $firstIteration = $false
    }

    $csvData | ForEach-Object {
        $_ | Add-Member -MemberType NoteProperty -Name "Group Tag" -Value $groupTag -Force
        $formattedData = $_.PSObject.Properties.Value -join ','
        Add-Content -Path $mergedCsvPath -Value $formattedData
    }
}

https://admin.cloud.microsoft/?source=applauncher#/IntuneDevices
https://admin.cloud.microsoft/?source=applauncher#/PrepareWindows
https://portal.azure.com/#view/Microsoft_AAD_Devices/DevicesMenuBlade/~/Devices/menuId/
https://intune.microsoft.com/#view/Microsoft_Intune_Enrollment/AutopilotDevices.ReactView/filterOnManualRemediationRequired/