Change vnic-portgroup assignment during the Clone operation

Hello

I have a powershell script that creates virtual machines from a template, and I want to change the portgroup vnic

assignment in my Clone specifications.

$vmcSpec = new-Object VMware.Vim.VirtualMachineCloneSpec

$vmspec. Config = New-Object VMware.Vim.VirtualMachineConfigSpec

How you can access the configuration of the NIC through $vmspec. Config? With the deviceChange property.

Thanks for your help

Olivier

Yes, you can use the VirtualDeviceConfigSpec via the deviceChange property.

A tip useful is first find the device in question and then simply change the required properties.

In this case, the network (portgroup) should be changed

$templateName = 
$newVM = 
$esxName = 
$poolName = 
$nicName =                                 # Ex "Virtual Ethernet Adapter"
$newPGName = 
$folderName = 
$datastoreName = 

$fromVM = Get-View -Id (Get-Template $templateName).Id
$folder = Get-Folder $folderName | Get-View
$esx = Get-VMHost $esxName | Get-View
foreach($pg in $esx.Network){
     if((Get-View $pg).Name  -eq $newPGName){
          break
     }
}

$found = $false
foreach($dev in $fromVM.Config.Hardware.Device){
     if($dev.DeviceInfo.Label -eq $nicName){
          $found = $true
          break
     }
}

$spec = New-Object VMware.Vim.VirtualMachineCloneSpec
$spec.Config = New-Object VMware.Vim.VirtualMachineConfigSpec
$devSpec = New-Object VMware.Vim.VirtualDeviceConfigSpec
$devSpec.device = $dev
$devSpec.Device.Backing.DeviceName = $newPGName
$devSpec.Device.Backing.Network = $pg
$devSpec.Operation = "edit"
$spec.Config.deviceChange += $devSpec

$spec.location = New-Object VMware.Vim.VirtualMachineRelocateSpec
$spec.location.datastore = (Get-Datastore $datastoreName | Get-View).MoRef
$spec.location.host = (Get-VMHost $esxName | Get-View).MoRef
$spec.Location.Pool = (Get-ResourcePool $poolName | Get-View).MoRef
$spec.powerOn = $false
$spec.template = $false

$fromVM.CloneVM_Task($folder.MoRef, $newVM, $spec)

Tags: VMware

Similar Questions

  • 0xC1900101 - 0 x 20017 installation failed during SAFE_OS with an error during the START operation

    When you try to upgrade Windows 7 SP1 to Windows 10 ' 0xC1900101 - 0 x 20017 installation failed during SAFE_OS with an error during the START operation "is a problem recurring and none of the solutions posted for a Samsung RV511 work.

    When will there be a solution of Microsoft?

    Concerning

    Hello

    Since Windows 10 is a completely new operating system, the computer manufacturer might still not have designed and developed drivers for it. As suggested waiting for the manufacturer to release the necessary drivers for the hardware and then try the upgrade.

  • Error ORA-022887 during the insert operation how to handle correctly...

    Hello everyone I got an error in during the insert operation how to handle correctly?
    SQL statements below.

    INSERT STAFF. TRANSLATIONS (TID, SCRIPT_NAME, TAG, TR, FR, LOCAL)
    VALUES ((SELECT LOCATION. SQX_TID. (NEXTVAL DOUBLE AS TID), 'TEST_TEST', 'TEST', 'TR', 'FR', 'LOCAL');

    Thank you

    Try this,

    INSERT STAFF. TRANSLATIONS (TID, SCRIPT_NAME, TAG, TR, FR, LOCAL)
    VALUES (PERSONAL. SQX_TID. NEXTVAL, 'TEST_TEST', 'TEST', 'TR', 'FR', 'LOCAL');

  • Add vNIC PortGroup scope with the REST API security group

    I created a security group within the reach of a PortGroup via the REST API. Now, I'm trying to add a vNIC, also via the REST API.

    To help illustrate, I have a JMTest1 VM with 1 vNIC connected to the PortGroup which is the scope of the security group. When I change this group the first item in the list that could be added to the security group is the first (and only) JMTest1 vNIC.

    AddvNICToSecurityGroup.PNG

    To add it via the REST API, I need to provide the following:

    https://192.168.x.x/API/2.0/services/SecurityGroup/SecurityGroup-XX/members/ < member-moref >

    for example I need to understand what the < member-moref > for the vNIC to JMTest1 and this is what I have a problem with.

    If I add the vNIC through the user interface and then interrogate the security group it gives me below the answer:

    < securitygroup >

    < objectIdobjectId > securitygroup-xx < / objectId >

    < type >

    < typeName > SecurityGroup < / typeName >

    < / type >

    < name > JMTest7 < / name >

    < description / >

    < revision > 9 < / revision >

    < objectTypeName > SecurityGroup < / objectTypeName >

    < scope >

    < id > dvportgroup-xxxxx / < ID >

    < objectTypeName > DistributedVirtualPortgroup < / objectTypeName >

    < name > dv-xxxxx < / name >

    < / scope >

    < extendedAttributes / >

    < inheritanceAllowed > false < / inheritanceAllowed >

    < member >

    500758f6-b97b - 7A 79 - 0c < objectId > 04 - 996f53edf3f0.000 < / objectId >

    < type >

    Vnic < typeName > < / typeName >

    < / type >

    < name > JMTest1 - NIC 1 < / name >

    < revision > 6 < / revision >

    < objectTypeName > Vnic < / objectTypeName >

    < scope >

    < id > vm-xxxxx / < ID >

    < objectTypeName > VirtualMachine < / objectTypeName >

    < name > JMTest1 < / name >

    < / scope >

    < extendedAttributes / >

    < / member >

    < / securitygroup >

    It seems that the < member-moref > for the JMTest1 vNIC is < objectId > 500758f6-b97b - a 7, 79 - 0c 04 - 996f53edf3f0.000 < / objectId >

    If I run now:

    https://192.168.x.x/API/2.0/services/SecurityGroup/SecurityGroup-XX/members/500758f6-b97b-7a79-0c04-996f53edf3f0.000

    then the vNIC is successfully added to the security group. (yay!) So I am now left with the task of how to get

    500758f6-b97b - 7A 79 - 0c < objectId > 04 - 996f53edf3f0.000 < / objectId >

    of a vNIC?

    I have looked at the object in the Mob vCenter and via PowerCLI, but cannot see how to derive from it.

    Anyone know the answer to that?

    The uuid vnic is created by concatenating the vm instanceUuid + '. ' + the last three digits of the vnic device key.  (The vnic is located in the area of the config.hardware.device of the virtual machine and the key will be to shape 4xxx, where xxx represents the 3 numbers you need).

  • Eclipse Plugin config changes for different versions of the target operating system.

    Nobody knows what changes should I make for my config Eclipse generate a cod for different target operating system versions?

    Thank you

    Glenn

    You can configure it by clicking in the window menu, selecting Preferences, expand BlackBerry JDE, selecting installed components and choose the appropriate BlackBerry JDE or BlackBerry JDE component Package.

  • Maximum size of the VMDK file we can assign during the P2V?

    Hello.

    We conduct P2V for a server physical and would like to address one of the disk for P2V.

    Rather than extend the VMDK disk in the future, we would like to extend during P2V.  Given that VMDK file maximum size is 2 TB for ESXi host, we can assign 2 TB for this VMDK file OR there is a recommended maximum size to use?

    Thank you

    I have myself yet, but I guess you should be able to assign the maximum size of virtual disk, depending on the block size of the data store (for ESXi versions before the 5.x/VMFS-5). That said, I suggest that you don't assign it more than 2 032 GB in order to create snapshots for this virtual disk (see "calculates the time system required by the snapshot files" at http://kb.vmware.com/kb/1012384)

    André

  • Changes to spreadsheets lost during the use of numbers on iPad

    I have a mini iPad.  I use iOS v9.1 v2.6.1, numbers.

    Since this version of numbers and the previous, I noticed that some of my edits and entries to my spreadsheets get lost when I reopen it the worksheet. Happens all the time, but enough times to get my opinion.  I don't have to observe what sequence of actions cause changes and entries to get lost down.  Don't know if anyone has this problem?

    Can you provide details?  Do you have documents in iCloud?  Are you open on other devices too?

    SG

  • change of KING imaq1394 during the capture

    Hello

    I use c ++ to implement an application that performs a continuous drain on my firewire camera. According to the manual, there are two ways to do so after an imaq1394CameraOpen2:

    (1) imaq1394SetupGrab-> imaq1394Grab2 (several times)

    (2) imaq1394ConfigureAcquisition-> imaq1394GetBuffer2-> imaq1394StopAcquisition (several times)

    Both options seem to do pretty much the same thing if I put continuous = 1 and bufferCount = 3.

    What I didn't understand is the last rectangle parameter. I could put what, but unless I changed the IMG1394_ATTR_FORMAT7_ * with SetAttribute before ConfigureAcquisition, the size of the image would not change, which has been upheld by GetAttribute. Unfortunately, this doesn't seem to work while an acquisition is running. So here's my question: do I have to stop, delete, configure, and start each time I change the return on investment or y at - it another way to do?

    Definition of attributes such as shutter time or acquire works very well on the acquisition.

    I use a Redlake Megaplus II ES11000 with NOR-DAQ IEEE 1394 version 2.0.1 of pilots.

    See you soon,.

    Tom

    Hi Tom,

    In fact, it must cancel the acquisition to change the return on investment. If you want only to move the KING but it has the same size, you may be able to use raw register written in the right registers on your camera to change the position on the fly.

    -Eric

  • Change of file server (during the copy/move)

    Hello everyone!

    I have a problem with the change of ownership of file on network shares.

    Namely, we have several (important) CIFS shares on our NetApp storage systems where the native (user) management quota is based on the file ownership. We intend to use this quota management for automation purposes, but the problem is that our analysis has shown that the owner of most of the files on these actions is - administrator. It is an unfortunate outcome of scripts hurt of the past and we need to remedy this situation.

    After much thought and keeping the overall complexity of the structure of folders in mind, it became apparent that the ideal solution would be to have users copy/move the files they need their old stocks of those newly created - and at the same time - network have the property for each file copied/moved, change somehow 'in flight' so to speak.

    Is this possible? Moving files to a volumeNTFS, on another volume, where ownhership is set to be inherited is possible - but this is CIFS shares , and it does not work.

    I googled the subject, but so far without success.

    I admit that I'm perplexed.  Any ideas are more than welcome!

    Thank you

    -Semi

    This issue is beyond the scope of this site and must be placed on Technet or MSDN
  • No score during the merge operation

    Dear all,

    This is the scenario that I'm testing in a 11.2.0.1 the solaris installation program

    SQL> create table mypart
       (ename varchar2(20), doj date)
       partition by range (doj)
       INTERVAL (NUMTOYMINTERVAL(1,'MONTH'))
       STORE IN (users)
      (partition p_2009 values less than (to_date('01-JAN-2010','DD-MON-YYYY'))
      )
    ;  2    3    4    5    6    7    8
    
    

    After the insertion of rare recordings, high values are as below

    SQL>  SELECT table_name, partition_name, high_value, num_rows from user_tab_partitions where table_name =UPPER('mypart');
    
    
    TABLE_NA PARTITION_NAME
    -------- ------------------------------
    HIGH_VALUE                                                     NUM_ROWS
    ------------------------------------------------------------ ----------
    MYPART   P_2009
    TO_DATE(' 2010-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'N          1
    LS_CALENDAR=GREGORIA
    
    
    MYPART   SYS_P22
    TO_DATE(' 2010-03-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'N          1
    LS_CALENDAR=GREGORIA
    
    
    MYPART   SYS_P21
    
    
    TABLE_NA PARTITION_NAME
    -------- ------------------------------
    HIGH_VALUE                                                     NUM_ROWS
    ------------------------------------------------------------ ----------
    TO_DATE(' 2010-04-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'N          2
    LS_CALENDAR=GREGORIA
    
    
    MYPART   SYS_P23
    TO_DATE(' 2010-06-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'N          1
    LS_CALENDAR=GREGORIA
    
    

    Now I initially merged these two partitions

    SQL> alter table MYPART  merge partitions  for(to_date('02-FEB-2010','DD-MON-YYYY')), for(to_date('03-MAR-2010','DD-MON-YYYY'))  into partition p5;
    
    
    Table altered.
    
    
    SQL>  Select table_name,partition_name from user_tab_partitions;
    
    
    TABLE_NA PARTITION_
    -------- ----------
    
    
    
    MYPART   P_2009
    MYPART   SYS_P23
    MYPART   P5
    

    If I try the merging of Partitions for March and may, she throws an error

    SQL> alter table MYPART  merge partitions  for(to_date('03-MAR-2010','DD-MON-YYYY')), for(to_date('01-MAY-2010','DD-MON-YYYY')) into partition p6;
    alter table MYPART  merge partitions  for(to_date('03-MAR-2010','DD-MON-YYYY')), for(to_date('01-MAY-2010','DD-MON-YYYY')) into partition p6
    *
    ERROR at line 1:
    ORA-14274: partitions being merged are not adjacent
    
    SQL>  alter table MYPART  merge partitions  p5,SYS_P23 into partition p6;
     alter table MYPART  merge partitions  p5,SYS_P23 into partition p6
                                           *
    ERROR at line 1:
    ORA-14274: partitions being merged are not adjacent
    

    So I have to insert a record for the month of April to this adjacent partition with the appearance and then associate it to p5, then finally to p23.

    SQL> insert into mypart values('xxx','07-APR-2010');
    
    
    1 row created.
    MYPART   P_2009
    
    
    TABLE_NA PARTITION_
    -------- ----------
    HIGH_VALUE
    --------------------------------------------------------------------------------
    INT SEG
    --- ---
    TO_DATE(' 2010-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
    NO  YES
    
    
    MYPART   SYS_P24
    TO_DATE(' 2010-05-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
    YES YES
    
    
    
    
    TABLE_NA PARTITION_
    -------- ----------
    HIGH_VALUE
    --------------------------------------------------------------------------------
    INT SEG
    --- ---
    MYPART   SYS_P23
    TO_DATE(' 2010-06-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
    YES YES
    
    
    MYPART   P5
    TO_DATE(' 2010-04-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
    NO  YES
    
    
    TABLE_NA PARTITION_
    -------- ----------
    HIGH_VALUE
    --------------------------------------------------------------------------------
    INT SEG
    --- ---
    
    
    
    
    SQL>  alter table MYPART  merge partitions  p5,SYS_P24 into partition p6
      2  /
    
    
    Table altered.
    

    I thought it was the holes between the existing partitions will be automatically merged, but this seems not to happen. Is it a case with partitioning interval? Is there a way to bypass this behavior? Also when I referred to one of the reference material, it is said

    "Front holes higher non-intervalle partition will be silently 'merged' as well.

    But in a real-time scenario where there is a possibility for the records to zero during a particular partition (date or number) Beach, how merge us the partitions after a while to move in the archives?

    So please mark the question ANSWER.

  • Function CalcManager CDF begins during the VALIDATE operation

    Hi, I rule bussines calling PLAN of SUPPORT in Oracle Data Integrator throught defined a custom function:

    DIFFICULTY ("CU_RUB_VAT", "VE_WORK", "D1_NA", "D2_NA", "D3_NA", "D4_NA",

    'NI_NA', 'OS_NA', 'BegBalance', 'SC_ACTUAL', 'PP_USERREP', 'CC_NA', "FY10")

    SET CREATENONMISSINGBLK

    ("IN.00061"

    'IN.00061' = - 1;

    "IN.00061" = @JRunPlan ("http://server:52255 / oraclediagent", "","", "INVEST_UNLOAD", "DEV", "WORKREP1" @LIST(""));

    IF ("IN.00061", 0) @RETURN ("UNLOAD FAILED", ERROR);

    ENDIF);

    CREATENONMISSINGBLK OFF SET;

    ENDFIX


    CDF @JRunPlan ("http://server:52255 / oraclediagent", "","", "INVEST_UNLOAD", "DEV", "WORKREP1", @LIST("")); 

    Runs automatically when I rull bussiness Validate in the calculation Manager!


    Now someone something on this subject?

    I solved my problem. The reason was in the "Runtime" property in CDF. If "runtime" undefined Essbase tries to run the CDF function!

    This is the description of the oracle documentation:

    "To designate the custom as a function of runtime function. Normally, Essbase executes functions whose arguments are available at compile time. The Runtime property prevents that optimization, execution of functions that have constant values as operands (or not all the operands) for each block in the scope of the function. If the built-in @CALCMODE (CELL) is used, a custom function declared as Runtime can run on each cell in the range. »

  • Selected font failed during the last operation

    I've upgraded to the new 2015.5 Photoshop and now this message every time I try to type in a new document. However, I notice that I can use existing psd files and work with text in them.

    I found a solution that worked for me, thanks to forum user vladb.

    I use the latest version of PS on Windows 10. The highlighted instructions worked for me below. Good luck doing that fixed your.

    1. Release of Photoshop and the creative cloud (if installed) desktop application.
    2. Navigate to the appropriate folder
      • Photoshop CS6 and earlier versions
        Windows XP: \Documents and Settings\Local Settings\Application Adobe application
        [Windows 7: \Users\[user name] \AppData\Local\Adobe
      • Photoshop CC, CC 2014 or 2015 CC
        [Windows 7, 8 and 10: \Users\[user name] \AppData\Roaming\Adobe\Adobe Photoshop CC, CC 2014 or 2015 CC
    3. Remove the TypeSupport (Photoshop CS6 and earlier) or the folder of Cache police CT (Photoshop CC, CC 2014 or 2015 CC) and the empty the trash.
  • Use vCenter custom during the VRO flow specification

    My group and I are currently working on a compute cloud workflow where customers request a VM and it gets automatically configured using vRO/vRA.  We already have a specification in vCenter for Windows create the local administrator password and join the guest to the area.  We currently built in flow "Clone, with several network adapters and the Windows credential" for most working with hard-coded credentials.  What we have is either find a way to take the custom specification and enter the data that we need to place, or somehow apply the spec together personalised to the VM during the clone process.  I know means 2nd option, we need to go far from the built circulation to create our own, but if it's the only way then so be it.

    Any help would be appreciated,

    Thank you

    Hello

    It is possible to get a vCenter's existing customization specification and pass it to the customizeVM_Task() method, not sure if there is a workflow of library of ready-to-use for this.

    Check out these links for examples (they are "well aged" :-) but should still work in current versions):

    Need help to start with the cloning by specification of customization

    Deploy the model with customization

    and http://www.vcoportal.de/2011/04/customize-a-virtual-machine/

    customizationSpec

    I found it generally easier to use an object existing specification, and replacing just the settings I want to change a programming than to create a new suit from scratch. You might get some that mistakes a specified parameter was"not correct" back from vCenter, missing a few pieces of the specification.

    Make sure, for example, the number of network adapters configured for the virtual computer is the number of network adapter settings in the book loads.

    Could also contribute to Onyx: click through the process manually and get calls from code and the api necessary... Onyx for the Web Client

    Kind regards

    Joerg

  • Why must the clone clone snapshot at the beginning

    Hello

    I'm now thinking about the function of the cloning of vmware vCenter.

    Could someone give me an intelligent answer to my question.

    Why must the clone clone snapshot at the beginning.

    When you create a clone of vCenter, the first vCenter create a snapshot of the virtual machine.

    Why does?

    I think that having an information memory of the virtual machine to clone the machine.

    Based on the clone, he needs a shapshot.

    Is this right? If she only has not please tell me why the clone must snapshot?

    Thanks for reading.

    You cannot clone a VM running without a snapshot, because you have changes on the disks all the time during the clone process. A snapshot freezes your main drive, which allows you to clone the drive as if it was turned off.

    Concerning

  • the application was unable to start correctly (0xc0000142) Message window during the closing down, labeled cmd.exe.

    I have a problem that only occurs during the closing down. When I select Shut Down I soon get a pop up that says... the application could not start correctly (0xc0000142) click on OK to close the application. window label is cmd.exe. Whether I click on the window, closing down product and eventually after say 30 seconds the alarm disappears. clicking on the alert simply displays another alert. This only occurs during the closing down. Also, I have no problem to launch cmd.exe during the normal operation, or any other program running in the command window. I read a few posts but don't see anything exactly like this, what happens during closing down.

    Suggestions would be appreciated.  Eric

    Hello
     
    Please check if you are facing the same question when working in safe mode.
    a. restart your computer.
    b. when the computer starts, you will see your computer hardware are listed. When you see this information begins to tap the F8 on your keyboard key repeatedly until you are presented with the screen Windows 7 Advanced Startup Options.
    c. using the arrow keys, select the desired option of Mode without failure.
    d. press the Enter key on your keyboard to boot mode safe mode of Windows 7 with networking.
    e. when Windows starts, use check and Internet explore if the problem persists.
     
    For additional information see the articles below.
     
     
    If the problem exists not in Mode safe run mode startup minimum troubleshooting to find the root cause of the problem.
    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7
    http://support.Microsoft.com/kb/929135
    Note: When the diagnosis is complete, don't forget to reset your computer to normal startup. Follow step 7 in the above article.

Maybe you are looking for