stop-vmguest, then take instant

Hi admins,

I want to vms stop included in a text file.

When virtual machines are poweredoff I would like to take a snapshot of each virtual machine.

When the snapshot is in place, I would like to start the virtual machine.

I tried for a while no and I can't make it work (very new to Powershell)

$vms = get-content c:\temp\vms.txt

foreach ($vm to $vms)

{

Get - vm $vm | stop-vmguest-confirm: $false

Get - vm $vm | new-snapshot - name (get-date)

Get - vm $vm | Start-vm

}

I wish it would be that simple, but it is not

How would you do that? (in the easiest way so I can understand)

Concerning

Tyler

You could try it like that

Get-VM -Name (Get-Content c:\vmnames.txt) | %{    Shutdown-VMguest -VM $_ -confirm:$false    sleep 30    New-Snapshot -VM $_ -name (get-date)    Start-VM -VM $_}

Note how the script uses the sleep 30 (seconds) after the guest shutdown cmdlet.The reason is that the Shutdown-VMguest cmdlet will return immediatly.And since you want to take the snapshot of a guest that is shutdown, the script waits for 30 seconds.You could also replace this with for example a 'ping' command and only start the snapshot when the guest doesn't answer anymore 

The script assumes that you have the VMware tools installed to be able to do the guest shutdown.

Tags: VMware

Similar Questions

  • my internet explores all of a sudden stops working then restarts, how can I fix

    I recntly been havig IE suddenly stops working then restarts itself.  My virus scans are clean and I have not downloaded anything new.  Any ideas?  I got 1blue screen with a view of crash dump.

    Hello

    Internet Explorer freezes or crashes
    http://support.Microsoft.com/GP/ie_freezes_or_crashes

    Tips for solving problems with Internet Explorer
    http://Windows.Microsoft.com/en-us/Windows7/tips-for-solving-problems-with-Internet-Explorer

    When you start Internet Explorer, it opens, flashes and then closes immediately
    http://support.Microsoft.com/kb/967896

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

    Several troubleshooting methods:

    What antivirus/antispyware/security products do you have on the machine? Be one you have
    EVER had on this machine, including those you have uninstalled (they leave leftovers behind which)
    may cause strange problems).

    If no joy there's something blocking perhaps.

    Start - All Programs - Accessories - System Tools - IE with no Addons - what works best?

    IE - Tools - Internet Options - Advanced - tab click on restore, and then click Reset - apply / OK

    IE - Tools - Internet Options - Security tab - click on reset all default areas - apply / OK

    Close and restart IE or IE with no addons

    not better?

    IE - tools - manage Addons (for sure disable SSV2 if she's here, it is no longer necessary but Java
    installs and it causes more questions - have you never update Java to go back in and turn it off again.) Search
    other possible problems.

    Windows Defender - tools - software explore - look for problems with programs that do not look
    right. Allowed are usually OK and "unauthorized" are not always bad. If doubt about a program
    ask about it here.

    Could not be a free - SpyBHOremover - BHO - standalone program, needs no installation, download.
    unzip and run - all are not bad, but some can cause your question (toolbars are BHO).
    http://securityxploded.com/bhoremover.php

    How to change, add or remove startup programs in Windows 7
    http://www.SevenForums.com/tutorials/1401-startup-programs-change.html

    How to check and change Vista startup programs
    http://www.Vistax64.com/tutorials/79612-startup-programs-enable-disable.html

    Also get Malwarebytes - free - use as scanner only.

    http://www.Malwarebytes.org/

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

    For Vista:

    Try these to erase corruption and missing/damaged file system repair or replacement.

    Run DiskCleanup - start - all programs - Accessories - System Tools - Disk Cleanup

    Start - type in the search box - find command top - RIGHT CLICK – RUN AS ADMIN

    sfc/scannow

    How to analyze the log file entries that the Microsoft Windows Resource Checker (SFC.exe) program
    generates in Windows Vista cbs.log
    http://support.Microsoft.com/kb/928228

    Then, run checkdisk - schedule it to run at next boot, then apply OK your way out, then restart.

    How to run the check disk at startup in Vista
    http://www.Vistax64.com/tutorials/67612-check-disk-Chkdsk.html

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

    For Windows 7:

    Try these to erase corruption and missing/damaged file system repair or replacement.

    Run DiskCleanup - start - all programs - Accessories - System Tools - Disk Cleanup

    Start - type in the search box - find command top - RIGHT CLICK – RUN AS ADMIN

    sfc/scannow

    How to fix the system files of Windows 7 with the System File Checker
    http://www.SevenForums.com/tutorials/1538-SFC-SCANNOW-Command-System-File-Checker.html

    Then run checkdisk (chkdsk).

    How to run check disk in Windows 7
    http://www.SevenForums.com/tutorials/433-disk-check.html

    I hope this helps.

  • Windows8 tile problem - when I click on a tile, it opens, then closes instantly...

    Windows8 tile problem. When I click on a tile, it opens, then closes instantly. I have studied the site of Microsoft to solve this problem, but all attempts have failed. I tried to click with the right button on tile and used the feature, turn off, then I was instructed to shut down the computer, restart the computer, click with the right button on tile and select turn on, it did not work. Microft offers a COMPREHENSIVE ANALYSIS of the SYSTEM using Norton. I did and it did not resolve the tile not not opening problem. Can someone help me solve this situation. Is this a common problem with Windows 8?

    My problem has been resolved. I down loaded Windows updates more added Bing bar.

    I can open the tiles now.

    Larry

  • When stopping down, planner of @backup trying to stop, but then "not responding".

    When stopping down, planner of @backup trying to stop, but then "not responding". What is it? Do I need? If so, how to fix? Otherwise, how to disable?

    Hi Paul Gray TX,.

    1. did you of recent changes on the computer?

    2. What is the finished message, you receive so that closing the computer?

    3 do you have any schedule tasks on the computer?

    Method 1

    Check and make sure that you don't have to schedule tasks defined on the computer during the process of closing.

    How to modify the scheduled tasks in Windows XP

    http://support.Microsoft.com/kb/308671

    Method 2

    It is possible that some third-party programs installed on the computer is causing the problem.

    I suggest that you put the computer in a clean boot state and check if it helps.

    To help resolve the error and other messages, you can start Windows XP by using a minimal set of drivers and startup programs. This type of boot is known as a "clean boot". A clean boot helps eliminate software conflicts.

    See the link below to learn more about how to clean boot.

    How to configure Windows XP to start in a "clean boot" State

    http://support.Microsoft.com/kb/310353

    Reset the computer to start as usual

    When you are finished troubleshooting, follow these steps to reset the computer to start as usual:

    (a) click Start, type msconfig in the search box and press ENTER.

    (b) If you are prompted for an administrator password or for confirmation, type your password or click on continue.

    (c) under the general tab, click the Normal startup option, and then click OK.

    (d) when you are prompted to restart the computer, click on restart.

  • Software to insert text in a photo and then take pictures of Windows to copy on an external USB to print at the pharmacy. Thank you

    You know a software product to insert text in the photo and then take pictures of Windows and copy on an external USB to print at the pharmacy. Thank you

    To achieve this product is Adobe Photoshop http://www.adobe.com/products/photoshop/family/.  This not only allows you to do, but allows you to manipulate pictures in almost any way you choose above all.

    If you are looking for a less expensive solution (although nowhere near as functional), then Microsoft Photo Editor free http://www.brothersoft.com/downloads/microsoft-photo-editor.html will probably do the job for you.  In addition, you can try the free Microsoft Office Picture Manager 2003 to http://www.brothersoft.com/microsoft-office-picture-manager-171868.html.  I suggest that you try the free options to determine if it meets your needs before you spend money on Adobe Photoshop (as good as Photoshop is).

    All these programs have the ability to record in a variety of formats - certainly, including that which can be handled by your local drug store (call them to check to determine what types of extensions that they can support and don't forget to use this format when you are working with your photos).

    Good luck and I hope this helps. Lorien - a - MCSE/MCSA/network + / A +.

  • How will I know if my computers security has been breached? __my owner asked me for my email address, then my computer stopped working, then offered to fix it and crossed the reg edit.

    How will I know if my computers security has been breached?
    My landlord asked me my e-mail address, then my computer stopped working, then offered to fix it and crossed the reg edit.

    How will I know if my computers security has been breached?
    My landlord asked me my e-mail address, then my computer stopped working, then offered to fix it and crossed the reg edit.

    oddaz

    If you're really worried that your machine may have been compromised, try to back up your data, and then reinstall windows

    Walter, the time zone traveller

  • When I close my mail a few seconds later notice appears and says direct mail has stopped working, then another notice appears and tells live reboot & for this mail what is happening?

    When I close my mail a few seconds later notice appears and says direct mail has stopped working, then another notice appears and tells live reboot & for this mail what is happening?

    Hi RobertKlaas,

    For a more specialized on issue of Windows Live Mail help, post your query on the Windows Live Forum.
    Windows Live Forum - http://windowslivehelp.com/

  • When you try to access some programs, Windows Vista will stop and then restart

    There are some windows programs that I can't access because my computer says that windows has stopped working then he says looking for a solution and then he says: restart windows. I can't access my programs and features to remove some programs I think may be worth. I can't access MY computer optison either.

    Hi billdee,

    (1) since when are you facing this problem?

    (2) remember to make changes?

    (3) what happens when you try to uninstall the program?

    Method 1: Run the fixit available in the links below and check if that makes a difference-Worth to try
    Difficulty of broken desktop shortcuts and common system maintenance tasks

    Note: FixIt would attempt to recover bad sectors on the hard disk, in the course of this process there are chances of DATA loss from that particular area.

    Method 2: If a Protection of resources Windows (WRP) file is missing or is damaged, Windows may not behave as expected. Auditor of file system (CFS) scan to fix all of the corrupted system files. To do this, follow the steps mentioned in the link below:

    How to use the System File Checker tool to fix the system files missing or corrupted on Windows Vista or Windows 7
    http://support.Microsoft.com/kb/929833

     

    Method 3:  Put the computer to boot and then check if the problem persists

    Follow step 1 in the link below,
    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    If everything works well after a clean boot, you can deduce that some third-party services are at the origin of the problem.

    Continue with the remaining steps to pin-point on the third party service.

    After find you the program that is causing the problem, you will have to perhaps to update or install a newer version of the program, if you rarely use that you should consider uninstalling the software.

    Important: n ' forget not to put the computer to a normal startup follow step 7 in the link

    Method 4: check the logs in Event Viewer for more information on this problem

    Open event viewer

    What are the information in event logs? (Event Viewer)

  • is it possible to set up a dual boot, so I don't have to stop, and then pass the SATA cables that I boot to change?

    Original title: Dual boot

    My XPpro on a former player, was upward. then, I got another new drive, installed Win7Ultimate.  Well, I got the OLD disk works with XP on it.  But, some of these apps DO WORK not on Win7.  so, at least for now, I have two drives installed on the same computer.  is it possible to set up a dual boot, so I don't have to stop, and then pass the SATA cables that I boot to change?   Operating systems already are on 2 different disks.

    Hello

    How to set up a Dual Boot Installation with Windows 7 and XP
    http://www.SevenForums.com/tutorials/8057-dual-boot-installation-Windows-7-XP.html

    Definitive dual-booting guide: Windows 7, Linux, Vista and XP step-by-step
    http://apcmag.com/the_definitive_dualbooting_guide_linux_vista_and_xp_stepbystep.htm

    Dual Boot computer preinstalled Windows 7 with XP
    http://www.howtogeek.com/HOWTO/8790/dual-boot-your-pre-installed-Windows-7-computer-with-XP/

    I hope this helps.
    --------------------------------------------------------------------------------------------
    Rob Brown - Microsoft MVP<- profile="" -="" windows="" experience :="" bicycle="" -="" mark="" twain="" said="" it="">

  • Windows Explorer stops working, then restarts

    Windows Explorer, not Internet Explorer stops working, then restarts whenever a windows in the start menu program is closed. In some programs in the start menu, such as Documents, pictures, music, games, computer, control, devices and printers, ect. The error message indicates that windows Explorer has stopped working and controls a solution. Then after about 10 seconds, all the desktop icons disappear, and then looks like windows Explorer restarts itself. I am running windows 7 since an upgrade of Vista. I reinstalled windows 7 upgrade kit and done all the recommended solutions to various web pages, but the problem persists. I talked to tech support and they say that, perhaps, some of the registry files are corrupted. The problem does not occur when I start the computer in safe mode. I have updated all drivers and updates of the window. I don't have a disk of Vista orginal software. Can I fix this on my own?

    Hi Michaeldaz,

    As the problem does not persist in safe mode, I suggest that you perform the clean boot procedure to check whether a third-party program installed on the computer is causing the problem.

    To help resolve the error and other messages, you can start Windows Vista or Windows 7 by using a minimal set of drivers and startup programs. This type of boot is known as a "clean boot". A clean boot helps eliminate software conflicts.

    See the link below to learn more about how to clean boot.

    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    http://support.Microsoft.com/kb/929135

    Reset the computer to start as usual

    When you are finished troubleshooting, follow these steps to reset the computer to start as usual:

    (a) click Start, type msconfig in the search box and press ENTER.

    (b) If you are prompted for an administrator password or for confirmation, type your password or click on continue.

    (c) under the general tab, click the Normal startup option, and then click OK.

    (d) when you are prompted to restart the computer, click on restart.

    I hope this helps!

    Halima S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • When I start my computer, that it is said that gxfui has stopped working then my Mcafee says my computer is in danger and it won't let me turn on the virus scan

    When I start my computer it say the GfxUI has stopped working then the Mcafee said computer at risk that he will not keep the antivirus scan

    Hello

    1. do you remember make changes to your computer before this problem?

    Method 1:

    Step 1:

    Start the computer in safe mode and see if the problem occurs. Follow the steps from the link to start in safe mode: http://windows.microsoft.com/en-US/windows7/Start-your-computer-in-safe-mode

    Step 2:

    If the works in safe mode and then start the clean boot computer and check to see if it helps: How to troubleshoot a problem by performing a clean Windows Vista or Windows 7 boot http://support.microsoft.com/kb/929135

    Note: when you are finished troubleshooting, follow step 7 to start the computer in normal startup.

    Method 2:

    Try to update the graphics driver to your computer and check if it works: http://windows.microsoft.com/en-US/windows7/Automatically-get-recommended-drivers-and-updates-for-your-hardware

    Method 3:

    Try to do a scan of your computer for viruses using the Microsoft Safety Scanner by clicking on this link: http://www.microsoft.com/security/scanner/

  • AFTER TWO MINUTES OF INACTIVITY, I AM BACK TO WHERE I LOG IN AS A USER AND ENTER MY PASSWORD AND THEN TAKES ME TO ANY PAGE OF THE APP I WAS USING

    AFTER TWO MINUTES OF INACTIVITY, I AM BACK TO WHERE I LOG IN AS A USER AND ENTER MY PASSWORD AND THEN TAKES ME TO ANY PAGE OF THE APP I WAS USING

    AFTER TWO MINUTES OF INACTIVITY, I AM BACK TO WHERE I LOG IN AS A USER AND ENTER MY PASSWORD AND THEN TAKES ME TO ANY PAGE OF THE APP I WAS USING

    Hello

    Click on desktop and select Customize.

    Click the screen saver icon on the bottom of the window.

    In the window of the screensaver, remove the check mark from the résumé shows the lock screen.

    Click Apply/OK.

    Explanation:

    Even if a screen saver is not enabled if you select the summary option, the system will automatically display the lock screen when the idle time is reached.

    Concerning

  • How can I stop and then resume when you use the magnetic Lasso tool?

    CS4 on Mac. I have some fairly complicated selections to make and the magnetic lasso tool seems a good choice. However: How can I stop and then resume when in use? For example, I would like to zoom, start by dragging along the edge, then stop, move the image to a different area of it is in the middle of my screen, then pick up again where I left.

    Hi MarieMeyer,

    You can press the SPACEBAR shortcut to activate the hand tool temporarily once you are finished with the selection on a part of the image.

    Then, move the image with the key space key and let it continue with the selection by using the magnetic lasso tool.

    You can use the SHIFT key to add to the selection by using the magnetic lasso tool.

    Kind regards

    Claes

  • I can't open the PDF with Adobe Reader XI... get an error that "Adobe has stopped working" then it closes.  Any suggestions?

    I can't open the PDF with Adobe Reader XI... get an error that "Adobe has stopped working" then it closes.  Is it a question of Adobe, Microsoft problem or security issue?

    Since you talk about Microsoft, I guess you're on Windows.

    Can you open Reader by itself?  If so, try to disable the Protected Mode [Edit |] Preferences | (Improved) security].

  • stop-vmguest runasync

    I can not get the following to work with a list of virtual machines. only one at a time

    $allLines = @ (# line added)
    Get-VM-name (Get-Content - Path "C:\vms.txt"). »
    {ForEach-Object
    If ($_.) PowerState - eq "poweredOff") {}
    echo $_ is turned off
    }
    Else {}
    Stop-VMGuest $_ - confirm: $false - RunAsync
    sleep 60
    Move-VM $_-Destination xxx.xxx.com - confirm: $false - RunAsync
    sleep 5
    Get-NetworkAdapter | Together-NetworkAdapter NetworkName - VGA-vlan245-confirm: $false - RunAsync
    Start-VM $_ - confirm: $false - RunAsync
    }
    }
    no idea why I can't run the task on all virtual machines together?

    The last lines of your script should use the variable $_ instead of the $VM variable.

    $arrVMsToMove | %{Move-VM -VM $_ -Destination xxxxxxxxxxxx -Confirm:$false -RunAsync}
    ## sleep a bit Start-Sleep 5 ## get the given VMs' NICs and set their NetworkName $arrVMsToMove | %{Get-NetworkAdapter -VM $_| Set-NetworkAdapter -NetworkName dvPG-vlan245 -Confirm:$false}
    ## start the given VMs $arrVMsToMove | %{Start-VM -VM $_ -Confirm:$false -RunAsync}
    

Maybe you are looking for

  • Addons

    How to download firesheep

  • Package update procedure

    I checked the RSS feed for my podcast, EGO NetCast, you Podbase Podcast Validator. I received the following analysis: "The coverage of art cover art must be 1 400-3 000 square pixels to look great on retina fantasy-class screens. The art of the podca

  • IPod repair warranty transferable?

    I had Apple fix my IPod Touch 4 with a new battery which means I'll be back a touch refurbished. I read that this refurb comes with a 90 day warranty (?), transferable to a new owner if I sell to the touch?

  • Turns off my Satellite P100-313

    Hello! My P100-313 regularly stops. I think it is a temperature problem. I would like to test the system at full load, but I don't know how messure the cpu or gpu temperatures. I have already installed MPC 5. As I could not put in place the correct m

  • Install the EFI on new SSD partition when doing 10 costs of Windows Installer

    I have a similar problem to this topic. Windows was originally (and still is) installed on my HARD drive and I just installed my SSD recently. When I did a clean install of Windows 10 on my new SSD it has not installed the EFI partition. Is there a w