Windows Vista Forums

Waiting xx seconds before running next command
  1. #1


    JoeF Guest

    Waiting xx seconds before running next command

    I'm working on a script that we will use to power off a SAN in the event of a
    power failure. What I'd like to do is use have a computer called PC1 start a
    script on PC2 when it is being shutoff for power failure. I plan on having
    the UPS software initiate the script on PC1. When PC1 starts the script on
    PC2, I want PC2 to have a pause in the script where it waits for 5 minutes or
    so before running the next line that will start the shutdown on SAN.

    I'm not sure how get PowerShell to wait for xx seconds before running the
    next line. Any help would be greatly appreciated.



    Thanks,
    Joe

      My System SpecsSystem Spec

  2. #2


    Marco Shaw [MVP] Guest

    Re: Waiting xx seconds before running next command

    > I'm not sure how get PowerShell to wait for xx seconds before running the

    > next line. Any help would be greatly appreciated.
    The start-sleep cmdlet should help:

    PS > get-help start-sleep -examples
    NAME
    Start-Sleep
    SYNOPSIS
    Suspend shell, script, or runspace activity for the specified
    period of time.
    -------------------------- EXAMPLE 1 --------------------------
    C:\PS>Start-Sleep -s 15
    This command makes the shell sleep for 15 seconds.
    -------------------------- EXAMPLE 2 --------------------------
    C:\PS>Start-Sleep -m 500
    This command makes the command shell sleep for 1/2 second (500
    milliseconds).


    Marco

    --
    Microsoft MVP - Windows PowerShell
    http://www.microsoft.com/mvp

    PowerGadgets MVP
    http://www.powergadgets.com/mvp

    Blog:
    http://marcoshaw.blogspot.com

      My System SpecsSystem Spec

Waiting xx seconds before running next command problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pass argument for a command waiting for user input @lways PowerShell 0 04 Mar 2010
Video stops running after about 30 seconds Roary General Discussion 3 06 Nov 2009
Running a command from inside a script, command line is corrupted Raymond Vought PowerShell 4 24 Feb 2009
Script not waiting for previous command to complete larzeb2000 PowerShell 1 11 Nov 2008
10 seconds delay when starting 'command prompt' Jim Brown Vista General 2 19 Feb 2007