2014/01/14

Miniblog: Powershell Out-Gridview cmdlet

Normally I'm not so enthusiastic about a simple powershell cmdlet but in this case I wonder why I didn't find it earlier.

With Powershell you will end up with arrays of objects all the time. Visualizing them on the console can be tricky. Worse if you want to select a certain object, you will need to display them and then let the user input some number that corresponds with the object you want to select. Most of the time I will end up with using the in-line where clause to filter out objects but it is not really dynamic.

Until this morning I discovered the out-gridview. This cmdlet will take a stream of objects and show them in a GUI gridview. If you use the -passthru parameter it even allows you to select an object. To give you an example, here is a "Process killer" script in 1 line of code

Get-Process | Out-GridView -passthru -title "Kill me now" | % { Stop-Process $_ }
When you run it a gridview will appear:
 
Then you can select the filter view to filter out for example notepad. If you then select notepad and click ok, it will send the select object(s) down the pipeline where the foreach-object will iterate over the objects and stops the processes

2014/01/10

Track my Veeam Restore Point

When using Veeam Backup & Replication, you will see that backup files are created at job level. The good thing is that this introduces job level dedup. However when you look at the backup files, it is hard to identify which file includes which VM. It's not really a problem as the Veeam DB will keep track of this.

But what if you want to copy restore points with another tool? Some companies are still running 2 backup products, one for  physical, one for Veeam. Typically the first application also has the tape library connected. Or what if you just want to copy your backups to the cloud. How are you supposed to know which VM is stored in which files if it is no longer being tracked by backup and replication?

Well this pet project might help a bit. First of all, I just wrote it and it is not tested. The reason is simply not to waste too much time developing something nobody uses. For me the goal was rather to learn some more about PowerShell (I am planning to do some Powershell webinars soon, so need to practice and get some cool examples made). So remember:
  • It's not tested, be careful with it
  • It potentially can generate a lot of data because it is not optimized
  • It won't truncate any data :)
  • Enjoy!
You can find it here

In essence, this powershell script will just query the restore points that are currently active on the Veeam Backup Server. Then it will understand which files are linked to it and insert that data in a SQL db.

So first thing you need to do is to create a database in your SQL server instance.  The default settings will be
  • instance: localhost
  • db : rpdb
  • user : rpdbuser
  • password : rpdbpass
In my test setup I made the rpdbuser db owner of the rpdb. You can change the parameters in the script:
Make sure you have the database setup. Then you can run the script with the -createdb flag. It should create all the tables:
From that moment you can start collecting restore point meta data. If you run the script without filter, all the restore points at that point will be inserted in the db. If you would do this daily, you will see duplicates popping up. This is certainly the case for forward incremental. However if you are using reverse incremental, it makes sense to have duplicate restore points as they have shifted probably from filename.

To get more control over what should be stored and what not, I would recommend using filters to only store the restore points data that you are shipping off site. Then running the collect script as part of a post job or after your copy is done by your third party application.

Collecting data will be done with the -collect switch. However I added a -dry switch so that you can test before you let the powershell script insert data in db. Here are some examples of filtering:

No filter:

-Collectfiles "file1.vbk,file2.vib" which will only store those restore points related to backup files you might have shipped

-Collectonlyfull switch which will only store info about full vbk
-Collectjob "jobname" which makes sense if you run as a postscript on a job
Or just a combination of collectjob and collectonlyfull
If you are happy with the result, remove the dry command and let it run whenever you want to track the state of restore points:

Then you can use the -vm paramter and the -begin and -end parameter (f.e  -vm sharepoint -begin "2013-01-01" -end "2014-02-01") to find a restore point for a certain VM. Remember the date will not be when you tracked it but rather the date when the restore point is created. Then if you find the restore point you like, you can use the -id parameter to understand which file you need to get back to the repository to do a restore for a certain file.

Finally, could you use this functionality in combination with files to tape instead of backup to tape? You could but it still requires you to do a lot manual setup and manual querying and restoring. So if you can, let Veeam track everything and you will have nothing to do and not the worry about setting up anything!

2013/12/19

1-Click Veeam Install on Windows 2012

With v7 there were a lot of improvements. One of those is the ability to do a silent or unattended install of Veeam Backup & Replication. There is actually a good kb article that describe how to install each individual component but it actually requires you to figure out dependencies or how to install SQL express. You can find it here.

One of the interesting scenario's why you could do and automated install is if you want to install a backup server at each branch office to use as a "restore" installation as described in my previous article "after the backup copy job the auto import". For me the trigger was actually a partner that just wanted an installer he could use at a customer to set up a very simple PoC very quickly.

After some considerations, I decided to install everything with powershell. Not only is it the preferred language for Windows 2012 scripting but it is also your primary scripting tool for Veeam Backup & Replication. The target platform is 2012, so I have no idea if my findings will work for 2008 and so on (for example the script will enable dotnet 3.5 on Windows 2012). So feedback is really appreciated.

You can find the automation script here

Now there are some dependencies that you need to fulfill before you can use it:
  • Create a Windows 2012 machine
  • Add it to a domain
  • Create a user srvveeam in your domain (or change the param section at the start of the script)
  • Download the Veeam Backup & Replication ISO. Then extract the following folders in a new empty folder: Backup, Catalog, Explorers and Redistr. Then add the script, bat file and your license (veeam_backup.lic) in the same folder as shown below.
  • Give srvveeam user the required permissions for backup and replication in vCenter. You can find the fined grained permissions in the doc section of Veeam. Also alter the vCenter address in the script.
  • I recommend scrolling through it and fine tweaking it to your environment.
Now installation will be quite easy, just right click runmeasadmin and run the bat file as an administrator.

Installation should start and install all necessary requirements for Windows 2012 including SQL Express. If one of the components is not installed successfully it  should fail. If something is already installed, the script should skip installing the specific item.

 

Cool thing about using powershell is that you can load the powershell snapin after you install it. So it means you autoconfigure Veeam for example to add proxies or repositories automatically to the new installation. This script will do the following in B&R after installation:
  • Create credentials
  • Create a new repository
  • Add vCenter
  • Create a single job that includes all the VMs (Maybe test and tweak before you use it in your 1000VM environment ;)). It will use the credentials created before to enable Application Aware Image Processing

 But of course your imagination is your only limitation when using Powershell :D.

2013/12/13

Miniblog Series P003: When are my Veeam socket licenses being used/assigned?

A lot of times I got the question from people: "Do I need to license my target ESXi hosts for Veeam Backup & Replication in case I want to use the replication feature?" From a Veeam perspective, you don't, you only need licenses for the source hosts. However you do require VMware licenses at the source and target side because we need to be able to talk to the VMware API (which is not possible with the ESXi free edition.

A lot of companies also have separate development and production environments but both are typically connected to one vCenter. In this case, they get worried too if they only want Veeam for production. Because what will happen if you add vCenter to Veeam? Will it start complaining about not having enough sockets? No it won't!

If you read our FAQ it will actually tell you this info:
http://forums.veeam.com/viewtopic.php?f=2&t=17633#p85109

Q: How the product is licensed?
A: Per physical CPU socket of "source" hypervisor host (where protected virtual machines reside). Destination hosts for replication and migration jobs do not need to be licensed. Hosts running virtual machines which are not being processed by Veeam do not need to be licensed, even if they are a part of the same cluster.

Then how do we do the licensing. Actually this info is also in the FAQ.

Q: At what specific moment do the source host sockets get counted towards the licensed sockets pool?
A: Upon first backup, replication or copy of a VM that is running on the given host.

So when you start a new backup job it will first validate if the host running the source VM has the necessary sockets entitled to it. If it has, Veeam will continue to backup the VM. If there are no sockets assigned to the host, Veeam will check if you still have licenses available to assign. If yes, Veeam will assign them dynamically and continue to do the backup. If there are no sockets left, the backup will fail.

Now how do you check which host have which licenses assigned? Well just go to the main menu . There select help and then licensing information.


This will open up the license information dialog. If you click the "Licensed Hosts" button in the bottom left corner of this dialog, you can check your socket assignment. If a socket was accidentally assigned to a development host you can select it and then click the revoke button to remove the socket.


In this dialog you can also check the total/remaining amount of sockets.

In case you added your backup server to the Enterprise Manager, it will act as the central licensing server. In this case you execute the same actions from this central console. Just go to configuration tab and then select licensing.


 

Miniblog Series P002 : How do I succesfully open a call at Veeam?

For most vendors opening call is a very annoying and tedious process. Well for Veeam it is actually really easy and I can only recommend just opening a call with every problem you have. Sometimes I will visit people just to hear that they are having a very frustrated problems for months but then when I ask to send me a call number they have never actually opened a call. To be honest, this is a chicken/egg situation. You are not telling Veeam that you have a problem so it impossible for Veeam to solve it.

Collecting Logs

First of all start by collecting the logs. You can do this by going to the main menu. There under help > support information you can start the collection wizard.


When you first start the collection wizard it will ask you to define the scope. I can strongly recommend to do this as this will decrease the size of your log package dramatically. In case you have an error with a certain job, pick the job that is having troubles:


Next step is the Data range. Again limit the amount of days. I would suggest not only including the days with errors but at least to include one day where the job ran successful. This way you can show that the job has ran successfully in the past.


Now just enter a location where you want to save your logs:


In the last step the logs are collected:


Once it is done, you can click the open folder to find your logs:



If the log bundle is smaller then 15 MB you can upload it while opening the call. If the log is bigger there are a couple of things you can do:
  • Just try to upload it during opening the call but you might experience http timeouts. While writing the article I was able to upload a file of 22MB but this really depends on your connection.
  • Don't upload any logs but ask support for an FTP link to transfer your logs when you open the call
  • Open up the log bundle and only upload specific logs. Alternatively split the logs in multiple zip files.

Who is the license owner

I often get the question, which login should I use to open the call. I can recommend to check the license owner and use his account as your support will be associated with it. If you can't find the login you can create a new account and just open a call. Then refer to the license owner so that support can validate your support information.  To find the person who is associated with your license just go to the main menu and click "about" under help.

In the licensee field you see the email address associated with it. Also it might also be a good time to write down the version number you are running, in this case Version : 7.0.764

Alternatively you can find the name by going to the main menu and clicking support information but this won't show the actual email address.

Opening the call

Opening the call can be done via the phone, but actually I prefer to do it via the web portal because it allows you to add additional information or to follow up the status.

First of all you should go to the support portal and sign in with the license owner account or create a new account. The portal can be found here:

Once you log in, validate that your contact details are correct so that support will be able to contact you successfully. You can do this by clicking edit profile in the right column:

Then on the next page you will be able to edit the email address or you phone number. Please double check before you start the process of opening a call.


Once you are happy with the contact detail, just click get support button. It will take you back to the main page where you will be able to click the open ticket button. You can also select the right product directly by clicking "open ticket" next to the licenses you have listed below.


First step is to fill in a title and describe the problem you have. Please also select the correct area where you are living and the severity. You can see response time associated with the severity in the right column.


Now select the product you are having problems with

Then select the version number. You can find the version number in the about window. Check the "who is license owner" if you can't find the about window. I always select English support but there are some other languages available as well. However if you don't mind English, it is good to understand that there are more technical people speaking English then any other languages. Then click next

The portal will now suggest some knowledge base articles. Please consider them. If nothing useful is there, click continue
Now you can attach your logs. First select the kind of issue you have. It will then suggest you to upload the correct/related log files. If your log bundle is big, you could opt to extract the specific file(s) and upload only the suggested log(s). I like to send the bundle because then support will have all the info at once. So select your log/bundle

Once you selected the logs, don't forget to click the upload button. I have made this mistake (not doing it) a hundred times. If you click next without doing it will just tell you that you haven't attached any logs and will ask you that you are sure you want to proceed

Once the logs are successfully submitted you will see the file appear in the uploaded file list

Then click next or upload additional log files. You will get a summary. Validate the fields and push the submit button to open a call.

You should receive a mail now with your ticket details and your call should be open. You should also see it in your support dashboard



Adding extra notes and viewing the status

If you want add additional notes, you can do this via the support dashboard

Just go to the open cases tab at the button and click details next to your ticket
In the next window you should be able to add more details. Also you will be able to follow the status of your case


Escalating the problem

Not a lot of people seem to know this but you can actually escalate a problem yourself. Only do it when you feel it is really necessary. First of all you can request and update via the web portal. Just click request update next to your call

You can also call support. Before you do it, first write the case number. To find the case number, again look at your open case.

Then click the phone support button to find the number you can call for your country


Finally if you feel like support is not helping you can escalate the problem to the support manager. Refer to your case number when contacting the support manager. By clicking the "Talk to a manager" button, your email client should open, creating a new email to the support manager distribution list.