PowerCLI script needed to change the 9 network adapters to a virtual computer in a single operation

I got about 30 mV, and I need to change the 9 cards each virtual computer network. The script below takes a while to run, is there a way to speed it up, by changing all the interfaces of a VM in a single operation?

$VM = "MY_VM_".

1... 30 | % {

$VMS = $VM + $_

Get-vm-name $VMS | Get-NetworkAdapter-name '2 network adapter | Together-NetworkAdapter - NetworkName "blah1" - connected: $true - confirm: $false

Get-vm-name $VMS | Get-NetworkAdapter-name "Network adapter 3 | Together-NetworkAdapter - NetworkName "blah2" - connected: $true - confirm: $false

Get-vm-name $VMS | Get-NetworkAdapter-name "NIC 4 | Together-NetworkAdapter - NetworkName "blah3" - connected: $true - confirm: $false

Get-vm-name $VMS | Get-NetworkAdapter-name "adapter 5 network | Together-NetworkAdapter - NetworkName "blah4" - connected: $true - confirm: $false

Get-vm-name $VMS | Get-NetworkAdapter-name "NIC 6. Together-NetworkAdapter - NetworkName "blah" - connected: $true - confirm: $false

Get-vm-name $VMS | Get-NetworkAdapter-name 'network 7 adapter | Together-NetworkAdapter - NetworkName "blah" - connected: $true - confirm: $false

Get-vm-name $VMS | Get-NetworkAdapter-name '8 network adapter | Together-NetworkAdapter - NetworkName "blah7" - connected: $true - confirm: $false

Get-vm-name $VMS | Get-NetworkAdapter-name 'network 9 adapter | Together-NetworkAdapter - NetworkName "blah8" - connected: $true - confirm: $false

Get-vm-name $VMS | Get-NetworkAdapter-name '10 network adapter | Together-NetworkAdapter - NetworkName "blah9" - connected: $true - confirm: $false

}

Thank you very much!!. I was able to change the script of LucD work in DVS.

FINAL VERSION:

$hash = $null

$hash = @ {}

$dvs = get-view (get-VirtualSwitch-name "DVS5.1")

$dvs. PortGroup | % {Get-View-Id $_} | %{

$hash.add ($_.) Name, $_. Key)

}

# Loop below for all virtual machines

1... 90 | %{

$i = $_

write-host 'tenant = $i'

$convertTab = @ {}

"Network adapter 1" = "$1te I".

"Network adapter 2" = "$2te I".

'Network adapter 3' = ' $3te I ".

"Network adapter 4" = "$4te I".

'Network adapter 5' = ' $5th I ".

'Network adapter 6' = ' $6te I ".

'Network adapter 7' = ' $7te I ".

'Network adapter 8' = ' $8te I ".

'Network adapter 9' = ' $9te I ".

'Network adapter 10' = ' $10te I ".

}

Notice-EEG - ViewType VirtualMachine-property "Config.Hardware.Device" - filter @{' Name '=' VM-$i - 1 ""} | %{

$spec = new-Object VMware.Vim.VirtualMachineConfigSpec

$_. Config.Hardware.Device | where {$_-is [VMware.Vim.VirtualEthernetCard]} | %{

$dev = new-Object Vmware.Vim.VirtualDeviceConfigSpec

$dev. Operation = "├editer."

$dev. Device = $_

$dev.device.Backing = new-Object VMware.Vim.VirtualEthernetCardDistributedVirtualPortBackingInfo

$dev.device.backing.port = new-Object VMware.Vim.DistributedVirtualSwitchPortConnection

$dev.device.backing.port.switchUuid = $dvs. UUID

$dev.device.backing.port.portgroupKey = $hash [$convertTab [$_.]] DeviceInfo.Label]]

$spec. DeviceChange += $dev

}

$_. ReconfigVM ($spec)

}

}

Tags: VMware

Similar Questions

  • How to change the type of adapter on a virtual computer network

    Hello

    I'm testing the network drivers in the virtual machine. My current VM has a 79 c 970 AMD Ethernet controller but I want to test different drivers. so is it possible for me to use another Ethernet controller type on a virtual machine? For example all cards Realtek?

    Currently, I use VMware Workstation 7.

    Thank you

    Zheng Da

    You do not have a lot of choices:

    -Without VMware tools, you will be using the vlance network adapter

    -With VMware tools, by default, you use the VMware AMD Pcnet network adapter

    -You can change inside the VMX configuration file and insert the following line:

    ethernetX.virtualDev = "e1000".

    Where X is the number of your network adapter (0 for the first, 1 for the secod, etc...). This will transform the adapter in an Intel PRO 1000.

    Marcelo Soares

    VMWare Certified Professional 310/410

    Master virtualization technology

    Globant Argentina

    Review the allocation of points for "useful" or "right" answers.

  • Change the uuid (bios.uuid) to a virtual computer

    Hello

    I tried to change the UUID of this way:

    var UUIDlog = vcVM.config.uuid;
    System.log("UUID at the moment: " + UUIDlog);
    System.log("UUID to set : " + UUIDnew);
    vcVM.config.uuid = UUIDnew;
    var UUIDcontrol = vcVM.config.uuid;
    System.log("UUID after change: " + UUIDcontrol);
    

    vCO shows the correct value of MB but the VMX file is not updated.


    [17:05:48.923 2015-01-07] [I] UUID at the moment: 564dc846-3c30-b95f-84fc-4d9e168ecd07

    [17:05:48.923 2015-01-07] [I] UUID set: 42286f25-0cfe-4a18-ffd4-79a682663297

    [17:05:48.923 2015-01-07] [I] after change UUID: 42286f25-0cfe-4a18-ffd4-79a682663297


    Someone knows what's the problem?

    Use the script reconfigVM_Task() method. Something like the following code:

    var spec = new VcVirtualMachineConfigSpec();
    spec.uuid =  "..."; // place your new UUID value here
    vm.reconfigVM_Task(spec);
    
  • Assign 2 network adapters to a virtual computer.

    Hey guys, I'm going to implement Microsoft Lync and I'll be VMing the edge transport server.  The edge transport server needs 2 network cards on the server.  One from the firewall that will carry data for SIP trunk, as well as the other goes to the front-end server where it routes, archives, etc.  Attached to the post, is how I currently the have set.

    vswitch.png

    When I boot on the edge (W 2008 R2) Server I see only a single network adapter.  I also tried to put the two cards on 2 separate networks of Vm, but I don't know exactly how this works for my situation.  Any help would be greatly appreciated, thank you for your time.

    Now select the transport Edge VM of the inventory server.

    Select the Summary tab and then choose the option change the parameters.

    You can see an Ethernet card in the hardware list. Select the adapter and replace the "VM Network3" portgroup.

    Add one more Ethernet Adapter (vNIC).

    Hardware tab click Add.

    In the Add Hardware dialog box, select Ethernet adapters and click Next.

    Select the "VM network4" portgroup and complete the process by clicking on the Finish button.

    Now the virtual machine has two NICs connected to two networks.

  • Need help! Will pay! Need a script that will change the size of the art on several files.

    I'll PayPal someone MONEY right now for this script. I have more than 400 files to process.

    System/software: Adobe Illustrator CS6 on PC
    Filetype (s): .ai

    I have more than 400 .ai files that contain work in all different sizes. I need a script that resizes the work at certain height or width specifications below.

    Some of the height of the work is greater than the width, some of the width of the work is greater than the height.

    If the overall of the art vertical height selected is greater than the width, I need the new height to be 166,6 pt
    If the horizontal art width selected is greater than the height, I need the new width to 166,6 pt

    The value of the width/height unchanged at 166,6 pt must be limited to the new values.

    If possible, I also need to change the size of the artboard to 216px x 216px. He is currently in 512px x 512px.

    Help, please! I'll pay!

    EmojiStickers wrote:

    I'll PayPal someone MONEY right now for this script. I have more than 400 files to process.

    Help, please! I'll pay!

    What is your budget?

    Check this thread and see if it helps, I have a script to resize work plans

    http://forums.Adobe.com/message/4853547#4853547

  • Need to change the default save a document to a card reader in acrobat from adobe pro xi

    We have many users to annotate PDF files, and we need Adobe pro to automatically save the PDF files to a shared drive on the network. So I need to change the default save a document to a card reader in Xi'an of acrobat from adobe pro for everyone.

    Hi sonjab80769668,

    There no such customizable settings in Acrobat Pro XI to make this network as a default location to save the files.

    Kind regards
    Rahul

  • need to change the language to English - United Kingdom for English - United States

    Just upgraded to FF 7.0.1 and now change appears in the form of books. Need to change the language to English - United Kingdom for English - United States.

    Thank you

    Dennis

    You can check the order of the installed languages:

    • Tools > Options > content > languages > choose
  • Re: I need to change the CD/DVD drive in my Satellite Pro P200

    Hello

    I need to change the unit of DVD - RW in my Satellite Pro P200, but I 'don't know remove the old unit.

    Someone help me?

    Thank you.

    (Sorry for my English: S).

    Hello

    I advise you to visit this side:

    http://www.irisvista.com/tech/

    Note, if you don't find your model, you can see for others, who may be similar. 1 last thing, remove the battery and use gloves for protection (due to static), be careful with the holders of hidden

    Good luck!

  • I need to change the keyboard on Tecra M5

    Hello

    I need to change the keyboard on a tecra m5.
    Unfortunately, this is not mentioned in the manual how to do this.

    Please advice.

    Thanks in advance for your help.

    Best regards
    Wim Gijsels

    Hello

    I think that it s not mentioned in the manual, because I should only be made of professional technicians for laptop

    In any case, a friend of exchanged me the keyboard and told me to remove the keyboard first support. Who s the plastic cover between the keyboard and LCD display. So open the LCD screen and use your fingers on both sides and lift the keyboard bracket. There are two screws that attach the keyboard under the door-keyboard. Remove the two and lift the keyboard. Last but not least remove the keyboard plate to remove the cable from the keyboard connector.

    As you can read it's not that complicated and I hope I could help a bit! :)

  • Satellite Pro A60. I need to change the cd/dvd drive

    I am a complete "newbie" to this kind of help is welcome. I need to change the cd/dvd drive the current one is as good as a horse rocker with a broken leg! I also need to buy one that won't break the Bank.
    Thanks in advance.
    Countryman

    Hello

    You will need a compatible CD/DVD player.
    Not all readers are supported due to different master/slave/c-salt settings.
    ODD, that uses wrong settings will not be recognized by the BIOS.

    You can buy a compatible player to a Toshiba ASP in your country.
    You can also consult your user manual.
    In my manual, I could find some information on the compatible sides

  • Computer laptop need to change the HDD in the SDS?

    Have 3 questions related to the Toshiba SSD!
    1. what laptop need to change the HDD in the SDS?
    ATA, http://www.toshiba.com/taec/adinfo/ssdfacts/ so 1.8 and 2.5, I look at who is the same dimenssions and right?

    2. I have this model Toshiba R200-S2031, is it possible to change drive HARD 80-SSD 256 1.8 inches? I understand that my model has 1.8 IDE I can't take 2.5? But replace IDE ATA is possible that they are the same size?

    3. If I R500 with 64 SSD drive, can I replace it it with greater SDS and the same size of thumb? Let's say I have 2.5 64 GB SSD ich so I could replace it with 500 GB SSD?

    tnaks for answers.
    and Toshiba - thanks to make small laptops, really enjoy.
    you want to update faster, but I LIKE THEM!
    Thanks Toshiba!

    Husbands

    (1) as a general rule, all laptops can be upgraded to an SSD. If the connector on the SSD is the same as the original hard drive connector, it should work.

    (2) I believe there are 1.8 "PATA SSD available, google is your friend.

    (3) I think the R500 is using a connector ZIFF customized for the SSD drive, then you will not be able to install a standard SATA or PATA 2.5 "SSD Drive. I don't know if you can buy SSDS with the connector ZIFF, once again, google can help you.

  • I need to change the note/endnote.

    I write my RESUME, and I have a large number of appendages, that I have to put in the body of the text.

    I tried to do in the pages and the best option is to use an endnote, but I need to change the Exhibitor in order to appear ' doc 1 ' ' doc 2 '' ' doc 3 "" doc 4 "instead of"1""2"'3' '4' only." ""»

    Is this possible?

    Y at - it another option in addition to the note?

    Thank you

    No one who wants to get hired puts notes/endnotes in their curriculum vitae. If you do this, you write a report, not a professional CV, which should be in a concise and standardized format (mainly for the very picky, the applicant tracking software). I suggest that you omit the end notes/notes and do research on what constitutes a professional cover letter and resume writing for your job sector target.

  • Apple need to change the title of we are here in support we are here to listen to

    Apple need to change the title of we are here in support we are here to listen to

    Say to Apple.

    https://www.Apple.com/support/feedback/

  • Need to change the palette display function

    Hello!

    I looked through the options, but don't not found how to do function pallet to be able open Subvi cumstom location. I have attached two photos - it displays what I and the second picture shows what I want.

    PS: I have LabView 7.1

    Oh, OK. Your photos have been somewhat misleading. I thought you wanted to just have the names of the categories. If you want to include a pallet to your own record, you need to change the palette as already mentioned. The Help of LabVIEW describes how to proceed. It is in the LabVIEW environment-> section of customizing your work environment.

  • I need to change the DHCP Pool to the LIST of 'DECLINE' for WINDOWS 2003R2

    Applies to: Windows | Windows 7 | Security, privacy, and user accounts
    I need to change the DHCP Pool to the LIST of 'DECLINE' for WINDOWS 2003R2 - I am unable to view the file named MACLIST.txt in C:\windows\system32, even if the file system is open and I am the administrator with full user rights. I see this file name in the REGEDIT, but cannot display to open it and place it in the MAC addresses I want to REFUSE in the server pool. The operating system is Windows Server 2003R2 Standard - SP 2

    Please help

    PRyan

    Hi SummaCorp,

    Thanks for posting your question in the Microsoft answers Forum.  If you have questions about Windows Server 2003, please visit the Windows Server Community.

Maybe you are looking for