Angels Technology

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Friday, July 13, 2012

Keeping nic configurations when p2v

Posted on 3:00 PM by Unknown

    Problem: when you p2v a server it doesn’t keep it's nic configurations The new virtual nics are different nics so it doesn’t keep it's assignments.
    If you have multiple nics, your problems multiplies.


    http://communities.vmware.com/thread/201725
    The above thread showed me a script that dumps out your nic config/then readds the config to your virutalized server.
    It requires SOME effort, because you have to rename the nics to match your old nics.
    If you don’t the script throws an error.
    Script is found here: http://www.rtfm-ed.co.uk/2008/06/26/reader-contribution-p2v-networking-script/
    It's by Simon of autonation.com


    How to Run the script:

    Source VM:
  1. Run script in command prompt.
  2. In the C drive you will find a file P2V_IP_RECONFIG.TXT
  3. Now you can convert your vm


  4. Virtual VM
    You will see the NICs have no configuration right?

  5. Rename the nics to match the source vm
  6. Run the script file again.
  7. Now the nics will have their configurations set.


  8. *important*
    The text file MUST be in  c:\ , unless you modify the script.

     
The Script below : paste in VBS file

Option Explicit

'===> DECLARE CONSTANTS <===
Const HKEY_LOCAL_MACHINE = &H80000002
Const NETWORK_CONNECTIONS = &H31&
Const ForReading = 1
      

'===> DECLARE VARIABLES <===
Dim strComputer, objReg, i, j, arrAllInterfaces, arrIPs, strKeyPath, objShell, objFolder, objItem, colItems, Return, objFSO, objFile, strText, strCharacter, strNewCharacter, strNetConName


'===> VERIFY NIC CONFIGURTION FILE IS PRESENT <===
Set objFSO = CreateObject("Scripting.FileSystemObject")

If objFSO.FileExists("C:\P2V_IP_RECONFIG.txt") Then


        '===> DELETE OLD REGISTRY KEY FOR PHYSICAL NIC <===
        strComputer = "."
        strKeyPath = "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces"

        Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
        & strComputer & "\root\default:StdRegProv")

        'Obtain array of all interfaces.
        objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrAllInterfaces

        For i = 0 To UBound(arrAllInterfaces)
                'Obtain array of IPs for each interface.
                objReg.GetMultiStringValue HKEY_LOCAL_MACHINE, strKeyPath & "\" & arrAllInterfaces(i), "IPAddress", arrIPs

                'Iterate the IPs of each interface looking for non-zero.
                'This should pick up all Interfaces that have an IP, as all
                'other interfaces report "0.0.0.0" for the "IPAddress" value entry.
                For j = 0 To UBound(arrIPs)
                        If arrIPs(j) <> "0.0.0.0" Then
                                objReg.DeleteKey HKEY_LOCAL_MACHINE, strKeyPath & "\" & arrAllInterfaces(i)
                                'WScript.Echo arrAllInterfaces(i)
                        End If
                Next
        Next

      
        '===> GET NAME OF OLD NETWORK CONNECTION <===
        Set objFile = objFSO.OpenTextFile("C:\P2V_IP_RECONFIG.txt", ForReading)

        Do Until objFile.AtEndOfStream
                    strText = ""
                    strCharacter = objFile.Read(1)
                    If strCharacter = Chr(34) Then
                        Do Until objFile.AtEndOfStream
                                   strNewCharacter = objFile.Read(1)
                                   If strNewCharacter = Chr(34) Then
                                               Exit Do
                                   End If
                                   If strNewCharacter <> "" Then
                                               strText = strText & strNewCharacter
                                   End If
                        Loop
                        Exit Do
                    End If
        Loop

        objFile.Close


        '===> RENAME NETWORK CONNECTION <===
        Set objShell = CreateObject("Shell.Application")
        Set objFolder = objShell.Namespace(NETWORK_CONNECTIONS)
        Set colItems = objFolder.Items

        For Each objItem in colItems
                For i = 1 To 10      
                        If objItem.Name = "Local Area Connection " & i Then
                                objItem.Name = strText
                        End If
                Next
        Next
        Set objShell = Nothing


        '===> IMPORT NIC CONFIGURATION USING NETSH<===
        Set objShell = CreateObject("WScript.Shell")
        Return = objShell.Run("%comspec% /c netsh exec c:\P2V_IP_RECONFIG.txt", 1, True)

      
        '===> DELETE NIC CONFIGURATION FILE <===
        objFSO.DeleteFile("c:\P2V_IP_RECONFIG.txt")
        WScript.Echo "NIC Configuration completed."


        '===> Destroy objects <===
        Set objShell = Nothing
        Set objFSO = Nothing
   
Else
        '===> DUMP NIC CONFIGURATION USING NETSH ***
        Set objShell = CreateObject("WScript.Shell")
        Return = objShell.Run("%comspec% /c netsh interface ip dump>c:\P2V_IP_RECONFIG.txt", 1, True)
        WScript.Echo "NIC CONfiguration has been saved."
End If


Pasted this script thanks to <http://www.rtfm-ed.co.uk/downloads/p2v_post_install_script.txt>


Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in converter, NIC, p2v, vmware, vsphere | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Copy and paste clipboard items to and from your vsphere virtual machines and your pc
    Wanted to copy and paste text between your pc and a vm? Now you can. Power off your VM. Go to the vm properties->Options->Advanced-...
  • Interesting look at Win cpu usage vs Vmware CPU usage
    I came across this scenario: The windows task manager shows the cpu of the vm pegged at 100%. The vmware performance monitor says that ...
  • Storage comparison
    One of Cormac Hogan s posts provides a good basis for compares of different storage types for vmware Vsphere and how they stack up. He dis...
  • E1000 vs e1000e in vmware : notes
    Performance difference " The performance should be about the same, the reason for the change is that Intel is not longer supporting the...
  • vCenter and Hosts Disconnected -- Reason: Cannot verify the SSL thumbprint
    Just saw this over on the forums, but if your hosts are getting this error: Cannot syncronize the host <hostname.fqdn>, Reason: Cannot...
  • Vmware DRS anti affinity rules wont let you enter maintenance mode for a esxi host
    You have a DRS rule that specifies that 2 vms need to be kept apart: In this case: 250-FT and 250sql3 For larger clusters with multiple...
  • Vmware esxi : Intel Pro/1000 ET quad port adapter and ISCSI
    I've seen issues pop up with intel quad ports here and there on the forums so I thought it would be good to note down what worked here...
  • Snapshot creation /reversion/ deletion/ listing with vim-cmd
    Here we are going to use the command line on a esxi host to create, revert, and delete snapshots. First ssh into your host. Important thi...
  • shutdown your esxi host using powercli
    if you want to shutdown a host using powercli: Set-VMhost -VMhost HOSTNAME -State Maintenance get-vmhost HOSTNAME | Foreach {Get-View $_.ID}...
  • Setting your esxi host to restart automatically after crash or purple screen aka psod
    The default and recommended setting is to leave the purple screen of death up to help you notice that het host has died and also leave t...

Categories

  • 5.1
  • backup
  • cloud
  • cluster
  • command line
  • console
  • converter
  • cpu
  • datacenter
  • datastore
  • datastore. rdm
  • DCUI
  • dell
  • disaster recovery
  • display
  • DR
  • e1000
  • e1000e
  • ec2
  • esx
  • esxi
  • esxtop
  • extent
  • Good for enterprise
  • HA
  • hcl
  • host
  • HP
  • ibm
  • iometer
  • iscsi
  • iso
  • linked mode
  • logs
  • MAC
  • memory
  • NFS
  • NIC
  • NTP
  • ova
  • ovf
  • p2v
  • pcie
  • performance
  • phone
  • powercli
  • powershell
  • PSOD
  • raid
  • RDM
  • resource pool
  • rvtools
  • scsi
  • sddc
  • snapshots
  • SQL
  • SRM
  • ssh
  • storage
  • svmotion
  • syslog collector
  • v2v
  • vapp
  • vcenter
  • vcloud
  • vcp
  • veeam
  • VI console
  • vm
  • vmdk
  • VMFS
  • vmkfstools
  • vmotion
  • VMUG
  • vmware
  • vmware tools
  • vmware.esxi
  • vmxnet3
  • vsphere
  • vum
  • web client
  • windows

Blog Archive

  • ►  2013 (28)
    • ►  October (2)
    • ►  September (1)
    • ►  August (1)
    • ►  July (1)
    • ►  June (14)
    • ►  May (1)
    • ►  April (1)
    • ►  March (5)
    • ►  February (1)
    • ►  January (1)
  • ▼  2012 (138)
    • ►  December (2)
    • ►  November (13)
    • ►  October (26)
    • ►  September (19)
    • ►  August (35)
    • ▼  July (34)
      • Esxi : Recovering from a bad update : Last known g...
      • convert thick disk to thin using a command line vi...
      • Setup NTP for your ESXi host
      • Boot virtual machine from ISO : tips on if you are...
      • Best practices for using VMware Converter : Checklist
      • Iometer test of USB flash drive connected to a Vmw...
      • Can you storage vmotion (svmotion) your virutalize...
      • vCenter and Hosts Disconnected -- Reason: Cannot v...
      • Network configuration not updated in configuration...
      • There are issues communicating with the following ...
      • "The Fully Qualified Domain Name cannot be resolve...
      • Notes: Linked-mode vsphere vcenter pre-requisites ...
      • What to the DCUI console logs show
      • Browsing Vmware logs in the DCUI (view esxi logs ...
      • SRM Site Recovery Manager best practices
      • Keeping nic configurations when p2v
      • What is stretched storage cluster / metro storage...
      • How to create a vapp in esxi or vsphere
      • Thought: Raid 0 and Raid 1 : quick easy way to rem...
      • Setting a MAC for a vm manually
      • Extents and VMFS volumes
      • How to add a Raw disk to your esx host (RDM)
      • How to describe vsphere vs vcenter to a layman
      • How to setup a cluster in vmware vsphere
      • Matching virtual disks to the Disks on the guest
      • How to attach a vmdk to VM
      • How to attach a ISO to a vmware guest via vsphere ...
      • personal thoughts: veeam vs vranger
      • Copy-vmguestfile :: Copying data from powercli to ...
      • Vmware converter : does disabling ssl make your vm...
      • Growing and Expanding a VMFS
      • How to connect to the vpshere web client
      • Snapshot creation /reversion/ deletion/ listing w...
      • Enable ssh from powercli
    • ►  June (9)
Powered by Blogger.

About Me

Unknown
View my complete profile