{"id":9241,"date":"2012-06-02T00:01:00","date_gmt":"2012-06-02T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2012\/06\/02\/weekend-scripter-managing-symantec-backup-exec-2012-with-powershell\/"},"modified":"2012-06-02T00:01:00","modified_gmt":"2012-06-02T00:01:00","slug":"weekend-scripter-managing-symantec-backup-exec-2012-with-powershell","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/weekend-scripter-managing-symantec-backup-exec-2012-with-powershell\/","title":{"rendered":"Weekend Scripter: Managing Symantec Backup Exec 2012 with PowerShell"},"content":{"rendered":"<p><b>Summary<\/b>: Guest blogger, Mike F. Robbins, shows how to use Windows PowerShell to work with Backup Exec.<\/p>\n<p>Microsoft Scripting Guy, Ed Wilson, is here. Today we have a new guest blogger, Mike F. Robbins. In this blog, Mike illustrates Windows PowerShell techniques for working with Symantec&rsquo;s Backup Exec product.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/4456.wes-6-2-12-1.jpg\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/4456.wes-6-2-12-1.jpg\" alt=\"Photo of Mike F Robbins\" \/><\/a><\/p>\n<p style=\"padding-left: 30px\">Mike F. Robbins is an MCITP | Windows PowerShell enthusiast | IT Pro | senior systems engineer who has worked on Windows Server, Hyper-V, SQL Server, Exchange Server, SharePoint, Active Directory, and EqualLogic storage area networks. He has over eighteen years of professional experience providing enterprise computing solutions for educational, financial, healthcare, and manufacturing customers.<\/p>\n<p style=\"padding-left: 30px\">Blog: <a href=\"http:\/\/mikefrobbins.com\/\" target=\"_blank\">http:\/\/mikefrobbins.com<\/a><\/p>\n<p style=\"padding-left: 30px\">Twitter: <a href=\"https:\/\/twitter.com\/mikefrobbins\" target=\"_blank\">@mikefrobbins<\/a><\/p>\n<p>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.<\/p>\n<p>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 <b>Select-Object<\/b> cmdlet and others to the <b>Out-Null<\/b> 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.<\/p>\n<p>Run an inventory to discover what backup tapes are in the tape drives:<\/p>\n<p style=\"padding-left: 30px\">Get-BETapeDriveDevice |<\/p>\n<p style=\"padding-left: 30px\">Submit-BEInventoryJob |<\/p>\n<p style=\"padding-left: 30px\">select Name, JobType, Schedule, Storage |<\/p>\n<p style=\"padding-left: 30px\">ft &ndash;auto<\/p>\n<p style=\"padding-left: 30px\"><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/8867.wes-6-2-12-2.jpg\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/8867.wes-6-2-12-2.jpg\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<\/p>\n<p>When the inventory completes, use the <b>Get-BETapeDriveDevice<\/b> cmdlet to retrieve the name of the backup tape in each tape drive. This cmdlet doesn&rsquo;t return the media (tape) name by default.<\/p>\n<p style=\"padding-left: 30px\">Get-BETapeDriveDevice |<\/p>\n<p style=\"padding-left: 30px\">select Name, Media |<\/p>\n<p style=\"padding-left: 30px\">ft &ndash;auto<\/p>\n<p style=\"padding-left: 30px\"><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/8686.wes-6-2-12-3.jpg\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/8686.wes-6-2-12-3.jpg\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<\/p>\n<p>Perform a quick erase on the backup tape in each of the tape drives:<\/p>\n<p style=\"padding-left: 30px\">Get-BETapeDriveDevice |<\/p>\n<p style=\"padding-left: 30px\">Submit-BEEraseMediaJob |<\/p>\n<p style=\"padding-left: 30px\">select Name, JobType, Status, Schedule |<\/p>\n<p style=\"padding-left: 30px\">ft -auto<\/p>\n<p style=\"padding-left: 30px\"><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/0218.wes-6-2-12-4.jpg\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/0218.wes-6-2-12-4.jpg\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<\/p>\n<p>The following command starts both of the overwrite jobs that I&rsquo;ve defined, which overwrites the backup tape in each tape drive. The <b>Start-BEJob<\/b> cmdlet doesn&rsquo;t support wildcard characters, but you can use them with the <b>Get-BEJob<\/b> cmdlet and then pipe that cmdlet to <b>Start-BEJob<\/b>.<\/p>\n<p style=\"padding-left: 30px\">Get-BEJob -Name &#8220;o*&#8221; |<\/p>\n<p style=\"padding-left: 30px\">Start-BEJob |<\/p>\n<p style=\"padding-left: 30px\">Out-Null<\/p>\n<p style=\"padding-left: 30px\"><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/8468.wes-6-2-12-5.jpg\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/8468.wes-6-2-12-5.jpg\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>Get a list of the backup jobs that failed with a status of <b>error<\/b> in the past 12 hours:<\/p>\n<p style=\"padding-left: 30px\">Get-BEJobHistory -JobStatus Error -FromStartTime (Get-Date).AddHours(-12) |<\/p>\n<p style=\"padding-left: 30px\">ft -auto<\/p>\n<p style=\"padding-left: 30px\"><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/8688.wes-6-2-12-6.jpg\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/8688.wes-6-2-12-6.jpg\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>The Help that is provided with the cmdlets in this module is very thorough. All of the valid values for parameters such as the <i>JobStatus<\/i> parameter that I used in the previous command are listed in the Help:<\/p>\n<p style=\"padding-left: 30px\">help Get-BEJobHistory &ndash;Parameter JobStatus<\/p>\n<p style=\"padding-left: 30px\"><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/6116.wes-6-2-12-7.jpg\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/6116.wes-6-2-12-7.jpg\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>Re-run the backup jobs that failed due to a status of <b>error<\/b> in the past 12 hours:<\/p>\n<p style=\"padding-left: 30px\">Get-BEJob -Name (Get-BEJobHistory -JobStatus Error -FromStartTime (Get-Date).AddHours(-12) |<\/p>\n<p style=\"padding-left: 30px\">select -expand name) |<\/p>\n<p style=\"padding-left: 30px\">Start-BEJob |<\/p>\n<p style=\"padding-left: 30px\">Out-Null<\/p>\n<p style=\"padding-left: 30px\"><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/6740.wes-6-2-12-8.jpg\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/6740.wes-6-2-12-8.jpg\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>The <b>Get-BEActiveJobDetail<\/b> cmdlet returns a list of the backup jobs that are currently active (running), but I prefer to use the <b>Get-BEJob<\/b> cmdlet for this. I&rsquo;ve included the jobs that have a status of &ldquo;Ready&rdquo;, 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.<\/p>\n<p style=\"padding-left: 30px\">Get-BEJob -Status &ldquo;Active&rdquo;, &ldquo;Ready&rdquo; |<\/p>\n<p style=\"padding-left: 30px\">select Storage, Name, JobType, Status |<\/p>\n<p style=\"padding-left: 30px\">ft -auto<\/p>\n<p style=\"padding-left: 30px\"><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/8371.RobbinsB.JPG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/8371.RobbinsB.JPG\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>Cancel all of the active backup jobs:<\/p>\n<p style=\"padding-left: 30px\">Get-BEJob -Status &#8220;Active&#8221; |<\/p>\n<p style=\"padding-left: 30px\">Stop-BEJob |<\/p>\n<p style=\"padding-left: 30px\">ft &ndash;auto<\/p>\n<p style=\"padding-left: 30px\"><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/7652.wes-6-2-12-9.jpg\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/7652.wes-6-2-12-9.jpg\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>Eject the backup tape from each of the tape drives:<\/p>\n<p style=\"padding-left: 30px\">Get-BETapeDriveDevice |<\/p>\n<p style=\"padding-left: 30px\">Submit-BEEjectMediaJob |<\/p>\n<p style=\"padding-left: 30px\">Out-Null<\/p>\n<p style=\"padding-left: 30px\"><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/0216.wes-6-2-12-10.jpg\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/0216.wes-6-2-12-10.jpg\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>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:<\/p>\n<p style=\"padding-left: 30px\"><a href=\"http:\/\/mikefrobbins.com\/2012\/05\/08\/symantec-backup-exec-2012-adds-powershell-support\/\" target=\"_blank\">Symantec Backup Exec 2012 Adds PowerShell Support!<\/a><\/p>\n<p>Want to learn more about the Symantec Backup Exec BEMCLI PowerShell module? Download the Help file:<\/p>\n<p style=\"padding-left: 30px\"><a href=\"http:\/\/www.symantec.com\/business\/support\/index?page=content&amp;id=DOC5438\" target=\"_blank\">Backup Exec 2012 Management Command Line Interface (BEMCLI) Documentation<\/a><\/p>\n<p>Windows PowerShell is quickly becoming an essential skill for IT Pros and a required product feature for IT vendors. It&rsquo;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.<\/p>\n<p>The script for this blog can be seen and downloaded from the <a href=\"http:\/\/gallery.technet.microsoft.com\/scriptcenter\/Managing-Symantec-Backup-cb9868fe\" target=\"_blank\">Script Repository<\/a>.<\/p>\n<p>~Mike<\/p>\n<p>Thank you, Mike, for sharing your blog and your time. It is cool to see how to use basic Windows PowerShell techniques while working with other products.<\/p>\n<p>I invite you to follow me on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\" target=\"_blank\">Facebook<\/a>. If you have any questions, send email to me at <a href=\"mailto:scripter@microsoft.com\" target=\"_blank\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\">Official Scripting Guys Forum<\/a>. See you tomorrow. Until then, peace.<\/p>\n<p><b>Ed Wilson, Microsoft Scripting Guy<\/b>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Guest blogger, Mike F. Robbins, shows how to use Windows PowerShell to work with Backup Exec. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a new guest blogger, Mike F. Robbins. In this blog, Mike illustrates Windows PowerShell techniques for working with Symantec&rsquo;s Backup Exec product. Mike F. Robbins is an MCITP [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[343,51,56,344,3,61,45],"class_list":["post-9241","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-backup","tag-getting-started","tag-guest-blogger","tag-mike-f-robbins","tag-scripting-guy","tag-weekend-scripter","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Guest blogger, Mike F. Robbins, shows how to use Windows PowerShell to work with Backup Exec. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a new guest blogger, Mike F. Robbins. In this blog, Mike illustrates Windows PowerShell techniques for working with Symantec&rsquo;s Backup Exec product. Mike F. Robbins is an MCITP [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/9241","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=9241"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/9241\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=9241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=9241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=9241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}