Private/Test-FatCsvHeaders.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Function Test-FatCsvHeaders {
    param(
        [parameter(Mandatory = $true)] [string]$csvPath

    )
    $headers = (get-content $csvPath)[0] -split ',' -replace '\s+', '' 
    if ($headers.Length -ne 7) {
        Write-Host "Unexpected number of headers. Expected 7 got $($headers.Length)"
        $headers
        Throw
    }
    if ( (Compare-Object $headers "Container,Folder,ADGroup,ADGroupID,DefaultPermission,AccessPermission,Recurse".Split(",")) ) {
        Write-Host 'Headers are different!'
        Throw
    }
}