For those of us who use Symantec Backup Exec in our datacenters, there has recently been a revolutionary breakthrough: the 2012 version adds Windows PowerShell support via a BEMCLI PowerShell module.

This blog is not meant to be a deep dive into Windows PowerShell or Backup Exec. I am going to walk you through how to perform some basic Backup Exec tasks with Windows PowerShell to give you an idea about how easy it is to manage without a GUI. You will see me pipe the output of several commands to the Select-Object cmdlet and others to the Out-Null cmdlet to reduce the number of items that are returned or to eliminate the output all together. By default, many of these cmdlets return a lot of items, which makes them output a list instead of a table.

Run an inventory to discover what backup tapes are in the tape drives:

Get-BETapeDriveDevice |

Submit-BEInventoryJob |

select Name, JobType, Schedule, Storage |

ft –auto

When the inventory completes, use the Get-BETapeDriveDevice cmdlet to retrieve the name of the backup tape in each tape drive. This cmdlet doesn’t return the media (tape) name by default.

Get-BETapeDriveDevice |

select Name, Media |

ft –auto

Perform a quick erase on the backup tape in each of the tape drives:

Get-BETapeDriveDevice |

Submit-BEEraseMediaJob |

select Name, JobType, Status, Schedule |

ft -auto

The following command starts both of the overwrite jobs that I’ve defined, which overwrites the backup tape in each tape drive. The Start-BEJob cmdlet doesn’t support wildcard characters, but you can use them with the Get-BEJob cmdlet and then pipe that cmdlet to Start-BEJob.

Get-BEJob -Name "o*" |

Start-BEJob |

Out-Null

Get a list of the backup jobs that failed with a status of error in the past 12 hours:

The Help that is provided with the cmdlets in this module is very thorough. All of the valid values for parameters such as the JobStatus parameter that I used in the previous command are listed in the Help:

help Get-BEJobHistory –Parameter JobStatus

Re-run the backup jobs that failed due to a status of error in the past 12 hours:

The Get-BEActiveJobDetail cmdlet returns a list of the backup jobs that are currently active (running), but I prefer to use the Get-BEJob cmdlet for this. I’ve included the jobs that have a status of “Ready”, which are waiting for a storage (backup) device to become available. If these backup jobs were being backed up to the tapes drives, the storage column would contain the tape drive name.

Get-BEJob -Status “Active”, “Ready” |

select Storage, Name, JobType, Status |

ft -auto

Cancel all of the active backup jobs:

Get-BEJob -Status "Active" |

Stop-BEJob |

ft –auto

Eject the backup tape from each of the tape drives:

Get-BETapeDriveDevice |

Submit-BEEjectMediaJob |

Out-Null

If you experience any issues getting the BEMCLI PowerShell module up and running, see the following blog that I wrote about a month ago; it covers a few issues I ran into:

Windows PowerShell is quickly becoming an essential skill for IT Pros and a required product feature for IT vendors. It’s something that can be used to manage almost everything in your datacenter from a backup product (as shown in this blog) to a storage area network.

Great Stuff. Any idea how I would go about deleting B2D Backup Sets with PS. I am in a situation where I need to delete some backup sets from my disk storage and deleting them manually is very time consuming.