extract a nslookup info and fill in a variable?

So, if I

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 information above, is still possible to query a nslookup and fill in the IP address in a variable.

$ip

So what I'm wanting just to have to enter the host name of the virtual machine, that I intend to create and it have a mark to pull his address. Is it possible, is there something better that nslookup?

I don't know how to get it that way, but I don't know how just pull the exact IP and not the other parts of the chain...

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

I need just in my variable...

192.30.2.4

Try like this

[System.Net.Dns]::GetHostAddresses("vmname01") | Select -ExpandProperty IPAddressToString

You can also use the output of the ipconfig command, which will require a mask of RegEx

Tags: VMware

Similar Questions

Maybe you are looking for

  • Satellite Pro L670 - update graphics drivers

    Is it possible to get a graphics driver more up-to-date for the ATI mobility radeon hd 5650 graphics card that Toshiba provides on the website?

  • Signal strength and range of the latest wifi routers

    I have a big house, with my router (BT home hub) in a wiring closet in a laundry room. The House is wired for ethernet and my current Wi - Fi, a Netgear WPN802, is placed at the best discreet place in the House. It is quite visible from everywhere in

  • HP Pavilion 15 laptop: Audio settings

    I have the new laptop and I can not sounds.  All the grahps bar indicate I should get the music, but the silence.  I tried to plug in speakers, but still nothing.  Any ideas on what is missing to me.

  • CD drive does not open and the light does not work

    original title: single CD player problem The problem with my CD player seems to be unique I can't find an answer, or someone else with the same problem online. My computer is custom built, the CD player lasted me 1.5 years no problem, not until one d

  • Outgoing message stuck in Windows Llive Mail

    I tried to send two messages this morning.  They are stuck in Windows Live Mail.  I can't open Windows Live Mail; all I get is the small box, as if it sends a message.  Green bar is completely to the right. no details are given as to why the message