mardi 21 septembre 2021

IF - Missing '=' operator after key in hash literal

Hello I am getting error "Missing '=' operator after key in hash literal." on the IF statement, where am I wrong

$Nests | ForEach-Object {
      $RecordMetrics = [pscustomobject]@{
            key = $_.key
            count = $_.doc_count
            if (key -like 'CBT99*') 
            {
              bo = 'CBT'
              SiteID = 1972
            }
           elseif
           {
            boperator = $map[$_.key.TrimEnd("1","2","3","4","5","6","7","8","9","0","-") ].boperator
            SiteID = $map[$_.key.TrimEnd("1","2","3","4","5","6","7","8","9","0","-") ].SiteID
           }
        }}

Aucun commentaire:

Enregistrer un commentaire