Virtual machine is interrupted after 30 minutes of power on.

Virtual machine is interrupted after 30 minutes of power on. In case you connect power only records.

Do you own information, how to solve this problem.

vCenter Server 4.1.

Do you own information, how to solve this problem.

Check the Power ON option and see if it is set to sleep mode when idle (I think its default value in windows 7)

Similar post (http://communities.vmware.com/thread/332547)

Tags: VMware

Similar Questions

  • Shared virtual machines Via interruption/resumption AutoStart

    Hello!

    I was happy when I heard tell that the new VMware Workstation v8.0 incorporates most of the features from the old server VMware 2.0, for example shared VMs who will be started automatically as a system service and run in the background.

    I'm trying to migrate to VMware Server for VMware Workstation, but I didn't understand, how to autostart/autostop my VMs shared using suspension / darn.

    When the host (Windows Server 2008 R2) stops, all shared virtual machines should be suspended on the disk, and when the host starts again, they must resume, while the guest operating systems think that these machines were running all the time.

    This worked fine on VMware Server until now, but I failed to do it in VMware Workstation.

    How to use the interruption/resumption for autostart?

    It is very, very, very bad that VMS are a regular stop when the host is closed.

    There is no UI for this, but you can change the default values in vmAutoStart.xml (which is in/etc/vmware/hostd or C:\ProgramData\VMware\hostd)

  • Names of Virtual Machine files changed after SVMotion

    To date I've seen point interesting when I was trying to SVMotion. Here it goes

    I have a virtual machine called base01 (as it is show VC), but the real name of this virtual machine is ROMBASE02 (the console I see all files including VMX, vmdk etc...). I found this, because I tried to do with unsuccessful SVMotion. later, I tried to make SVMotion with ROMBASE02.vmx and success. After completing of SVMotion I found that all the files of the virtual machine has changed for base01.

    How it is possible an idea?

    as Jean-Marie said, if you have a vCenter VM that does not match the data store named naming convention, if you move (cold migrate or sVMotion) the virtual machine in another data store, it will change the datstore file to match the name of the object in vCenter.

  • Virtual MACHINE starts automatically after a power outage of the entire site?

    Hello

    We use ESXi 5.5.

    If there is a power for the datacenter failure, ESXi hosts must be restarted when power is resumed.

    We wonder if VMs will be launched automatically to the top?   If not, this means that we must allow the "starting the Virtual Machine / stop option.

    If we put a number of virtual machines in "automatically start", such as VM1, VM2, VM3 on ESXi Server one, VM4 VM5 ESXi Server b.   Virtual machines are migrated between ESXi servers and how they can keep the boot sequence?

    Your opinion is requested.

    Dear Tony,

    I ask you to create a vApp and configure accordingly on your vCenter boot order.

    https://pubs.VMware.com/vSphere-55/index.jsp#com.VMware.vSphere.vm_admin.doc/GUID-0FAB05D4-22F7-4665-B42A-0FA4B360B398.html

    See you soon,.

    Billon Manogaran

  • All of my virtual machines are "busy" after upgrading Linux

    I upgraded from Slackware64 13.37 abreast (close enough to the new version 14.0 - kernel 3.2.29) and installed vmplayer 5.0.0 build-812388.

    Vmplayer installation was possible with the "-ignore-errors option, like the previous version."

    When I try to play any of my images .vmx, I always get an error "the virtual machine is busy.".

    In the windows client, vmplayer creates a directory of "lck" with a lock file '.lck"in there.

    Remove this file does not resolve the issue.  If I don't remove this file and try to run the virtual machine again, vmplayer leaves.

    When running from the command line, I get this:

    vmplayer $ Windows_7.vmx
    Login to /tmp/vmware-lupe/vmware-modconfig-24735.log
    file name: /lib/modules/3.2.29/misc/vmmon.ko
    support: external
    License: GPL v2
    Description: monitor Machine virtual VMware.
    Author: VMware, Inc..
    depends on:
    vermagic: 3.2.29. mod_unload SMP
    Abandoned

    The above mentioned log file:

    2012 09-26 T 16: 53:01.299Z | vthread-3 | I120: Log for VMware Workstation pid = 24735 version = version 9.0.0 Build = build-812388 option = output
    2012 09-26 T 16: 53:01.299Z | vthread-3 | I120: The process is 64-bit.
    2012 09-26 T 16: 53:01.299Z | vthread-3 | I120: Host codepage = ISO-8859-1 encoding = ISO-8859-1
    2012 09-26 T 16: 53:01.299Z | vthread-3 | I120: Host is Slackware Linux 3.2.29. 14.0
    2012 09-26 T 16: 53:01.298Z | vthread-3 | I120: Msg_Reset:
    2012 09-26 T 16: 53:01.298Z | vthread-3 | I120: [msg.dictionary.load.openFailed] cannot open the file ' / usr/lib/vmware/settings ': no such file or directory.
    2012 09-26 T 16: 53:01.298Z | vthread-3 | I120: ----------------------------------------
    2012 09-26 T 16: 53:01.298Z | vthread-3 | I120: Preferences file of the option PREFS not found in/usr/lib/vmware/settings. Using the default values.
    2012 09-26 T 16: 53:01.298Z | vthread-3 | I120: Msg_Reset:
    2012 09-26 T 16: 53:01.298Z | vthread-3 | I120: [msg.dictionary.load.openFailed] cannot open the file ' / home/lupe/.vmware/config ': no such file or directory.
    2012 09-26 T 16: 53:01.298Z | vthread-3 | I120: ----------------------------------------
    2012 09-26 T 16: 53:01.298Z | vthread-3 | I120: Optional preferences PREFS not found in home/lupe/.vmware/config file. Using the default values.
    2012 09-26 T 16: 53:01.299Z | vthread-3 | W110: Connecting to /tmp/vmware-lupe/vmware-modconfig-24735.log
    2012 09-26 T 16: 53:01.307Z | vthread-3 | I120: Reading in info for the vmmon module.
    2012 09-26 T 16: 53:01.307Z | vthread-3 | I120: Reading in info for module vmnet.
    2012 09-26 T 16: 53:01.307Z | vthread-3 | I120: Reading in info for the vmblock module.
    2012 09-26 T 16: 53:01.307Z | vthread-3 | I120: Reading in info for vmci module.
    2012 09-26 T 16: 53:01.307Z | vthread-3 | I120: Reading in info for the vsock module.
    2012 09-26 T 16: 53:01.307Z | vthread-3 | I120: Definition of vsock to depend on vmci.
    2012 09-26 T 16: 53:01.307Z | vthread-3 | I120: Created new pathsHash.
    2012 09-26 T 16: 53:01.307Z | vthread-3 | I120: Modinfo calling over 'vmmon.
    2012 09-26 T 16: 53:01.309Z | vthread-3 | I120: ' / sbin/modinfo ' came out with a status of 0.
    2012 09-26 T 16: 53:01.309Z | vthread-3 | I120: Modinfo invoking on "vmnet".
    2012 09-26 T 16: 53:01.311Z | vthread-3 | I120: ' / sbin/modinfo ' came out with a status of 0.
    2012 09-26 T 16: 53:01.311Z | vthread-3 | I120: Modinfo invoking on 'vmblock '.
    2012 09-26 T 16: 53:01.312Z | vthread-3 | I120: ' / sbin/modinfo ' came out with a status of 0.
    2012 09-26 T 16: 53:01.312Z | vthread-3 | I120: Modinfo calling over 'vmci.
    2012 09-26 T 16: 53:01.314Z | vthread-3 | I120: ' / sbin/modinfo ' came out with a status of 0.
    2012 09-26 T 16: 53:01.314Z | vthread-3 | I120: Modinfo calling over 'vsock.
    2012 09-26 T 16: 53:01.315Z | vthread-3 | I120: ' / sbin/modinfo ' came out with a status of 0.

    He complains about parameters and a missing config file but load the default values.

    I see nothing more that show some kind of error.

    How can I solve this?

    You must load modules into the kernel:

    vmware-modconfig --console --install-all
    
    Older versions do it automaticly but for some reason i don't know you have to do it manually.
    
  • How to make the virtual machine starts automatically after power is declining for all ESX host?

    We meet just power down and lost electricity ESX host.

    When we start the ESX host, we can on each individual virtual machine.

    Y at - it a setting that we can put in place for these VMs critics may start se?

    Your opinion is requested.

    Thanks for your advice. He agrees with your saying that the start / stop sems to be buggy.

    It's only disable it every time that you enable VMware HA.

    But it works (if enabled) and may be useful to define how the system starts up.

    André

  • Virtual machine does not start after backup

    Virtual machine automatically shutdown after backup and do not start with OS.

    We tried to fix it through Windows 2008 disk, error giving startrep.

    It seems volume has been disabled and not assigned to the system drive.

    When you run bcdedit in repair window, make sure "Boot Device" is not displayed as 'unknown '. It should be 'default'.

    If start the machine with the unknown, try commands below after you start the Windows installation disc.

    DiskPart
    the list volume
    Select volume #.
    att flight clear readonly
    att hidden clear flight
    att flight clear nodefaultdriveletter
    assign letter = c:
    output

    CD X:\Sources\Recovery

    Command Startrep type

    When you're finished, start the virtual computer and check if she wo

  • CV of power virtual machine after a failure to esxi 4.1

    I have a server ESXi 4.1 which is loss of power in the middle of the night. When the server takes over, the virtual machines on the server do not resume. Is it possible to have virtual machines to resume after a power failure? I think remember me this as an option on an earlier version.

    Hello

    1 - Select host

    2 - go to the Configuration tab

    3. Virtual Machine start / stop option

    check the fixing

  • What is the interval of time between the virtual machine Linux and ESXi host synchronization?

    I have ESX5.0 with a centos6 installed on this linux virtual machine.

    After the installation of vmware for Linux virtual machine tools, I activated the time synchronization between the virtual machine linux and ESXi host through vmware-toolbox-cmd.

    I wonder what is the interval of time between the virtual machine linux and ESXi host synchronization? If I quickly time OS system, when the OS system time will sync back to the ESXi host?

    According to http://www.vmware.com/files/pdf/techpaper/Timekeeping-In-VirtualMachines.pdf:

    By default, the demon checks the guest only once per minute operating system clock.

    However, depending on whether the guest is behind or in front of the result is different. So, please read the section "periodic synchronization" (at least) in the document mentioned above.

    André

  • migrate virtual machines to esxi 3.5 free vsphere 4.1 without vcenter

    Hi all

    I have vms on 2 hosts esxi 3.5 with direct (without san)-attached storage that I want to migrate to a new server esxi under license of 4.1 vsphere essentials. I intend using the stand-alone converter to migrate virtual machines from 3.5 to 4.1 and then upgrade the other two hosts to 4.1 and then moving some virtual machines using the converter.

    I have Web servers that I don't want to bring down more than 10 to 20 minutes (not the 1 to 2 hours that should be a cold conversion with converter) so I try to use the feature p2v on the virtual machine running Web servers.

    Has anyone done this with no san and no vcenter? If so how did you do?

    is it possible to migrate without losing configurations of network adapter in the virtual machine?

    I can just do something like taking a snapshot of the system of runnying, then copy files to new host, then add to the inventory, upgrade tools, hardware upgrade?

    Thank you!

    is it possible to migrate without losing configurations of network adapter in the virtual machine?

    After you copy the files and re - add to inventory new virtual machine, you must take care on the issue of handgun that you see in the market.

    Choose I_moved the files to keep the VM UUID and the same virtual MAC address.

    André

  • Virtual machines removed by Vsphere Client always in stock VSphereWebClient

    Hello together,

    When I tried on a new system (host 2, 1 iSCII-SAN, Vmware Essentials 5.5) somethings with new virtual machines

    and after I created one, it worked but we have seen, wrong operating system.

    We therefore decided to stop this machine and delete the San.

    This work we don with VSphere Client and evrything seems OK.

    This morning we started the first time that our VSpherWebClient and we still see this machine in the inventory list.

    We couldn t do something remove our something else, because in WebClient, there is no editable function

    and in the VSpehre customer isn´t of the current machine.

    Someone has an idea?

    concerning

    Hi Tim,.

    Thanks for all communications, it was useful for me.

    Now, I did the solution my way:

    I use the unit of Service VCenter and (after duplicate the original files in a folder on the data store)

    I started the default configuration wizard.

    After the process, I realized all the network settings are correct

    and all the things that now works correct.

    But it was only for my situation with a Datacenter without existing VMs and a lot of information in the

    inventory.

    I m is not sure this solution: a virtual machine on the data store a safe way for VCENTER Server.

    Maybe for Cluster HA or DSR it wise, but I think it's very important to have backups from the

    settings and inventory.

    Anyway, our system is running, and now that we can begin to move our VM´s.

    best regards and thank you

    Rolf

  • 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

  • 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.

  • VMware HA and recovery of virtual machines (not to restart them)?

    Hello

    I need help clarify something with VMware HA.

    When I do manually our primary ESXI host, the VMs appear and restart on the secondary host.

    Yes virtual machines are restarted automatically, but it does not resume the virtual machine without interruption as DRS and provides that vMotion.

    Is there a way I can configure HA to not restart and resume the virtual machine in place without interruption?  If not, what are my other options I can configure in VMware ESXi do exactly, if any?

    Thank you very much

    Jan

    HA is used in the event of a host failure, so there is no chance to migrate a workload (curriculum vitae) to another host. What you are asking for can be achieved with FT (Fault Tolerance) where a secondary VM is created on a different host and basically synchronized with the primary virtual machine. In case of failure of the primary virtual machine VM school can resume (almost) without interruption.

    André

  • Create several virtual machines on Vsphere multiple using the spreadsheet V2

    After much tinkering with the orginal VM deployment script, I brought a lot of improvements over the old.  I'm still learning my way powercli... It is not a pretty looking code, but it does the job...  I hope it helps

    The script is designed for a windows model that has two hard disks and two card WLAN.  Virtual machines are configured after their deployment to suit the needs of the customer.  You should be able to modify the script to fit your needs.

    The script file and sample xls is attached.

    Features:

    1 deploy VMs of template file and comstomization using worksheet

    2 customization of VM after the deployment of the VM

    3 multi-thread

    4 deploy VM on vSphere servers.

    5 creates the log file

    6 create notes, the date and the user who made the VM VM

    Columns of the worksheet: (the script is designed to go from line 6.  You can change it in the script)

    The virtual computer name. Host name | CPU | RAM (GB) | DISK2 (GB) | DISK3 (EN) | Nic1 connection | Name of the model. Data store | Notes

    #VM Deployment script by David Chung 8/12/2011
    #This script is multithreaded VM deployment script using spreadsheet across multiple vsphere servers.
    #
    #It will log the result in C:\scripts\log\ folder
    #Copy autobuildv2.xls to C:\scripts folder.
    
    # --- Note that our windows standard template has two hard drives and two network (lan and backup) ---
    # --- Depending on customer requirement, CPU, RAM, Disk size, and Network VLAN connection changes. ---
    
    # Spreadsheet file should be:
    # VM name | Host name | CPU | RAM (GB) | DISK 2 (GB) | DISK 3 (GB) | NIC1 Connection | Template name | DataStore | Notes
    
    #Use following command to launch the script
    #./autobuild [spreadsheetname]
    
    
    param( [string] $file)
    
    #Update User ID and Password
    $user = 'username'
    $password = 'password'
    
    if ($file -eq ""){
        Write-Host
        Write-Host "Please specify spreadsheet file name eg...."
        Write-Host "./autobuildv2.ps1 spreadsheetname.xls" -ForegroundColor yellow
        Write-Host ""
        Write-Host ""
        exit
    }
    # Replace with your virtual center name
    $v1 = 'labvirutalcenter'
    $v2 = 'testvirtualcenter'
    $v3 = 'productionvirtualcenter'
    $v4 = 'drvirtualcenter'
    
    $dt = Get-Date -Format d
    
    #Connect to VI server using saved credentials
    
    #$credlb = Get-VICredentialStoreItem -Host $v1 -File C:\labcredential.xml
    #Connect-VIServer $credlb.Host -User $credlb.User -Password $credlb.Password
    
    #$credpd = Get-VICredentialStoreItem -Host $v3 -File C:\pdcredential.xml
    #Connect-VIServer $credpd.Host -User $credpd.User -Password $credpd.Password
    
    #$credts = Get-VICredentialStoreItem -Host $v2 -File C:\tscredential.xml
    #Connect-VIServer $credts.Host -User $credts.User -Password $credts.Password
    
    #$creddn = Get-VICredentialStoreItem -Host $v4 -File C:\dncredential.xml
    #Connect-VIServer $creddn.Host -User $creddn.User -Password $creddn.Password
    
    #open excel and read values
    $xls = new-object -com Excel.Application
    $path = "C:\scripts\" + $file
    $xls.Workbooks.Open($path) | Out-Null
    
    # Removes any existing jobs
    Remove-Job *
    
    # Starts from Row 6 on the spreadsheet
    $Row = 6
    
    # Loop starts
    for ($name -ne $null)
    {
        $name = $xls.Cells.Item($Row,1).Value()
        $vhost = $xls.Cells.Item($Row,2).Value()
        $cpu = $xls.Cells.Item($Row,3).Value()
        $memgb = $xls.Cells.Item($Row,4).Value()
        $dgb = $xls.Cells.Item($Row,5).Value()
        $dgb2 = $xls.Cells.Item($Row,6).Value()
        $net = $xls.Cells.Item($Row,7).Value()
        $temp = $xls.Cells.Item($Row,8).Value()
        $nfs = $xls.Cells.Item($Row,9).Value()
        $desc = $xls.Cells.Item($Row,10).Value()
        $vmdisk = $dgb * 1048576
        $vmdisk2 = $dgb2 * 1048576
        $memmb = $memgb * 1024
        $cp = $Row - 6
    
    # End of the loop when there is no data in the row.
        if ($name -eq $null) 
        { 
            Write-Host ""
            Write-Host ""
            Write-Host "(" $cp ") VM Build in progress.  Please check virtual center for detail." -ForegroundColor Magenta
            Write-Host "The script will end when ALL VMs are completed." -ForegroundColor Magenta
            
            # Waits until all jobs are finished
            while ((Get-Job | where {$_.State -eq "Running"}).getType -ne $null)     
            {     
            Sleep -Seconds 10     
            } 
            
            # Stops Excel process
            Stop-Process -Name "Excel"
            Write-Host ""
            
            # Writes Jobs in to log file
            $Date = Get-Date
            $logfile = "C:\scripts\log\autobuild" + "_" + $Date.Day + "-" + $Date.Month + "-" + $Date.Year + ".txt"
            if (-not (test-path c:\scripts\log\))
                {
                MD c:\scripts\log | Out-Null
                }           
            Receive-Job * | Out-File -Encoding ASCII -FilePath $logfile -Append
            Remove-Job *
            
            Write-Host "Automated VM build is completed." -ForegroundColor Yellow
            Write-Host ""
            Invoke-Item $logfile
            exit
        }
        
                
        # Select the correct customization script
        if ($temp -eq "Win2K3-32")
        {
        # Customization script name
            $cust = "Win2003_32bit"
        }
        elseif ($temp -eq "Win2K3-64")
        {
        # Customization script name
            $cust = "Win2003_64bit"
        }
        
        elseif ($temp -eq "Win2K8R2")
        {
        # Customization script name
            $cust = "Win2008"
        }
                
        #if no customization script is selected, break out of the script
        else
        {
            write "Your Guest Customizations are wrong"
            break
        }
        
    #Select Vsphere server name based on ESX host name provided
        if ($vhost -like "ESXLAB*")
        {
            $v = $v1
        }
        
        elseif ($vhost -like "ESXTST*")
        {
            $v = $v2
        }
        
        elseif ($vhost -like "ESXPRD*")
        {
            $v = $v3
        }
        
        elseif ($vhost -like "ESXDR*")
        {
            $v = $v4
        }
        
        #if incorrect host names are selected
        else
        {
            write "Please input correct host name"
            break
        }
        
        # Launch Multi-threaded job (VM build and configure)
        $job = 
        {
        $in = $input.'<>4__this'.read(); 
        
        Add-PSSnapin 'vmware.vimautomation.core'
        
        $vmdisk = $in[5] * 1048576
        $vmdisk2 = $in[6] * 1048576
        $memmb = $in[4]* 1024
        
        #VM note (description, deployed by: username, and build date)
        $onwer = Get-Acl
        $deployed = $onwer.owner
        $note = $in[10] + '  |  Deployed by:' + $deployed + '  |  Created:' + $in[13]
        
        #Connect to VI server
        Connect-VIServer $in[11] -User $in[14] -Password $in[15]
        
        #Build VM and configure
        New-VM -Server $in[11] -vmhost $in[2] -Name $in[1] -Template $in[8] -Datastore $in[9] -DiskStorageFormat thin -OSCustomizationSpec $in[12] -Location "Discovered virtual machine" -Description $note
        Set-VM -Server $in[11] -vm $in[1] -Numcpu $in[3] -MemoryMB $memmb -RunAsync -Confirm:$false
        $disk = Get-VM $in[1] | Get-HardDisk | ? {$_.Name -eq "Hard disk 2"}
        Set-HardDisk -harddisk $disk -CapacityKB $vmdisk -Confirm:$false
        if ($in[6] -gt 0)
            {
            New-HardDisk -Server $in[11] -VM $in[1] -CapacityKB $vmdisk2 -Confirm:$false
            }
        $vmnet = Get-VM $in[1] | Get-NetworkAdapter | where { $_.Name -eq "Network Adapter 1" } 
        $vmnet | Set-NetworkAdapter -NetworkName $in[7] -StartConnected:$true -Confirm:$false
        }
        
        # pass variables in to jobs
        $jobspec=@()
        $jobSpec += $job
        $jobspec += $name
        $jobspec += $vhost 
        $jobspec += $cpu 
        $jobspec += $memgb
        $jobspec += $dgb 
        $jobspec += $dgb2
        $jobspec += $net 
        $jobspec += $temp
        $jobspec += $nfs
        $jobspec += $desc
        $jobspec += $v
        $jobspec += $cust
        $jobspec += $dt
        $jobspec += $user
        $jobspec += $password
        
        #start the job    
        Start-Job -InputObject $jobspec -ScriptBlock $jobspec[0]
        
        Write-Host ""
        Write-Host $name " VM is being deployed on " $v -BackgroundColor Green -ForegroundColor Black
        Write-host ""
        
        
        $Row++
    }
    
    
            
    
    

    Good script, a lot of interesting features in there.

    Thanks for sharing.

Maybe you are looking for

  • Why addresses which are in my address book appear in red when I create a new e-mail?

    This does not happen with them, and it doesn't happen everytime I get an address. Sometimes, the address is black, sometimes in red. If I delete the pre-filled address and try again, it continues to be.

  • Satellite A300 - atikmdag stopped working

    I had this problem for a long time, what happens at random, I updated the bios, tried many settings, reinstalled the operating system, factory reset hard drive recovery and sworn a lot I use vista 32 and get continually the display driver has stopped

  • drive hard crash "fatal error" less than 9 months old

    Two laptops in the 4 months of each other. both were quite new, abuse do not used for general navigation and the game... First an AlienWare laptop "Gaming". Second Inspirion HP with touchscreen I was wondering if these laptops have been converted vec

  • Run DLL Exception - could USB error

    When I try to disconnect a USB device, I get an Exception of DLL RUN-time error: while trying to run '32.dll Shell. control_run DLL hotplug-dll. OS is XP SP3 * Advice to "Uninstall" John provided the "fix" to this problem.  Thank you all!

  • high memory usage

    How to getri of high memory usage