Command line shutdown and restart

Home Forums Virtualization Virtual Server & Virtual PC Command line shutdown and restart

This topic contains 10 replies, has 7 voices, and was last updated by Avatar Anonymous 9 years, 3 months ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • Avatar
    marcopolo
    Member
    #149500

    I want to automate a scheduled shutdown so I can copy the vhd file, then restart and wondered if anyone has some ideas.

    I’ve found a VBScript but I’m interested to know if anyone has done it this way or has an alternative method, maybe Powershell?

    Thanks in advance

    tehcamel
    tehcamel
    Moderator
    #355875

    Re: Command line shutdown and restart

    is this any use ?
    http://www.infotechguyz.com/cmd/powershellremoteshutdown.html

    (source: google. first hit for “powershell shutdown script”)

    It’s probably not exactly what you need, but you could modify it.

    Avatar
    sorinso
    Member
    #267051

    Re: Command line shutdown and restart

    What virtual solution are you using? VirtualPC? VirtualServer?
    What OS is the host running?

    Avatar
    vonPryz
    Member
    #347458

    Re: Command line shutdown and restart

    Virtual Server can be managed via WMI or COM interface.

    Create a list of guests to shut down. Send each guest OS shutdown call and wait for a while. Check that guests are shutted down, if not force power off -state. Back up stuff and start your machines.

    Here are some sample scripts.

    .vP

    Avatar
    Anonymous
    #370466

    Re: Command line shutdown and restart

    Cheers chaps, we’re running a mixture of 2005 Virtual Servers (and Hyper-V)

    The aim is to try and run a schedule on the physical server to cleanly shutdown the VS’s (2003 for starters).

    While shutdown, backup the vhd’s

    I’ve found this for 2003 Server

    This shutdown

    On Error Resume Next

    Set objVS = CreateObject(“VirtualServer.Application”)
    Set objVM = objVS.FindVirtualMachine(“Windows 2000 Server”)

    Set objGuestOS = objVM.GuestOS
    objGuestOS.Shutdown()

    ..and this starts up

    On Error Resume Next

    Set objVS = CreateObject(“VirtualServer.Application”)
    Set objVM = objVS.FindVirtualMachine(“Windows 2000 Server”)

    objVM.Startup()

    Though I need to confirm what I need on the server to run the files

    Avatar
    Ossian
    Moderator
    #181635

    Re: Command line shutdown and restart

    This might help for the HyperV ones:
    http://www.infotechguyz.com/server2008/manageHyperVvms.html

    Avatar
    sorinso
    Member
    #267053

    Re: Command line shutdown and restart

    What do you mean by

    Quote:
    what I need on the server to run the files

    ?
    The script you posted is VB, you can run it whenever you feel like it.
    :!: Anyway, I suppose you know this is a poor method to backup virtual machines …

    Avatar
    Anonymous
    #370467

    Re: Command line shutdown and restart

    sorinso;207551 wrote:
    What do you mean by ?
    The script you posted is VB, you can run it whenever you feel like it.
    :!: Anyway, I suppose you know this is a poor method to backup virtual machines …

    Yes, I’m aware it is VB so I can use apps like Cscript to execute it but this is to shutdown the VS’s only, not to back them up, I can use a copy command to do that.

    If you can suggest a suitable method to automate the shutdown of 2005 VS’s, I’m all ears.

    Btw guys, thanks for the Hyper-V suggestions, of which I’ll look at once I’m happy with 2005

    #344163

    Re: Command line shutdown and restart

    I think he meant that taking a copy of the VHD files isn’t the best way to backup a VM.

    Avatar
    Anonymous
    #370468

    Re: Command line shutdown and restart

    gforceindustries;207693 wrote:
    I think he meant that taking a copy of the VHD files isn’t the best way to backup a VM.

    Ahh, right. :)

    Avatar
    sorinso
    Member
    #267058

    Re: Command line shutdown and restart

    gforceindustries;207693 wrote:
    I think he meant that taking a copy of the VHD files isn’t the best way to backup a VM.

    Indeed.
    Although the VHD file contains the VM’s hard disk itself, it is not the only thing you need to be able to recover a lost VM. There is also the configuration file, the network file, and of course, snapshots, if you have any. Might be also saved-states files, undo disks and so on and so on. And the matters get worse if you are using differencing disks in your machines.
    That’s why I mentioned that copying the VHD file cannot be considered a reliable (acceptable?) backup solution.

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.