VMware Cloud Community
buzzlightyear_2
Contributor
Contributor

Get-VMGUESTNETWORKINTERFACE - question

Hi people,

I apologize if this is an easy one or if it's already been answered.

I need to deploy and number of 2008 R1 servers and IP them, the deployment part I have sorted with help from Lucd but the get / set -vmguestnetworkinterface on this OS I believe is not supported I keep getting the error Unable to parse script output.

Manually setting the IP address on these machines is going to take some time can anyone please provide a solution / help?

This is what I have used on 2003 / 2008 R2 which worked fine.

ForEach-Object {

$VMGuestNetworkInterface=Get-VMGuestNetworkInterface -VM $_.name -GuestUser $guestuser -GuestPassword $guestpass | where {$_.name -eq 'local area connection 1'}
        set-vmguestnetworkinterface -VMGuestNetworkInterface $VMGuestNetworkInterface `
        -guestuser $guestuser `
        -guestpassword $guestpass `
        -ippolicy Static `
        -IP $_.ipaddress `
        -netmask 255.255.255.0 `
       -gateway ***.***.***.**      

}

Reply
0 Kudos
17 Replies
buzzlightyear_2
Contributor
Contributor

Forgot to mention I'm using powercli version 5.0.1

Reply
0 Kudos
Grzesiekk
Expert
Expert

Can you paste the error ?

--- @blog https://grzegorzkulikowski.info
Reply
0 Kudos
buzzlightyear_2
Contributor
Contributor

This is the error I'm getting when running get-vmguestnetworkinterface -vm <servername> -guestuser ***** -guestpassword ******

Get-VMGuestNetworkInterface : 08/11/2012 10:09:29
Get-VMGuestNetworkInterface        Unable to parse script output.
At line:1 char:1
+ Get-VMGuestNetworkInterface -VM testserver2008r1 -GuestUser administrator
-GuestPassw ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-VMGuestNetworkInterfac
   e], ViError
    + FullyQualifiedErrorId : Client20_VmHostServiceImpl_GetVmGuestNetworkInte
   rface_UnableToParse,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVmGues
  tNetworkInterface

Reply
0 Kudos
Grzesiekk
Expert
Expert

please run this

$guestcred=get-credential

Get-VMGuestNetworkInterface -VM $_.name -GuestCredential $guestcred

just this line without any additional parameters/wher's  . Will it make output ?

--- @blog https://grzegorzkulikowski.info
Reply
0 Kudos
buzzlightyear_2
Contributor
Contributor

This is the error I'm seeing from your command.

Get-VMGuestNetworkInterface : 08/11/2012 11:43:43
Get-VMGuestNetworkInterface        Unable to parse script output.
At line:1 char:1
+ Get-VMGuestNetworkInterface -vm test2008r1 -GuestCredential $guestcred
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-VMGuestNetworkInterfac
   e], ViError
    + FullyQualifiedErrorId : Client20_VmHostServiceImpl_GetVmGuestNetworkInte
   rface_UnableToParse,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVmGues
  tNetworkInterface

Reply
0 Kudos
Grzesiekk
Expert
Expert

please paste output from:

get-vm 'test2008r1'

and

(get-vm 'test2008r1').ExtensionData.Guest.ToolsRunningStatus

--- @blog https://grzegorzkulikowski.info
Reply
0 Kudos
LucD
Leadership
Leadership

You're apparently missing some of the prerequistes to run the Invoke-VMScript cmdlet.

The Get-VMGuestNetworkInterface uses that cmdlet under the covers.

Check with my Will Invoke-VMScript work ? script iwhich prereq is missing.


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

buzzlightyear_2
Contributor
Contributor

HI Lucd I've ran your script against the server in question it's coming back OK = True.


     OK VM
     -- --
   True <servername>

Reply
0 Kudos
buzzlightyear_2
Contributor
Contributor

Vmtools are update and ruunning.

Reply
0 Kudos
Grzesiekk
Expert
Expert

do you have more than 1 vms with this name ?

Is this still working when you are executing this towards other vms ?

--- @blog https://grzegorzkulikowski.info
Reply
0 Kudos
LucD
Leadership
Leadership

Is that actually a Windows 2008 R1 (and not a Windows 2008 R2) OS in that VM ?

If ys, then we are actually talking about a Windows 2008 server OS, and that is not in the list of supported OS for this cmdlet.


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

Reply
0 Kudos
buzzlightyear_2
Contributor
Contributor

Please ignore the names your seeing in this thread. In the envorioment we have no duplicate names. This has been tested on a 2003 and 2008 r2 server but I have 15 servers windows 2008 r1 and this doesn't work on any, is it because of the OS version?

Reply
0 Kudos
buzzlightyear_2
Contributor
Contributor

Correct it a 2008 R1 OS, I did mention this was not on the supported server list but would you know of another way to IP these VM's?

Reply
0 Kudos
LucD
Leadership
Leadership

Can you use the WMI interface to these VMs ?

If yes, you can use something like Use PowerShell to Configure Static IP and DNS Settings


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

Reply
0 Kudos
buzzlightyear_2
Contributor
Contributor

Currently they are not on the network is this possible? and if so can you explain how?

Sorry my scripting skills are not that good.

Reply
0 Kudos
LucD
Leadership
Leadership

If they are not on the network then the WMI method is not possible I'm afraid.


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

Reply
0 Kudos
buzzlightyear_2
Contributor
Contributor

Thanks for all your input, I ended up using the following instead.

get-OSCustomizationspec -name $_.customfile | get-oscustomizationnicmapping | set-oscustomizationnicmapping -IPmode UsestaticIP `

-Ipaddress $_.IPAddress `

Reply
0 Kudos