I encountered a similar issue with syntax, which the posts above helped me solve. I'm documenting the "why" as to the failed resolution for future reference.
Initially I was submitting a search similar to:
ClientIP="8.8.8.8" | lookup dnslookup ClientIP
Results in error:
"Error in 'lookup' command: Could not find all of the specified lookup fields in the lookup table"
Within the dnslookup script, clientip and clienthost:
1) are case sensitive
2) set forward or reverse dns resolution
3) are preconfigured in the dnslookup script
4) are required for dnslookup to function
These variables set functionality for forward or reverse dns resolution as flags/switches that must be present for the lookup to function correctly. The command "AS ___" actually passes the field/variable to the dnslookup script for resolution.
Correct lookup examples (with comparisons):
Resolve-dns.ps1 -f "google[.]com"
ClientHost="google[.]com" | lookup dnslookup clienthost AS ClientHost
Resolve-dns.ps1 -r "8.8.8.8"
ClientIP="8.8.8.8" | lookup dnslookup clientip AS ClientIP
... View more