Reputation: 361
This question is regarding the function forward_dns from the following blog: http://powershellmasters.blogspot.com/2009/04/nslookup-and-powershell.html
So say I have a piece of code in powershell that looks like this:
$cmd = "nslookup google.com " + $NameserverIPAddress;
$result = Invoke-Expression ($cmd);
This snippet uses the nslookup DOS command to do a DNS lookup. Since it's a DOS command, the object returned by Invoke-Expression is basically an array of strings, one for each line of output.
In the example function, in order to retrieve line 4 of the output, the original author uses the following syntax:
$result.SyncRoot[3];
I found that this also works just fine:
$result[3];
What is the purpose of SyncRoot in this context?
Upvotes: 2
Views: 4983