Here I want to run nslookup with specified types of DNS records in PowerShell.
I tried it by define the types of DNS records and run nslookup with Foreach.
$types = @("soa", "a")
Foreach ($type in $types){
nslookup -type=$type google.com
}
But this doesn't seem to work because $type is not recognized as a parameter.
Does anyone know how to solve this problem?
Quote the whole argument, including the parameter name, with double-quotes - this will prevent PowerShell from interpreting
-typeas a managed parameter: