shbabu
Contributor
Contributor

Unable to Change IPAddress of VM's Using PowerCLI, deployed localPC

Hi,

We are  trying to automate the process of creating new VM through HP Opeartion Orchestration tool.

We are able to Deploy VM's from Template using HPOO  ,the newly Created VM's  are having same System name & IP address ,
because of this I can't able to access the VM's through HPOO Remotely and can't able to change their IP Address

We had found another way to change the IP's of VM's (having Same IPaddress) using  "VMWare vSphere PowerCLI client"
Below mentioned commands we are executing  Through VMWare vSphere PowerCLI client (which installed in VCenter server)

1.Connect-VIServer –Server <ServerIP> –Protocol https –User <user> –Password <pwd>

2.get-vm <VMName>| Get-VMGuestNetworkInterface | ? {$_.name -eq "Local Area Connection"} | Set-VMGuestNetworkInterface -IPPolicy static -Gateway 198.98.64.1 -Netmask 255.255.255.0 -Ip 198.98.64.131 -Verbose

We tried  to execute these commands through HPOO remotely on VCenter server but we are getting access denied error.
So We installed "vSphere PowerCLI client" on HPOO Development Server and trying to execute the commands mentioned above.
I am able to execute command -1 but unable to execute the  command -2,getting error ,mentioned the details below

-----------------------------------------------------------------------------------------------------------------------

Error Details:

[vSphere PowerCLI] C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI
> Get-VMGuestNetworkInterface -VM vmforOO -HostUser root -HostPassword Pwd@123 -
GuestUser Administrator -GuestPassword Pwd@1234
Get-VMGuestNetworkInterface : 2/20/2012 7:41:59 AM    Get-VMGuestNetworkInterfa
ce        Unable to parse script output.
At line:1 char:28
+ Get-VMGuestNetworkInterface <<<<  -VM vmforOO -HostUser root -HostPassword Pwd@123 -GuestUser Administrator -GuestPassword Pwd@1234
    + CategoryInfo          : InvalidArgument: (:) [Get-VMGuestNetworkInterfac
   e], ViError
    + FullyQualifiedErrorId : Client20_VmHostServiceImpl_GetVmGuestNetworkInte
   rface_UnableToParse,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVmGues
  tNetworkInterface

[vSphere PowerCLI] C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI

-----------------------------------------------------------------------------------------------------------------------

Note: we are using win2k8sp1

Regards,

Hussain

0 Kudos
4 Replies
LucD
Leadership
Leadership

Did you use the 32-bit PowerCLI version ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
shbabu
Contributor
Contributor

Yes Using 32 bit CLi Version

When I am executing

Get-VMGuestNetworkInterface -VM vmPortar -HostUser root -HostPassword pwd@123 -GuestUser Administrator -GuestPassword pwd@1234

Getting below mention error:

......Cannot bind parameter 'VMGuest' Cannot convert the "vmPortar" value type "system.string" to type "VMware.vimAutomation.VirCore.Types.V1.VM.Guest.VMGuest"............

Attached screenshot for the reference

0 Kudos
RvdNieuwendijk
Leadership
Leadership

The command seems to expand the -VM parameter to the -VMguest parameter.

Can you try:

Get-VMGuestNetworkInterface -VM (Get-VM vmPortar) -HostUser root -HostPassword pwd@123 -GuestUser Administrator -GuestPassword pwd@1234

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
0 Kudos
nnedev
VMware Employee
VMware Employee

Hi Hussain,

There is something strange with the OS network configuration output that our cmdlet is unable to parse. Please follow the steps bellow:

1. Copy and run the script <powercli_install_dir>\GetVmGuestNetworkInterface_WindowsGuest.bat  in the guest OS

2. Export the output to a .txt file

3. Attach it to your next reply here

We'll see what causes the error and we'll implement a fix in a future release.

Thanks,

Nedko

Regards, Nedko Nedev PowerCLI Development Team
0 Kudos