Script to create multiple virtual machines model works is not for the network adapter variable

We are working on a script to create multiple virtual machines from a template. The script works fine, but when we try to include commands to set the NIC to a group of specific ports on a dvswitch script errors on. Here's what we have so far. This script (less network variables) works, but we would like to include the network configs in the script as well.

-------------------

This is the part of the script that configures the network/dvswitch adapter... but does not work properly.

$myResourcePool = get-ResourcePool-name DQOL

$dsName = get-Datastore-name "DQOL-DS01.

$myTemplate = get-Template-name "DQVTemplate".

$distributedSwitchPortGroup = get-VirtualSwitch-distributed - name "CVE-dvS04-Nexus - k 5 | Get-VirtualPortGroup-name '979-DQ-SHARED '.

New-VM-name MyVM1-model $myTemplate - Networkname ResourcePool - $myResourcePool - OSCustomizationSpec $mySpecification $distributedSwitchPortGroup - Datastore

(Get-$dsName data store)

New-VM-name MyVM2-model $myTemplate - ResourcePool $myResourcePool - OSCustomizationSpec $mySpecification - Datastore (Get-$dsName data store)

_____________________

!!!!!!!  This part works, but without specifying a network/dvswitch... card!

$myResourcePool = get-ResourcePool-name DQOL

$dsName = get-Datastore-name "CVE-SAN-ISG-DS02-02ef.

$myTemplate = get-Template-name "DQVTemplate".

New-VM-name MyVM3-model $myTemplate - ResourcePool $myResourcePool - OSCustomizationSpec $mySpecification - Datastore (Get-$dsName data store)

New-VM-name MyVM4-model $myTemplate - ResourcePool $myResourcePool - OSCustomizationSpec $mySpecification - Datastore (Get-$dsName data store)

Here is the error we get:

New-VM: all parameters can be resolved by using the specified named parameters.

C:\Users\capuanoj\Desktop\Create-multiplevms-fromtemplate.ps1:6 char: 7

+ New-VM < < < <-name MyVM1-model $myTemplate - Networkname $distributedSwitchPortGroup - ResourcePool

ePool - OSCustomizationSpec $mySpecification - Datastore (Get-$dsName data store)

+ CategoryInfo: InvalidArgument: (:)) [new-VM], ParameterBindingException)

+ FullyQualifiedErrorId: AmbiguousParameterSet, VMware.VimAutomation.ViCore.Cmdlets.Commands.NewVM

You cannot use the - model and Networkname - parameters of the cmdlet New - VM in a single order, because both are in different parameter sets. You must first create the virtual machine and then use the cmdlet Set-NetworkAdapter to change the portgroup of the virtual machine. As in example 4, assistance from cmdlet Set-NIC:

--------------  Example 4 --------------

C:\PS>$myNetworkAdapters = Get - VM | Get-NetworkAdapter-name "NIC 1.
$myVDPortGroup = get-VDPortgroup-name MyVDPortGroup
Together-NetworkAdapter NetworkAdapter - $myNetworkAdapters - $myVDPortGroup Portgroup

Retrieves all network named "NIC 1" cards of all virtual machines and connects to the specified distributed port group.

Tags: VMware

Similar Questions

  • Help for a demo: create multiple virtual machines

    Hello

    I am a beginner in vCO, I completed the installation and configuration with success and I started to create workflows, but I guess that I need help with an example that I started yesterday:

    I am creating several virtual machines at the same time, I mean all the user have to do is say how VMs, he wants to be created and the workflow must do the rest, but I don't know what is the best way to do so, in the present workflow in the library , find us only 'create simple VM' so I added a few scriptable tasks to this workflow, but still can't do what I want.

    Any solution plese? or a few best practices to perform this type of workflow? Maybe I missed a workflow can create multiple virtual machines with different names but the same configuration.

    Thanks in advance,

    This can help out you.

  • Failed to create new virtual machines on ESXi4.1 due to the error of slot

    Hi people,
    I am unable to create new virtual machines more on ESXi4.1 host due to the error of the slot. Its shows error "number of devices virtual exceeeds the maximum controller. In a cluster, we have 3 host ESXi 4.1.
    Each ESXi is IBM 3850 M2 / x 3950 M2, CPU Cores 24 CPUsx2.665 GHz.Processor Intel Xeon x 7460 @ 2 .66GHz CPU Type

    Please find the attached screenshot. Any help will be much appreciated.

    Thank you
    vmguys

    See http://kb.vmware.com/kb/1016221

  • Scripts for clone/create several virtual machines model.

    Hello

    In the past I used viMa with ghettoClone.sh to create one or more virtual machines based on a model - however are there any similar scripts that run on VMA which can also be used to do the same thing. Because scripts can stand up to ESXi 3.5U2 however used ESXi4

    So, I'm looking to see if there is anything similar, which can be used for ESXi4 with VMA?

    See you soon

    Absolutely must. At this point it is probably not something you want to do or need to do that cannot be done by one of your scripts.

  • Create multiple virtual machines with 2 network cards

    Hey guys -.

    Been researching some scripts of difference but did not find one who will help me in my situation.

    I'm looking for a script that will allow me to clone model and apply network settings to 2 network cards.

    1 clone Vms + 20 model

    2 Let me send it to a particular lun (using a few LUNS to available)

    3. choose a custom unique specification

    4. apply intellectual property on 2 NICs (primary and backup).

    Any help would be sincerely appreciated.

    Thank you

    Sorry to lose this thread out of my sight.

    What follows is an attempt to meet all the conditions you listed.

    $numberOfVM = 20$baseVMName = "VM"$templateName = "Template"$osCustName = "MyCust"$IPBase1 = "192.168.1."$IPBase2 = "192.168.2."$IPMask = "255.255.255.0"$IPGate1 = "192.168.1.254"$IPGate2 = "192.168.2.254"$IPDns1 = "192.168.1.100"$IPDns2 = "192.168.2.100"
    
    # Target resourcepool$resPool = Get-ResourcePool -Name Resources
    
    # Get the template$template = Get-Template -Name $templateName
    
    # Create a copy of the OS Customisation SpecTry {    Get-OSCustomizationSpec -Name tempOSCust |    Remove-OSCustomizationSpec -Confirm:$false -ErrorAction Stop}Catch {}
    
    $osCust = Get-OSCustomizationSpec -Name $osCustName |     New-OSCustomizationSpec -Name tempOSCust -Type NonPersistent
    
    # Clone the number of requested VM1..$numberOfVm | %{    # Find the datastore with the most free space    $ds = Get-Datastore | Sort-Object -Property FreeSpaceGB -Descending |        Select -First 1
    
        # Update the OS Customisation Spec NIC parts with the IP addresses    Get-OSCustomizationNicMapping -OSCustomizationSpec $osCust |    Set-OSCustomizationNicMapping -Position 1 -IpMode UseStaticIP -IpAddress "$IPBase1$_" `        -SubnetMask $IPMask -DefaultGateway $IPGate1 -Dns $IPDns1 -ErrorAction SilentlyContinue | Out-Null
    
        Get-OSCustomizationNicMapping -OSCustomizationSpec $osCust |    Set-OSCustomizationNicMapping -Position 2 -IpMode UseStaticIP -IpAddress "$IPBase2$_" `        -SubnetMask $IPMask -DefaultGateway $IPGate2 -Dns $IPDns2 -ErrorAction SilentlyContinue | Out-Null
    
        # Create the new VM    New-VM -Name "$baseVMName$_" -Template $template -OSCustomizationSpec $osCust `        -Datastore $ds -ResourcePool $resPool  | Out-Null}
    

    The script will create clones of $numberOfVM of the model. The virtual machines will be created at the root of the bunch, and they will be called VM1, VM2...

    The OSCustomizationSpec needs to exist and must have 2 network cards.

    The script finds the data store with more free space to create each virtual computer.

    Addresses IP of NIC are consecutive, for example on NIC1 you get 192.168.1.1, 192.168.1.2... and so on.

    Let me know if you have any questions.

  • Can't access file system host (MAC) shared in VMware vCenter Converter Standalone Client when wanting to create a VMware image (Windows 7 in Parallels virtual machine running on a MAC) for the option of machine Powered On.

    File HOST (Mac) system is currently shared in the Parallels virtual machine and is accessible through Windows Explorer and works correctly in the Virtual Machine environment, however, after installing vCenter Converter application on the Windows virtual machine these shared folders are not accessible from the conversion tool in the selection of the target destination of the file VMware (s). I can't select an existing folder on drive "C:" to write the image so that there is not enough space available for the VMware image and it must be written in a different file system, while the image is being created.

    Anyone know a way around it to show the target to write the image on the host (MAC OS) file system or is it a bug?

    Thanks for the reply.  It seems that the maps are not displayed if they were created as actions by the hosts.  When I created a mapping directly from Windows, then this mapping appeared and the conversion worked fine.

  • QuickLook works do not for the pictures in Messages

    I am a very experienced user with multiple Macs and several iOS devices, all El Capitan running (or Yosemite) and iOS 9.3 and all messages (SMS/text/iCloud) synchronize correctly between all devices. But on my main Mac, a 2015 (MBP) (El Capitan) MacBook Pro, if someone texted me photo, when I select this picture, and then use the space bar to call QuickLook (to enlarge the photo), I get a window (white) large, empty, instead of the actual image:

    (Interestingly, the empty window door the correct name of the photo, but no image).

    So, on this machine, if I want to display an image that I received, I have to drag Messages on the desktop, and then I can use QuickLook. But QuickLook refuse to work within the Messages.app. (This is NOT the case on any of my other Macs. On these machines, when I hit the space bar, I get a larger version of the picture, as expected. "But it's the Mac I use more often!)

    I should also mention that this MBP is new, and its contents have been cloned, from a backup of my previous MBP a few weeks ago. And the previous MBP had the same problem, both in El Capitan and previously in Yosemite. This seems to suggest that there is a kind of corruption, somewhere.

    Any suggestions?

    I've considered trashing preferences, but Messages has several preferences files, and I don't know which ones to affect function. I'm fine with reset preferences of the application or on the way home my account information. But more importantly, if possible, I don't want to lose my message history.  :-)

    Preferably related files include:

    com.apple.imservice.iMessage.plist

    com Apple.IMessage.Bag.plist

    com Apple.iChat.plist

    com Apple.imagent.plist

    No one knows which of these may be better to try to remove, while retaining the history of my message? Alternatively, if I'm on the wrong track, I would appreciate any other suggestions.

    Thank you!

    Hello

    The captain also lacks the ability to open preview

    This photo is also an AIM chat who actually sent this photo 'online' if I zip (Compress) them.

    com Apple.iChat.plist is not holder iMessage 'story' that he she now holds the recent list of cat (which is useless because there is no option in the file Menu to access).  It also holds all preferences and Settings Menu d ' option.

    com Apple.imagent.com holds the account names of all accounts that you have and are involved in logging operations behind the scenes. There is a process called image that starts when the computer does and it will be based on the setting in the General Section identify enough to 'listen' servers. The parameter in the section general read "when I leave Messages, set the status offline" - it does not affect the iMessages account that will always show offline Messages.

    com.apple.imservice.iMessage.plist it is not longer used.  Yosemite El Capitan, it uses com.apple.ids.service.com.apple.madrid.plist instead.  It is also only on the info on behalf of iMessages and not on the 'history' or how pictures of cats are treated.


    com Apple.IMessage.Bag.plist it lists only the last used Apple iMessages server.


    However, there are these some .plist in ~/Library/Containers/com.apple.soagent/data/Library/Preferences which also play a role.

    Note the location of the path bar across the bottom.

    com.apple.messageshelper.FileTransferController.plist very probably watching the wick she holds a record of all the files and images sent to you, but in the hex names.

    View of Xcode.

    com Apple.quicklookconfig.plist doesn't seem to have relevant information.

    The next would be the Preview but .plist which is as empty as the at a glance.

    The real "live .plist lies in ~/Library/Containers/com.apple.Preview/Data/Library/Preferences , rather than having an Alias point in the folder ~/Library/Preferences.

    That said, and after reviewing through it I see no reference to what applications it is allowed to work with.

    This seems to be a question that involves 3 apps, look and preview Messages.

    All have read and write routes through ~/Library/Containers and the file final storage ~/Library/preferences.

    I am tempted to check the number of files that have lost your property and read and write permissions see this thread and useful item before the green marked resolved one.  Reset Home Folder permissions and ACLs error  (Linc offers first - marked text relatively useful, then a "Fix" that is the Green post resolved.

    20:40 on Friday. May 6, 2016

     iMac 2.5 Ghz i5 2011 (El Capitan)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro (Snow Leopard 10.6.8) 2 GB
     Mac OS X (10.6.8).
     iPhone and iPad (2)

  • encryption of table space work is not for the old imported tables?

    Hello world

    oracle version 11 g R2 database

    I request below: -.

    following the steps I followed: -.

    expdp system / * SCHEMA = VGOTS dumpfile = logfile = vgots.log ENCRYPTION_PASSWORD vgots.dmp = *.

    drop the waterfall VGOTS user

    created a directory of portfolio: -.

    CREATE or REPLACE DIRECTORY encryption_wallet AS ' / u01/app/oracle/wallet;

    changes in sqlnet.ora

    ENCRYPTION_WALLET_LOCATION =

    (SOURCE = (METHOD = FILE) (METHOD_DATA =

    (RÉPERTOIRE = / u01/app/oracle/pochette)))

    created a tablespace

    CREATE TABLESPACE vgo03

    DATAFILE ' / u01/app/oracle/oradata/orcl/vgos03.dbf'

    SIZE 150M

    ENCRYPTION WITH THE HELP OF '3DES168 '.

    DEFAULT STORAGE (ENCRYPT);

    created the user

    create the user identified by vgots VGOTS

    tablespace VGO03 default

    tablespace temporary temp

    unlimited quota on VGO03;

    Impdp system / * SCHEMA = VGOTS dumpfile = logfile = vgots.log ENCRYPTION_PASSWORD vgots.dmp = *.

    My question is:-

    When I create a table in this encrypted tablespace its working fine

    When the wallet is close, it won't let me select table

    error report:

    ORA-28365: portfolio is not open

    but the charts that I imported to expdp allows to select values

    Please help what option is I took all expdp and impdp so that it works also for old tables

    ReemaPuri wrote:

    VGOTSDBTPS was the old tablespace that was not encrypted

    and imported into an encrypted tablespace vgo03

    You can check this. I don't see any clause REMAP_TABLESPACE in your impdp command.

  • leader. Execute() works do not for the bat file

    Hi all
    My function copyToWinClipboard (text) is to get a string directly in the Windows Clipboard. Is designed to allow the user to my project just paste into the open application dialog box, an endnote. I am not sure if the Clipboard FM (supported by the methods of copy/cut/paste for Doc) really fills in the Windows Clipboard too.
    In the forum script PhotoShop I found the idea how to proceed.

    #target framemaker
    // note the blank in the path
    copyToWinClipboard ("E:\\_DDDprojects\\FM+EN escript\\FM-11-testfiles\\BibFM-collected.rtf");
    
    function copyToWinClipboard (text) {
      var theCmd, clipFile = new File(Folder.temp + "\\ClipBoardW.bat");
      clipFile.open('w');
    //  theCmd = "echo \"" + text + "\" | clip"; // this doesn’t help either
      theCmd = "echo " + text + " | clip";
      clipFile.writeln (theCmd);
      clipFile.close ();
      clipFile.execute ();
    }
    

    This script provides a short flashing (command prompt), but the Clipboard does not contain the expected string. However, when double clicking generated I:\!_temp\ClipBoardW.bat the Clipboard is filled correctly.
    IMHO the execute method does not work for bat files. In another area of my script project I run an exe with this method correctly.

    I just wanted to report that the example script in your first post doesn't work on my computer.

    You mention that the command window appears shortly, which indicates that the .bat file is executed.

    Perhaps execution fails at another time?

    If you want to open the command window and the arrival of messages, add the command "pause" in the batch file:

    ....

    clipFile.writeln ("pause");

    clipFile.close ();

    clipFile.execute ();

    I use FM11 on Windows 7.

  • Files in RoboHelp not working is not on the network in Windows 7

    Hello

    my company is in the process of upgrading to Windows 7 and we have a few applications using RoboHelp

    (.chm) files help which is stored on the network.  In XP, everything worked fine, but all pages now display "page cannot be found".  If I copy the files on my c: drive then they open fine.  Most have been created in previous versions of Robohelp, so I thought this might be the only problem and upgraded to RoboHelp 7, but that has not changed anything.  I read in other posts that there are some problems with RoboHelp on the network, but I can't avoid it...  Is there some network settings that can be changed or is this maybe fixed in RoboHelp 8?  I can't put on a request to my boss to upgrade unless I have solid evidence, it will work...

    Hello

    I think that Colum misundersood you. I understand ask you if this is fixed in version 8 sense "RoboHelp 8" not Windows 8.

    The question is not do anything really associated with RoboHelp. The problem is with Windows. The fact is, for years now, CHM files did not work when placed on network drives.

    If you look about Peter Grainge on the subject ( http://www.grainge.org/pages/authoring/chm_mspatch/896358.htm ), you will see that it is the link to the article dated June 2005 Microsoft Knowledge Base. If this change has been initially implemented by Microsoft five years ago and have just now it.

    See you soon... Rick

    Useful and practical links

    Wish to RoboHelp form/Bug report form

    Begin to learn RoboHelp HTML 7 or 8 days - $24.95!

    Adobe Certified RoboHelp HTML Training

    SorcerStone blog

    RoboHelp EBooks

  • FN + F8 doesn't work is not for the Satellite L650

    I just reinstall the system to windows 7 ultimate 64 bit and already install the wlan driver and package.

    "In the Device Manager,"broadcom network adapter wlan"card works very well, but he can't find any available wireless network since ' fn + f8" is missing or does not.

    Someone at - not how to solve this problem?

    Hello

    Other FN keys work correctly?
    As far as I know that you will install VAP and Support of Flash Card Utility to get the FN keys to work!
    Please check this!

    In addition, the WLan driver must be installed in order to get the FN + F8 key combination.
    Usually, that's all you need

  • G3 250: kye f2 f3 doesn't work is not for the brightness adjustment

    RES / sir

    I have laptop HP 250 g3 on the frist day feature kye f2 and f3 does not since I purchesed help me please how to update the driver for the brightness adjustment

    Hello:

    Your laptop is not supported for Windows 8.

    'Re missing you the graphics driver.

    If your model has a Core of 4th generation, try this driver.

    https://Downloadcenter.Intel.com/Detail_Desc.aspx?DwnldID=24348

  • HP Photosmart C309a AiO Wireless on and work, can not find the network!

    My printer has stopped printing a couple of days.  It was fine, now it is not.  The blue light wireless radio is turned on, but when I run the network set in place, it works simply and can not find my network.  I ran the network diagnostic and it detects my network, but can't find my printer.  On the test page, it fails on SSID.  I could use some help to get this operational back guys!  Thank you!

    Well, I can't comment officially, but I'm sure that has been discussed in, and design changes avoid this problem.

    Regarding something is through HP, you could call the HP Technical Support and check if you have options to upgrade to a new printer. They should have a list of printers and prices offered as part of the upgrade process. There is no charge to call and check the options you have. If you are in the United States, call the 1-800-474-6836. Otherwise, click on the contact HP link at the top of this page.

  • OracleTextSearch doesn't work is not for the CSV file

    Hi all

    I use Oracle Webcenter content with Version: 11.1.1.9.0 - 2015-04-14 07:19:29Z - r126792 (Build: 7.3.5.185).

    I configured using OracleTextSearch below of setting in the config.cfg file

    SearchIndexerEngineName = OracleTextSearch

    I can search text for the file types such as text, excel, docx, pdf, but I'm not able to do text search the csv file.

    Please suggest any alternative to enable text search the csv file.

    Please find the below the example of csv file.

    "Id","CurrencyIsoCode","City","Status"
    "1","GBP","","Activated"
    "2","GBP","Reading","Expired"
    "3","GBP","Reading","Expired"
    "4","GBP","Brighton","Activated"
    "5","USD",""Atlanta"""","" Georgia""","Expired"
    "6","GBP","Reading","Expired"
    "7","GBP","Bristol","Activated"
    "8","GBP","Chicago","Expired"
    "9","GBP","Chicago","Expired"
    "10","GBP","Chicago","Expired"
    "11","GBP","Chicago","Expired"
    "12","GBP","Reading","Activated"
    "13","GBP","London","Activated"
    "14","GBP","Reading","Expired"
    "15","GBP","Singapore 068893","Activated"
    "16","USD","Overland Park","Activated"
    "17","GBP","London","Activated"
    "18","GBP","Hangzhou","Activated"
    "19","GBP","Southampton","Activated"
    

    Do something:

    Edit config.cfg and add below variable:

    TextIndexerFilterFormats = csv

    After that, save and exit. Restart the server.

    Checking in a new file csv and do a word search.

    It should work let me know again, you have a question or not

  • Series works do not for the CS6 Master

    Hi, I uninstalled my Adobe Master Collection and re-installed, only to find the serial number no longer works. What is the best way to solve this?

    Also how can I prevent that from happening in the future? Thanks in advance!

    Best to Contact the customer.

Maybe you are looking for