Strategy for backing up VMWare Workstation instances on Windows - windows

Can anyone recommend an automated backup solution that can handle VMWare instances?
I would like something to run overnight, suspend any running virtual machines, back up the files over the network (or hand off to another backup job), and (optionally) resume any VMs that it suspended.
A free/open source solution would be ideal, but I'll pay for a closed solution if necessary.

You could do this with a scheduled task and a script - Workstation is pretty easy to automate from the command line.
Psuedocode for the script:
for each VM {
vmrun.exe suspend <path_to_.vmx>
copy <path_to_vm>\*.vmdk \\backup-server\vmbackups\<vmname>\
vmrun.exe start <path_to_.vmx>
}
There's some more plumbing to be done, but once you have a working backup script you can schedule it or run it whenever you like. If you get your VM information from vmrun.exe list you don't have to worry about adding more running VMs or anything. Hope that gets you started.

Related

Make a PowerShell script run on startup in the OOBE Sysprep environment

Thanks for stopping by, I've searched the corners of the internet but haven't gotten anywhere.
To provision devices for my organization, we must manually run PowerShell commands using SHIFT + F10 in the Windows 11 OOBE as we have multiple methods, one of which being legacy. I'm sure there are better methods but I'm unfortunately working within these limitations. So far, to automate the imaging process, I've created an autounattend.xml which makes WinPE completely silent and some pages of the OOBE also.
Recently, I combined all the PowerShell commands we had been running prior into a script that, after running repeated checks for a network connection, prompts users with a GUI and effectively automates everything we had been doing manually before:
Message box with radio buttons
I need to make this run when the OOBE Sysprep starts, but I really need some help.
The script contains GUI, so it cannot run silently and the user needs to interact with it.
The script must start with the OOBE Windows Welcome Screen, (i.e. select region screen). This is a limitation of the modules used and I therefore can't include it as a synchronous command in FirstLogonCommands or include it in SetupComplete.cmd, as those both execute after the OOBE is completed.
I've tried configuring the answer file to boot into audit mode and have the script run there, but the script requires several reboots and I get an installation failed message after any reboot (despite later making the script enable the Administrator account and call "sysprep /audit /reboot"). Additionally, the Audit Administrator account takes ~15 minutes to log in so it defeats the whole purpose of time saving.
I've tried using Task Scheduler, running both on System Start Up and User Log On, as defaultuser0, BUILTIN\Administrators and SYSTEM. Task scheduler seems to either queue tasks or not call them at all in the OOBE
I've tried placing the script, and then a shortcut of the script, in the common start up folder but that didn't work either.
To reiterate, I need a way to automatically run a script when the OOBE Sysprep starts. Furthermore, I need it to run every time the OOBE is launched as sometimes, we have to manually reboot if something glitches or goes wrong so the script will need to run again when the OOBE is resumed.
I know this is a tough one due to the limitations, but this will make the device rollout significantly easier.
Thanks,
Jake

Windows 2000 Shutdown on Program Close

Is there a way to signal windows 2000 to shutdown when a specific program closes? I tried doing it by scheduling a task but couldn't find the shutdown executable, apparently it's only include starting in windows 2003. My next thoughts were with a batch file but I couldn't find any documentation on the command to use.
To summarize the comments & further information therein, this question is closer to the following:
How can I monitor a process on a Windows 2000 VM, running in VirtualBox, so that I can kill off the VM when the process I care about falls over?
Working from there, something like http://www.virtualbox.org/manual/ch08.html#vboxmanage-guestcontrol would be the way to go. Create a process which tells VirtualBox to start your process & then perform the shutdown when that process terminates. You'd essentially be constructing a supervisory process outside of the Win2K environment, however you want to accomplish that, rather than trying to work within the environment itself.

In Vagrant which is better out of halt and suspend?

When I'm about to shutdown my host machine off should I:
vagrant halt
OR
vagrant suspend
What's the difference?
tl;dr
Use vagrant halt when you want to power off your machine, use vagrant suspend when you want to hibernate your machine.
From the Vagrant docs:
vagrant suspend
A suspend effectively saves the exact point-in-time state of the
machine, so that when you resume it later, it begins running
immediately from that point, rather than doing a full boot.
This generally requires extra disk space to store all the contents of
the RAM within your guest machine, but the machine no longer consumes
the RAM of your host machine or CPU cycles while it is suspended.
vagrant halt
This command shuts down the running machine Vagrant is managing.
Which one you want to use?
It is basically up to you - do you have on-going work on the VM (maybe multiple applications opened through GUI, etc) you would prefer to suspend the VM so when you power up the machine, everything is there (Vagrant/VirtualBox would need to store the state of the instance on your hard drive consuming some hard drive space from your host). If you want to start from a clean start as all your process are setup from init, then go for vagrant halt
Example:
If you don't work much on your VM, meaning that all your project files are stored on your host and shared with your VM to see how they reflect using a
LAMP server, then you can safely go with vagrant halt
If when you start your instance, you need to manually start specific processes, or you work on files directly in the VM; then it's better to suspend it so that when you turn it back on, it'll save your session and retrieve the instance in the same state it was in before you suspended it.

Remotely Executing an Independent .exe on an Apache Server [CGI]

I have an executable program I've created which is a server. I would like to be able to start and stop instances of this program on a Windows Server 2008 machine via the website the same machine hosts.
The functionality I'm hoping to achieve is: from anywhere I can access my website to start and stop instances of the server code instead of constantly Remote Desktop-ing into it just to start/stop it.
I've tried using Perl, but when I run the code it looks like it prints out some of the information the program does (so it's working) but then seems to stop. Whereas I would like it to start an instance of the program as its own process.
Perl:
#!C:/Perl64/bin/perl.exe
print "Content-type: text/plain\n\n";
exec('C:\file.exe');
I'm not sure what language I should be using or if there are completely other, better ways of achieving my goal. Thanks!
exec is the wrong choice, and so are threads. Simply start the process in the background. You did not say how you would normally stop the server. If it has its own command for stopping, the same as for starting applies; else kill the process.

Jenkins/Hudson - Run script on all slaves

I have a requirement to run a script on all available slave machines. Primarily this is so they get relevant windows hotfixes and new 3rd party tools before building.
The script I have can be run multiple times without undesirable side effects & is quite light weight, so I'm happy for this to be brute force if necessary.
Can anybody give suggestions as to how to ensure that a slave is 'up-to-date' before it works on a job?
I'm happy with solutions that are driven by a job on the master, or ones which can inject the task (automatically) before normal slave job processing.
My shop does this as part of the slave launch process. We have the slaves configured to launch via execution of a command on the master; this command runs a shell script that rsync's the latest tool files to the slave and then launches the slave process. When there is a tool update, all we need to do is to restart the slaves or the master.
However - we use Linux whereas it looks like you are on Windows, so I'm not sure what the equivalent solution would be for you.
To your title: either use Parameter Plugin or use matrix configuration and list your nodes in it.
To your question about ensuring a slave is reliable, we mark it with a 'testbox' label and try out a variety of jobs on it. You could also have a job that is deployed to all of them and have the job take the machine offline it fails, I imagine.
Using Windows for slaves is very obnoxious for us too :(

Resources