NEW virtual machine migrating to different dvswitch and expanded portgroup with powercli

Hi all

I was wondering if it is possible to achieve with a oneliner powercli less than 5 Vpshere?

So far, I got this:

Get - vds 'dvold ' | Get - vm testvm | all vds 'dvnew' set-NetworkAdapter - don't
tworkName 'pg-new '.

It gives me an error message that the migration can be performed.

I installed the complement DVswitch

I think that your question can be answered for example 5 Set-card network help:

$distributedSwitchPortGroup = Get-VirtualSwitch -Distributed -Name DistributedSwitch | Get-VirtualPortGroup -Name PortGroup
Get-VM VM | Get-NetworkAdapter | Set-NetworkAdapter -NetworkName $distributedSwitchPortGroup.Name

You can convert a oneliner this example:

Get-VM VM | Get-NetworkAdapter | Set-NetworkAdapter -NetworkName (Get-VirtualSwitch -Distributed -Name DistributedSwitch | Get-VirtualPortGroup -Name PortGroup).Name

Tags: VMware

Similar Questions

  • How to locate a new virtual machine on a different hard disk

    VMware Fusion 3.1.1 (282344) Mac OS 10.6.4.

    I have a few virtual machines on my boot drive and am running out of space. I want to create a new Win 7 vm on a drive different but can't seem to figure out how to tell VMware to put there. I know I could create in the normal location on my boot drive and move it, but I didn't Go on the boot drive for this.

    How to create the new virtual machine on the new drive?

    Thx for advice,

    Ken

    As you walk through the Wizard New VM and you arrive at Cap sheet, you have two choices...

    One is to select the Customize settings button and the other is just click the Finish button.  Each choice made appear to save to: dialog box and you can pick any location you want.  Note that you may need to click the down arrow located right of save it under: text box to expand this worksheet to display all the options.  BTW, clicking on this button is the standard behavior of OS X and has nothing to do with the VMware Fusion in itself.

    Post edited by: WoodyZ

  • New virtual machine migrated script DVS/PG

    I would extend this script with the possiblilty of typing any virtual machine can be used for migration.

    I get this error

    As the pipeline input channels are not supported

    $strvm = Read-Host "Please enter the name of vm | Get-NetworkAdapter | Together-NetworkAdapter - NetworkName (Get-VirtualSwitch-distributed - name MyDVSwitch |) Get - VirtualPortGroup - name 'virtual machines'). Name

    Try like this

    $strvm = Read-Host "enter the name of the virtual machine.

    Get-VM-name $strvm | Get-NetworkAdapter |  Together-NetworkAdapter - NetworkName (Get-VirtualSwitch-distributed - name MyDVSwitch |) Get - VirtualPortGroup - name 'virtual machines'). Name


  • New virtual machine cannot reach gateway all-in-olders Yes

    Hi, I'm using ESXi for a year with no problems, but now I'm having a very strange situation. New virtual machine cannot reach the front door, while the 'old'. New virtual machine can ping olders VM and vice versa, but new looks as private. I tried different OS and still have the same question.

    That's what I have:

    Reference DELL R610 with RAID - 1 and RAID-5

    ESXi free 348481 4.1.0

    1 card NETWORK connected

    IPs public 16

    4 VM (W 2008 32bits, W 2008R2 64, 32 2008 W, W 2008 64) works perfectly

    All VM are stored on the local Datastore2 (raid-5)

    Last week, I installed:

    1 Openfiler ESA (gateway problem)

    1 W 2008 R2 (gateway problem)

    1 W XP 32 (gateway problem)

    1 W 2008 32 (gateway problem)

    Older VM never lose connection with gateway and beyond

    New never manage to bridge

    I can't manually add gateway IP/mac address (error 5) in the new.

    Anyone can figure it out and how to solve? I'm really lost.

    Thank you

    New virtual machine can ping olders VM and vice versa...

    This excludes actually questions 'virtual '. The vSwitch has no restrictions.

    What kind of physical switch are you using? If this is a CISCO switch to ensure that the port is configured as a port of access (or trunk port) and spans tree portfast is. Some CISCO switches have a "macro"set desktop on their ports which limits the number of MAC addresses that are allowed on the port.

    André

    PS: Please don't ask me. Did you check the address of the gateway AND subnet mask are correct for the new virtual machines?

  • PowerCLI script - new virtual machine of the model

    Hi all

    I am very new to power CLI scripting, and these days, that I read a lot of help to automate the creation of a new virtual machine based on the model of the virtual machine.  Script that is not that hard, even location new virtual machine on a particular data and in a particular resource pool store is not difficult.  For this I came up with this very basic script/command:

    "New-VM - ResourcePool < resource_pool > - < folder_name > location - Datastore < datastore_name > - name < VM_name > - < template_name >"model

    However, I came across some problems that I can't find information in help or in the forums.  Problem with the above command is VM will be created in the pool of appropriate resources and file as long as they are unique, but if there are multiple instances of resource pool or a folder with the same name as the script spits out a mannequin.

    So for example if I want to create a new virtual machine to the location following Data_Centre = > RootFolder1 = > SubFolder1 = > SubFolder2 and SubFolder2 name is unique that no problem, the virtual machine is created at this location.  However, if the SubFolder2 exists in Data_Centre = > RootFolder2 = > SubFolder1 as well as the virtual machine is created in the folder root of the location of the model.  For example, if the model is in "DC = > Folder1 = > Subfolder1 = > Subfolder2 ' the virtual machine will be created in the folder Folder1

    Any suggestions on how to ensure that the virtual machine is created in the desired folder/location as well as a list of resources?  In my view, there are really smart guys here and I suspect that this issue would not be a problem at all.  Any help would be appreciated.

    See you soon

    It is not a matter of following the right path.

    You can use the location setting to get the exact folder you want. For example

    $dc = get-data center-name DC1

    $folder = get-file-name Folder1-location $dc

    $subfolder = get-file-name Folder2-location $Folder1

    or

    $dc = get-data center-name DC1

    $subfolder = get-file-name Folder2-location $dc

    You will need to find a "place" in the path to your destination folder where it will be unique.

  • Suggestion on Vcenter DB migration on the new virtual machine and enhancement vcenter server

    Hello

    I'm looking for any suggestion/plan with Vcenter DB migration steps towards the new virtual machine, and then upgrade the server vcenter

    4.1 for Update1/2

    My plan will be

    (1) creating new virtual machine.

    (2) fresh install 64-bit OS

    (3) migration Vcenter DB of the physical server to the new virtual machine.

    (4) upgrade to Vcenter Server 4.1 update 41 4.1 Update1/2

    Anything else missing then please let me know.

    Thank you

    vmguy

    Hi vmguy

    I agree with this approach

    (3) migration Vcenter DB of the physical server to the new virtual machine.

    As long as you leave the old DB in tact and simply detach and copy the DB to the new Victoria Cross.

    Before you run the upgrade on the new VC and DB.

    This way, you have a restoration plan in case something goes wrong with the upgrade.

    Just to add:

    You must migrate the ADAM database so to maintain the specified permissions vCenter

    See: Migrateing vCenter new host

    Please allow points if you find this useful/correct

  • OsCustomizationSpec and OSCustomizationNicMapping they are a good way to set up the new virtual machine for the model

    I build a script to generate auto magicly VM when I have import information from a csv file. I have the latest PowerCli, I am trying to build servers r2 Sever 2012 model.  I tried several OsCustomizationSpec (OCS) of in the hope of getting something to work, but I had no luck so far.  In VCenter, it shows that it applies the OCS, but is not apear to have an impact on the server.  I have disabled UAC since the last time that I tried it so maybe that will make a difference.  I am under ESXi 5.1 update 2, just to try to give all the necessary information.  Ideally, I'd like Sysprep, the value of intellectual property, change the computer name and join the server to the domain.  That's all! lol I have the book "VMware vSphere PowerCLI Reffernece, automating vSphere Administration, I walked through step by step.  The new version of PowerCli seems not have the x 86 limitation as earlier versions of PowerCli.  I tried so many different things, I'm not sure what to put in place as a starting point.

    # Save the object credentials with permission to join the domain.
    $DomainCredentials = get-Credential "domain\testername."
    # Clone our Spec by adding the domain information.
    $Spec = get-OSCustomizationSpec "Windows Server 2012 R2"
    $Spec += get-OSCustomizationNicMapping - Spec $Spec
    #$Spec | Select *.

    # Get our VM
    # Change network settings
    Get - VM BigServername | Get-NetworkAdapter | Together-NetworkAdapter - NetworkName nic - 172.16.25 - VLAN225 - connected: $true '
    -Confirm: $false | out-null
    # Close the comments to make change.
    Stop-VMGuest - VM $VM - confirm: $false | out-null
    # Wait while feedback stops
    While ($vm. ExtensionData.Runtime.PowerState - not "poweredOff")
    {
    Start-Sleep - seconds 1
    $vm. ExtensionData.UpdateViewData ('Runtime.PowerState')
    }
    # Apply Spec customization to apply the new network settings
    Get - VM "BigServername" |
    Set-VM - OSCustomizationSpec "R2 Windows Server 2012" - confirm: $false |
    Start-VM

    I can rebuild the model, or something else, we must do this work.

    OR - is simply not the best way to configure the VM?  If not, what Sysprep?

    Good news, but first, I would really like to know where the log files are on which server to the OsCustomization process.

    I decided to reverse engineer and create a CSOS within vCeneter and once I got to work, I kept creating new CSO via PowerCli until I could get that to work, create a new virtual machine.  Once I got this to work, I have tryied to apply on a cloned vm, with no parameters. I got it works too.  I tried to go back to my original image, but I couldn't get this to work.  Something's wrong with this picture.  He wrath that the problem was related to the permissions on the local client.

    New OSCustomizationSpec - OrgName company OSType - Windows - ChangeSid-Server "vcenter.dom.com" - name PowerCliOnly4 - persistent administrator-Type FullName - AdminPassword! password123 - zone "Eastern (USA and Canada)" AutoLogonCount - 3 - domain dom dadmin - DomainUsername - DomainPassword! password123 NamingScheme - vm-Description "PowerCli Use only" - confirm: $false

    Get-OSCustomizationNicMapping - OSCustomizationSpec PowerCliOnly4 | Game-OSCustomizationNicMapping - Position 1 - IpMode UseStaticIP - IpAddress 10.10.10.98 - 255.255.255.0 - DefaultGateway 10.10.10.1 Dns subnet - mask "10.10.10.10","10.10.10.11" "-confirm: $false

    This seems to be very picky.  Because the area is one of the parameters, you cannot put it in the DomainUsername, no dom\dadmin. The part that I really want to know how to get more, is what happens if your vm has a different local administrator as the administrator account.  It turns out that FullName - is not the account that it to connect locally with tires. When I created the vCenter Medtronic Chondroitin, I put 'me' in the name and information of the Organization and that's what was settled in the FullName property:

    Name: PowerCliOnlyM
    Type: persistent
    ServerId: /VIServer = dom\[email protected]: 443.
    Server: vcenter.dom.com
    LastUpdate: 24/09/2014 13:33:19
    DomainAdminUsername: dadmin NO dom/dadmin here!
    DomainUsername: dadmin
    Description: PowerCli use only, done manually in vCenter.
    AutoLogonCount: 3
    ChangeSid: true
    DeleteAccounts: false
    DnsServer:
    DnsSuffix:
    Domain: vsi
    Full name: me
    GuiRunOnce:
    NamingPrefix:
    NamingScheme: Vm
    OrgName: CompanyTU
    OSType: Windows
    ProductKey:
    Time zone: (USA and Canada)
    Working Group:
    LicenseMode: NotSpecified
    LicenseMaxConnections:
    EncryptionKey: {-126, 3, 48, 108...}
    ExtensionData: VMware.Vim.CustomizationSpecItem
    ID: PowerCliOnlyM
    UID: /VIServer = vsi\[email protected]: 443/OSCustomizationSpec = PowerCliOnlyM /.
    Client: VMware.VimAutomation.ViCore.Impl.V1.VimClient
    AdminPassword: w
    DomainAdminPassword: N
    DomainPassword: N

    DNS: {10.10.10.10, 10.10.10.11}
    Wins                  :
    SpecId: PowerCliOnlyM
    Spec: PowerCliOnlyM
    SpecType: persistent
    NetworkAdapterMac:
    Position: 1
    IPMode: UseStaticIP
    IP address: 10.10.10.98
    Subnet mask: 255.255.255.0
    DefaultGateway: 10.10.10.1
    AlternateGateway:
    VCApplicationArgument:
    ID: /VIServer = dom\[email protected]: 443/OSCustomizationNicMapping = OSCustomizationNicMappingImpl-PowerCliOnlyM-persistent-1.
    UID: /VIServer = dom\[email protected]: 443/OSCustomizationNicMapping = OSCustomizationNicMappingImpl-PowerCliOnlyM-persistent-1.
    ExtensionData: VMware.Vim.CustomizationAdapterMapping
    Client: VMware.VimAutomation.ViCore.Impl.V1.VimClient
    Version: 1

    I think that it is good to know that the virtual machine reboot 4 or 5 times as it goes through this process.  It breaks is you try and do something for the virtual machine that interrupt the process.  I don't know that I'll think more questions in a second.

    In addition, it cost he had some problems with the put between quotation marks, single or double around the password, but I did not check this again, I just know that once I took them, he began to work.  I ran on other issues while testing as I was using a single IP address, so if I do not disable the test VM, the following would not work because of the conflct network, maybe I shouldn't admit that... lol

  • URGENT! After installing 6 Fusion and creation of new virtual machine with Windows 7, I get a message "VMware Fusion cannot enter the unit". WHAT SHOULD DO?

    After purchase, installation and activation Fusion 6 with the license key, I had a library of VMS showing 2 Boot Camp partitions. It's strange that I only have 1.
    I tried to activate them but received a message that it is out of date in 2 cases. (see annex 1)

    I started a new virtual machine with a Windows 7 installation disc directly on my HD. I have provided a way to do this and followed the instructions of Fusion to the screen.

    Apparently, everything went well and after several restarts, the installation appears to be over (see annex 2) I tried to open and run the installed Windows 7. I had however a window with the following message:

    "Pending the unit.

    "VMware Fusion cannot enter the unit. Please wait until the unit starts automatically, or interact with the virtual machine below. ' (see annex 3)

    Here Windows 7 seems to start but after a while with the home screen and of the Øresund finishing this window closed and open a new window called library Virtual Machine on the left showing the partitions of Bootcamp and the Virtual Machine Windows 7 x 64 and in the middle gray a representation of what is supposed to be the Windows 7 desktop. (see Exhibit 4). When I opened the settings button a window with different setting options pops up. This mark means to me that Windows is installed but the final opening isn't the case

    When you quit Vmware Fusion indeed Windows seems to be close (see part 5)

    What is going on? What has gone wrong? What should I do? I don't know how to solve the problem.

    I should f.i. remove the virtual machine from Windows 7 and is free automatically made partition on my HD as the reboot with the Windows installation disc? or y at - it another way to enter the UNIT?

    Help, please!

    Thanks in advance

    Your virtual machine is running. It is in the unit - which each windows gets its own window of Mac - and you have no application Windows running, there is no visible windows. You can start a Windows application in the start of Fusion menu in the menu bar at the top right, or turn on the Windows task bar on the view menu and start applications from there. Or use the view menu to switch to the Single mode or full-screen, which puts all of your Windows desktop in a window separate from Mac.

    You do not have two partitions to Boot Camp on your Mac, you have two virtual machines named "Boot Camp partition".

    The message about it being unable to enter the unit arrives while the merger is pending for the tools begin to run, because the tool is necessary for the unit.

  • VMware Fusion 6 Professional - where is the possibility of locking VMware using a single virtual machine and do not allow the creation of new virtual machines?

    This is a quote from the VMware Fusion Professional 6 product page:

    VMware Fusion 6 Professional comes with IT administration tools to help you deploy VMware Fusion using Apple or a management solution third Mac as of JAMF's Casper Suite. Further reduce the cost of support of Windows desktop using the mode of single virtual machine that limits user access to the library of the Virtual Machine, the ability to create virtual machines or migrate PCs and reduces the options of the menu.

    Where can I find these IT administration tools?  I want to block my VMware users to a single virtual machine so that they can not blow by creating new virtual machines, etc.

    How can I do this?

    Thank you!

    Glitch004,

    You could follow the steps to activate the single mode of VM:

    1. turn power off all running VMS and out the merger.

    2. Add the following line to/Library/Preferences/VMware Fusion / config

    installerDefaults.simplifiedUI = 'TRUE '.

    3 restart merger and you will find:

    . VM library is hide in the VM menu.

    . only one virtual machine can be used, while click second VM Fusion of the reports ' Unable to open document. "

    Best regards

    Shanghai

  • need to migrate data to a new virtual machine

    Currently I have a W2K3 off warranty, physical file server. I created a file in Vmware VM W2K8 server which will replace previously mentioned W2k3 server. My data for hosts vSphere 4 and all the physical servers are stored on a CF CX 410 San. My questions are: how to get the data to my new virtual machine? Do I need to migrate? Redirect? Present it? Is there a tool in VMware? Perform this at the level of the logic unit number? I can restore from tape to complete backup using the backup software?

    To say the least, I am a little confused and would appreciate any ideas, I'm sure there is more than one way. Thank you.

    You have a few options.

    Use RDM using the link to the Tunis above.

    Create a new virtual disk in virtual machines and use robocopy to copy the data from the physical server to the virtual machines.

    If the has an option of CIFS SAN then use it directly to files on the server.

  • VMotion and new Virtual Machine problems

    Hello

    Got a VI2 farm with 3 ESX servers.

    1 of the ESX servers play big time... when I try to VMotion VM him another 2 or create a new virtual machine, it gives the same error message ' reason: could not start the operation of long duration for the server VM.» Reason: Failed to get the directory config (basename = servername"

    Can I migrate from the problem for the other 2 ESX Server but not for her. Cold cant migrate either.

    I checked the logs, rebooted and rebooted vCenter Agent. Still no luck.

    Any help appriciated!

    This thread help me?

    Check this one, too.

    Basically, it seems that the system has trouble finding / access to one or more of the files associated with the virtual machine. Given that you can migrate to and not the host, I suspect it's the permissions problem reported in the first thread.

    Ken Cline

    VMware vExpert 2009

    VMware communities user moderator

    Blogs about: http://KensVirtualReality.wordpress.com/

  • Create new virtual machine of the model that have two hard drives in the different data store

    We do VM deploy automation with PowerCLI.

    There is already a model created with at least two hard drives to one side and each hard drive belong to difference datastore,

    In the model's operating system is Windows server 2008 R2 already installed VMware Tools and other software in the second (other than C: driver) driver

    We can successfully deploy a new virtual machine with this manually with vSphere client model.

    But when we try to make the deployment with PowerCLI, can not find examples of similar scripts in the document of reference,

    and we also google this question, still no similar question was found.

    Is this possible with PowerCLI? If it's possible could you give me some advice or an example of script, thank you!

    Best regards.

    I already found the solution.

    With the vSphere SDK .NET API, we can create the new virtual machine to the model

    Mainly used API listed below, sorry because I can not give the source code here.

    • VMware.Vim.VirtualMachineCloneSpec
    • VMware.Vim.VirtualMachineRelocateSpec
    • VMware.Vim.ManagedObjectReference
    • VMware.Vim.VirtualMachineRelocateSpecDiskLocator
    • VMware.Vim.ManagedObjectReference
    • CloneVM_Task

    For reference, you can take a look at this post and this post

    LucD , thanks for your help!

  • USB HDD as a data store and storage of VMS and new virtual machines

    I have a server Esxi 4.1 with 1 TB RAID 5 storage and 3 virtual machines. The storage is full and no space for another HARD disk, so my question is: would it be possible to use a USB HDD as a data store and could be included as a storage for new virtual machines or the VM? If so, could someone let me know how to do it because I'm not able to detect the HARD disk on the host itself.

    No, it is not possible to use a USB drive as a data store.

    Linjo

  • Determine number of CPU and RAM to allocate to a new virtual machine

    I intend to convert a physical server that has two Quad Core processors and 16 GB of RAM to a virtual computer.  I have no monitor, performance, but from what I can tell, the specifications of the server are exaggerated and the main application currently running on the physical server can run on much less.  I'm confused about how much memory and processors allocated to the new virtual machine.  Surely I don't need to assign eight CPUS and 16 GB of RAM.

    The server running ESX has 32 GB of RAM and two Quad Cores, as well.  There are twelve other virtual machines running on ESX Server and average CPU usage is about 15 to 20% and the memory usage is about 20 to 25%.  I was thinking about a minimum of 1 GB of RAM and 8 GB max on the new virtual machine from, but I'm lost on how many processors to allocate.  I appreciate any guidance.

    This is a good book worth looking at

    http://www.VMware.com/PDF/vi_performance_tuning.PDF

  • New virtual machine on a VLAN different from existing virtual machines

    Hello

    I am trying to replace one of our physical servers with a virtual machine which must be on its own VIRTUAL local network.  This virtual machine will get channelled through our network to a router belonged to the client who resides with us.  I created a new group of VM ports for the new virtual machine on the standard vSwitch as the rest of our virtual machines are on with id VLAN by default of 0.  I was unable to create an id VLAN for the port group.  I have the virtual machine is set to the tag on all ports of the physical switch that the host is connected to the VLAN.  With this configuration I still can't even ping to the IP address of the physical switch for this vlan.  I feel that I'm missing something simple, but I'm pretty new to networks on vSphere.  If any information let me know.

    Hello

    Have you tried directly to type the VLAN ID in the drop-down list box. This is how to specify the VLAN ID for the virtual machines in a group of ports in the case of Virtual Switch Tagging (VST). By design, you can select a predefined VLAN ID or directly start typing the code.

    Best regards

    Iliana

Maybe you are looking for