Backup Exec 2012 ships with a new PowerShell module called BEMCLI. I lead the development of BEMCLI, and am very excited about its role in making your Backup Exec tasks more automated and easier to manage.
30,000 foot view of PowerShell and BEMCLI in 30 seconds
PowerShell is an automation technology. PowerShell contains a language. The interface you'll start using PowerShell from is a command window, but it can also be scripted.
PowerShell commands are called "cmdlets".
Developers can write and package custom cmdlets that plug into PowerShell. Such packages of cmdlets are called "Modules" and that's what BEMCLI is: a PowerShell module.
There are three main categories of PowerShell cmdlets:
- Get objects. The topic of today's blog post.
- Do work -- create, change, delete objects.
- Filter or format output PowerShell provides plenty of support for this area. In later blog entries, I'll show useful examples of them.
Learning PowerShell is an investment, but it's an investment that pays. I just got back from TechEd 2012 in Orlando, and Microsoft's commitment to the technology is unquestionable: everything in Windows Server 2012 supports PowerShell, and the audiences at every PowerShell session were very enthusiastic.
OK, maybe that's more than 30 seconds, but you get the point: PowerShell + BEMCLI is powerful glue for plugging Backup Exec into your workflows and automation.
Getting Backup Exec objects using BEMCLI
Want to get all of your Backup Exec jobs? Try:
How about getting alerts? You can probably guess:
That's the whole point of PowerShell's design: conventions. Cmdlets are named with the "Verb-Noun" pattern, and Microsoft publishes a list of approved Verbs.
BEMCLI provides the appropriate nouns, combines them with the appropriate verbs, and you have a very discoverable set of operations you can perform on the command-line or scripts.
The formula is:
So, if you want to "get" a "job" from Backup Exec, you can guess the command's name will be Get-BEJob. The "BE" prefix on the noun name is also a Microsoft convention for module developers to follow. Many products have "Jobs". Backup Exec makes "BEJobs", "BEAlerts", etc.
Getting online help
Back to jobs for a minute...want to see only your backup jobs? Easy:
Get-BEJob -JobType Backup
Want to know how you'd discover that "-JobType" parameter, and how to use it?
Complete help file:
help Get-BEJob -Full
Just the examples:
help Get-BEJob -examples
To see a list of all the "Get-" commands in the BEMCLI module:
Get-Command -Module BEMCLI -Verb Get
Of course, you can just see all of the BEMCLI commands via:
Get-Command -Module BEMCLI
Each of the BEMCLI commands is documented with at least one example, usually more than one.
I look forward to hearing from everyone out there using BEMCLI to automate the monitoring and management of their backups. Your feedback has a direct line to features and improvements.
Next time, I'll go into the second category of cmdlets: those that 'do work'. Stay tuned…