what command can I utilize to obtain all local area connection information on a nic such as default gateway/dns servers
Marmotte94, the Get-VMGuestNetworkInterface will push local credentials if you don't specify anything, and in the event that those credentials do not work, you can accomplish everything with this one line:
$cred = Get-Credential; Get-VMGuestNetworkInterface vm-name -guestCredential $cred
If you need to specify host credentials, you can do the same thing but specify the -HostCredential parameter.
You used to be able to use Get-VMGuestNetworkInterface which would return a VMGuestNetworkInterface object containing the info you want, but VMware has deprecated this call.
They now recommend you use Invoke-VMScript which will let you run a script (defaulted to either Powershell or Bash depending on the OS).
If your VM is Windows, you'd want something like this: Invoke-VMScript -vm [vm name] "ipconfig /all"
Hope this helps!
Hi,
I wrote a script to add some function in PowerCLI to search any gateway for VM as you want.
You can find it at this URL : On the road again.. - PurpleScreen.eu
if you need more informations, you can send me an email from this Blog.
Thank you,
Olivier.
I get this error when running your command.
Olivier, the link takes me to the site but isn't in english.
Hi,
You have to run this command in PowerCLI as well as connect to your vCenter server.
Thank you,
Olivier
Year Sorry, but I had develop it in English.
Hello chicojr
You'll need to remove the brackets "[ ]" from the VM name - I was using them as a placeholder. The "-vm" parameter accepts a string of the vm's name.
that will work, and appreciate it but now is there anyway to get past this:
It seems like you're running a fairly old version of VMTools then. What operating system are you trying to run this on?
If it's Windows Server 2003 then the Get-VMGuestNetworkInterface command will work for you like this (I just tested it):
PS C:\Windows\system32> Get-VMGuestNetworkInterface vm-name
VM Name IP IPPolicy SubnetMask
-- ---- -- -------- ----------
vm-name Local Area Connection 3 x.x.x.x Dhcp 255.255.0.0
Unfortunately, according to VMware documentation, and my own testing, that command only works on Windows XP, Server 2003, and RHEL 5. You may need to upgrade your VMTools if you'd like to properly utilize the Invoke functionality.
You are forgot the Credential for this VM.
Take a look on this post Uninstalling vmtools
I wrote a script with IPConfig
Thank you,
Marmotte94, the Get-VMGuestNetworkInterface will push local credentials if you don't specify anything, and in the event that those credentials do not work, you can accomplish everything with this one line:
$cred = Get-Credential; Get-VMGuestNetworkInterface vm-name -guestCredential $cred
If you need to specify host credentials, you can do the same thing but specify the -HostCredential parameter.
Hi,
I think it better used a scalable issu like Invoke-VMScript. It's better. But It's my opinion. Get-VMGuestNetworkInterface doesn't work for all systems.
Source :
Get-VMGuestNetworkInterface - vSphere PowerCLI Cmdlets Reference
Thank you,
Regards,