I don't know if this helps at all, but since you have a "PowerShell" tag on this question, here's a less cluttered version of your script:
#Add-Content -Path C:\ManagedMetadata.csv -Value '"Case Folder", "CaseName"'
#Get the following folders
#Case Number / Folder Name CaseNumber
#Case Name
#Case Type
#Aircraft Type
#Case GUID
#########################################
#Set following three variables before run
$siteUrl = "https://url here"
$libraryName = "Case"
$csvLocation = "C:\ManagedMetadata.csv"
#########################################
$row = [ordered]@{}
Connect-PnPOnline -url $siteUrl -UseWebLogin
$Query = "<View><ViewFields><FieldRef Name='Title' /><FieldRef Name='CaseNumber' /><FieldRef Name='CaseName' /><FieldRef Name='CaseType' /><FieldRef Name='AircraftType' /><FieldRef Name='CaseGUID' /></ViewFields><Query><Where><Eq><FieldRef Name='ContentType'/><Value Type='Text'>Case Folder</Value></Eq></Where></Query></View>"
Get-PnPListItem -List $libraryName -Query $Query |
ForEach-Object{
$row.Clear # remove any previous keys and values
$row["Location"] = "????" # $LibraryName maybe???
$row["Title"] = $_.FieldValues["Title"]
$row["CaseNumber"] = $_.FieldValues["CaseNumber"]
$row["CaseName"] = $_.FieldValues["CaseName"]
$row["CaseType"] = $_.FieldValues["CaseType"].Label
$row["AircraftType"] = $_.FieldValues["AircraftType"]
$row["CaseGUID"] = $_.FieldValues["CaseGUID"]
[PSCustomObject]$row
} | Export-CSV $csvLocation -NoTypeInformation
I don't know what goes into the "Location" column of your CSV since that line appears to be missing in your posted code.One of the SharePoint folks (I hope) will help with the query problem.