Back Up Microsoft Virtual Server Images…

Management, Productivity, Tips  Tagged , , , No Comments »
Posted by

This article first appeared at the now-closed Win32Scripting site. Since I find it useful, and my bookmark no longer works, I have been unable to reach its author, Jeff Trumbull, so I hope he doesn't mind that I've archived it.

Author: Jeff Trumbull

Description:
Backup files that make a Microsoft virtual server with only about 1 minute of down time. Suspends the virtual server, takes a shadow copy , starts the virtual server then copies virtual server files. This could be used to copy any open files. Requires vshadow.exe from vss sdk.

Script:

On Error Resume Next

Set objShell = CreateObject ("WScript.Shell")
set objFSO=CreateObject("Scripting.FileSystemObject")
Set virtualServer = CreateObject("VirtualServer.Application")
DestBackupDir = "your backup path"
sExCmd = "CreateVSS.cmd"
Set oFileSys = CreateObject("Scripting.FileSystemObject")
if oFileSys.FileExists(sExCmd) then oFileSys.DeleteFile(sExCmd)
set oExCmd = oFileSys.CreateTextFile(sExCmd, CopyOverwrite)

For each objVM in virtualServer.VirtualMachines
     'See if vm machine is running. If so then do backup
     If objVM.State = 5 then
          'Save state the virtual machine
          set saveTask = objVM.Save
          'Loop waiting for task completion - and display status
          while not saveTask.isComplete
              WScript.Sleep 1000
          wend
               'Copy .VMC and .VSV files
               MyArray = Split(objVM.File,"\")
               Filename = MyArray(Ubound(MyArray))
               objFSO.CopyFile objVM.File,DestBackupDir & Filename
               MyArray = Split(objVM.SavedStateFilePath,"\")
               Filename = MyArray(Ubound(MyArray))
               objFSO.CopyFile objVM.SavedStateFilePath,DestBackupDir & Filename
          End If
Next
Set objVM = Nothing

' Create Shadow copy of VM drive
oExCmd.WriteLine "vshadow.exe -script=setvar1.cmd -p d:"
oExCmd.WriteLine "call setvar1.cmd"
oExCmd.WriteLine "vshadow.exe -el=%SHADOW_ID_1%,x:"
oExCmd.Close
Result = objShell.run(sExCmd,vbMinimized, TRUE)

' Start VM machine up from saved state
For each objVM in virtualServer.VirtualMachines
          'See if vm machine is Saved. If so then resume
           If objVM.State = 2 then
               'Start virtual machine
               objVM.Startup
           End If
Next

Set objVM = Nothing
WScript.Sleep 10000

If Result = 0 then
         'Loop through all vm machines
         For each objVM in virtualServer.VirtualMachines
            'See if vm machine is running. If so copy shadow backup of vm disk drives
             If objVM.State = 5 then
                  'Copy virtual hard disks and undo disks
                  For each vhd in objVM.HardDiskConnections
                       MyArray = Split(vhd.undoHardDisk.file,"\")
                       Filename = MyArray(Ubound(MyArray))
                       SourceName = "x" & Right(vhd.undoHardDisk.file,Len(vhd.undoHardDisk.file)-1)
                       wscript.echo vhd.undoHardDisk.file
                       wscript.echo SourceName
                       objFSO.CopyFile SourceName,DestBackupDir & Filename
                       MyArray = Split(vhd.HardDisk.file,"\")
                       Filename = MyArray(Ubound(MyArray))
                       SourceName = "x" & Right(vhd.HardDisk.file,Len(vhd.HardDisk.file)-1)
                       objFSO.CopyFile SourceName,DestBackupDir & Filename
                  Next
             End If
      Next
End If

' Shutdown all shadow copy instances
if oFileSys.FileExists(sExCmd) then oFileSys.DeleteFile(sExCmd)
set oExCmd = oFileSys.CreateTextFile(sExCmd, CopyOverwrite)
oExCmd.WriteLine "Echo y | vshadow.exe -da"
oExCmd.Close
Result = objShell.run(sExCmd,vbMinimized, TRUE)

'Script ends
wscript.echo "done"

Using Access and Outlook to Send To Mailing Lists

Productivity, Programming  Tagged , , , , 20 Comments »
Posted by

Perhaps the most popular article on the site explains how to send email to a bunch of people using Access and Outlook.

It has garnered its fair share of comments and emails, and one came in today that I figured I'd share and then elaborate on.

The mail reads (in part):

I have a following question: How to modify this module to be able to send messages to various mailing lists that I predefine in respective queries? In other words, I have in my database 3 categories of customers (in 3 different queries) andI want to address them with a different message. Do I need to create 3 macros running 3 modules each referring to a separate query with a given category of customers or is there another way to do it?

You don't have to create modules for each list, you just need to be able to tell the macro which query you want to use before running it.
Read the rest of this entry »

Installing Windows 7 for Testing

Productivity, Technology  Tagged , No Comments »
Posted by

A client asked me how to best install Windows 7 for testing. His son is interested in it, and he thought his son's machine could afford being wiped to install the new OS.

I instead told him to use VirtualPC to do the job.

A quick Google later, and I pointed him to these directions as they were as full featured and complete a set as I've seen... and I didn't have to type them myself. :-)

Nice job, Abbas!

Programs We Like: Artweaver

Productivity  Tagged , No Comments »
Posted by

I'm a HUGE fan of Photoshop, but when I have lot of programs open and am running low on memory, it's sometimes tough to justify the long startup time to do a quick edit or convert something to JPG.

I stumbled upon Artweaver as a freeware equivalent of Photoshop. It doesn't have everything PS has, but it has enough to do the job - quick crops, resizing, conversion between formats, and it's free. Wins all around.

The nicest part of the program is that it's interface is a very close match to PS, so it's simple to transition from one to the other. The menu choices were all in the same place.

It reads all sorts of file formats (including PSD), it handles layers and offers a plug-in architecture.

If you're looking for a quick and powerful editor for when PS is overkill, you could do a lot worse.

Importing and Exporting Mail and User Accounts in Outlook 2007

Productivity, Tips  Tagged , , , 49 Comments »
Posted by

Outlook 2007 did away with the export account information that was present in earlier editions. So, if a user with one account moves machines, it's often faster to just recreate the account on the new machine. However, if a user has 8 accounts (like one did today) it's time to find a better way.

That better way is hidden the registry.

On The Old Machine

Outlook 2007 is nice enough to put all of its account info for each profile under one key.

HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\

So, first off, close Outlook if it's running.

To export your Outlook account information, we just need to export that magic key.

  1. Open Registry Editor.
  2. Select the key that you want to save as a file.
  3. On the File menu, click Export.
  4. In the Export Registry File dialog box, in Save in, click the drive, folder, or network computer and folder where you want to save the hive.
  5. In File name, enter a name for the key. (outlook_profile.reg would work great.)
  6. In Save as type, make sure it's set as Registration Files (*.reg)
  7. Click Save.

Caveats: Every profile on your system under your logon will be exported.

To move your old mail, you'll need to copy your PST file to the new machine.

  1. Click Start, Run
  2. Type %userprofile%\local settings\application data\microsoft\outlook
  3. Click OK
  4. In that folder there will be some *.pst files. Copy (don't move!) them to a removable drive or a network share. The one you're most likely concerned with is outlook.pst

On The New Machine

First, we need to import the profile information.

  1. Double-click the file (outlook_profiles.reg) you exported on the old machine. That will import the new information into the registry. (Simple!)

Next, we need to get your data file back over.

  1. Click Start, Run
  2. Type %userprofile%\local settings\application data\microsoft\outlook
  3. Click OK
  4. Copy (don't move!) the *.pst files you found on the old machine. The one you're most likely concerned with is outlook.pst

Lastly, we need to set Outlook to use the profile from the old machine.

  1. Open Control Panel.
  2. Open the Mail applet.
  3. Click on the Show Profiles button.
  4. Choose the profile name that matches the one you used to use from the "Always use this profile" dropdown.
  5. Click OK.

Now, when you open Outlook, you should have your old mail and the mail accounts all set up and ready to go.

Passwords

Outlook on the new machine mightwill ask you for passwords the first time it does a send/receive on all non-Exchange accounts.

If you know the passwords, awesome. If not, you'll need to find them out, and we go back to the old machine to do so.

What we need to do is peer behind the dots that Microsoft uses in their password boxes. To do so, we need a piece of freeware that will do that for us.

Passware offers a utility, Asterisk Key, which will do the job.

  1. Download, install and run the tool on the old machine using this link.
  2. Open Notepad.
  3. Open Outlook 2007.
  4. Click Tools, Account Settings.
  5. Double-click the account you don't know the password to.
  6. Go into Asterisk Key and click the RECOVER icon on the toolbar.
  7. The tool will reveal your password for that account. Click the COPY LINK next to the revealed password.
  8. PASTE the password into your notepad document.
  9. Repeat Steps 5-8 as necessary.
  10. Save the Notepad document so you can move it to the new machine.
  11. At the new machine, paste the passwords from the Notepad document into Outlook.

That oughta do it.


WordPress Theme & Icons by N.Design Studio. WPMU Theme pack by WPMU-DEV.
Entries RSS Comments RSS Log in