Quantcast
Channel: VMware Communities : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 180259

pull info from a nslookup and populate a variable?

$
0
0

So if I have

 

PowerCLI P:\My Documents> nslookup mickeymouse
Server:  lookup.mycompany.com
Address:  192.56.45.90

 

Name:    mickeymouse.mycompany.com
Address:  192.30.2.4

 

 

So with the above information, is it even possible to query a nslookup and populate the IP into a variable.

 

$ip

 

So what I am wanting  is to just to have to input the hostname of the vm I intend to create and have it query  to pull its address. Is it possible, is there something better than nslookup?

 

 

I know of how to get it this way but I do not know how to just pull the exact IP and not the other parts of the string....

 

PowerCLI P:\My Documents $test =  [System.Net.Dns]::GetHostAddresses("vmname01") |select IPADDRESSToString
PowerCLI P:\My Documents\ Write-Host $test
@{IPAddressToString=192.30.2.4}

 

 

I need just in my variable...

 

192.30.2.4


Viewing all articles
Browse latest Browse all 180259

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>