Functions/Invoke-CreateAutopilotPartnerCsv.ps1


function Invoke-CreateAutopilotPartnerCsv {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory)] [string] $InputFile,
        [Parameter(Mandatory)] [string] $OutFile
    )

    $ErrorActionPreference = "Stop"
    $Result = @()
    $ExcelData = Import-Excel $InputFile

    # $ExcelData[0]

    foreach ($e in $ExcelData) {

        $obj = [PSCustomObject]@{
            "Device Serial Number" = $e.Serienummer
            "Windows Product ID"   = ""
            "Hardware Hash"        = ""
            "Manufacturer name"    = $e.Merk
            "Device model"         = $e.Type
        }
        $Result += $obj

    }


    # $Result | Format-Table
    $Result | Export-Csv $OutFile -NoTypeInformation
    (Get-Content $OutFile).Replace('"', '') | Out-File $OutFile


}