Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 150956

Re: How to script changing IP and hostname on 600 Windows 2008 R2 (64bit) VM's

$
0
0

Hi, script below works. IP, Gatewey, mask and DNS have changed. But script runs slowly and there are error messages.

Import-Csv C:\scripts\Servers.csv -UseCulture | %{

    $nicParams = @{

        IpPolicy = "Static"

        IP = $_.IP

        Netmask = $_.Mask

        Gateway= $_.Gateway

        Dns = $_.Dns

        GuestUser = "Admin"

        GuestPassword = "password"

        }

    $nicParams2 = @{

        GuestUser = "Admin"

        GuestPassword = "password"

        }

        Get-VMGuestNetworkInterface -VM $_.Name @nicParams2 | Set-VMGuestNetworkInterface  @nicParams

}

 

Errors:

Set-VMGuestNetworkInterface : 8/6/2013 3:31:33 PM    Set-VMGuestNetworkInterface        "Error occured while configuring the network:'Failed to configure the DHCP service. The interface may be disconnected. The system cannot find the file specified.'.

At C:\scripts\ip2.ps1:15 char:90

+         Get-VMGuestNetworkInterface -VM $_.Name @nicParams2 | Set-VMGuestNetworkInterface <<<<   @nicParams

    + CategoryInfo          : InvalidArgument: (:) [Set-VMGuestNetworkInterface], ViError

    + FullyQualifiedErrorId : Client20_VmGuestService_SetVmGuestNetworkInterface_Error,VMware.VimAutomation.ViCore.Cmdlets.Commands.SetVmGuestNetworkInterface

 

 

Set-VMGuestNetworkInterface : 8/6/2013 3:31:47 PM    Set-VMGuestNetworkInterface        "Error occured while configuring the network:'Element not found.'.

At C:\scripts\ip2.ps1:15 char:90

+         Get-VMGuestNetworkInterface -VM $_.Name @nicParams2 | Set-VMGuestNetworkInterface <<<<   @nicParams

    + CategoryInfo          : InvalidArgument: (:) [Set-VMGuestNetworkInterface], ViError

    + FullyQualifiedErrorId : Client20_VmGuestService_SetVmGuestNetworkInterface_Error,VMware.VimAutomation.ViCore.Cmdlets.Commands.SetVmGuestNetworkInterface

 

Script running from PowerCLI latest version.

 

Servers have only one NIC.

Before running script NIC have IPv4 satic and IPv6 DHCP. IPv6 not used and can be ommited.

Can IPv6 DHCP cause problems? If so how to filter it?

 

Thanks in advance.


Viewing all articles
Browse latest Browse all 150956

Trending Articles



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