Backup Exec – TECH126877 – the device or media server cannot be deleted because existing jobs or selection lists remain

The Problem

Quite some time ago I wasn’t able to delete a device (storage target) named “internal RAID” in Backup Exec 15. The GUI came up with this error message:

“The device (or media server) cannot be deleted because existing jobs or selection lists remain.”

Going through all jobs in the GUI i could not find any with the storage as target of a backup job. Very strange …

The Google-Search

Firing up Google I found the technical article from Symantec Veritas TECH126877 suggesting to call the Symantec Support?!?!1

The solution

I could not believe this was the suggested way to remove a device from Backup Exec and by chance stumbled upon the “Backup Exec Management Command Line”-Tool.

windows-search-backup-exec

Firing it up welcomes you with the basic commands. Typing “Get-BECommand” gives you an overview of all available BackupExec commands.

backup-exec-management-command-line-interface

In this list I found the commands “Get-BEJob” and “Remove-BEJob”. So let’s check what we get if we run “Get-BEJob”.

backup-exec-management-command-line-interface-get-bejob

Great, we get an object which we can filter by “Storage”. So let’s see what “Remove-BEJob” takes as an input.

man-remove-bejob

I see, so I can pipe those objects from “Get-BEJob” to “Remove-BEJob”.

All it takes is to get all BackupExec jobs using “Get-BEJob”, filter those where the storage is “internal RAID” and pipe those objects to “Remove-BEJob”.

One can also add “-WhatIf” to see what it removes .. just to be sure ;)

remove-backup-exec-jobs-with-mapped-devices

Get-BEJob | where storage -eq "internal RAID" | Remove-BEJob

All it takes is a bit of PowerShell .. or one could of course call the Symantec/Veritas Support …

powershell – download file from server via https which has a self signed certificate

the problem:

when I was trying to “wget” a file using $webClient.DownloadFile from a server with a self signed certificate it failed when using the following code:

$webClient = new-object System.Net.WebClient
$webClient.DownloadFile( $url, $path )

 

powershell - download file from server via https which has a self signed certificate

the resource:

searching for a solution i stumpled upon http://blogs.technet.com/b/heyscriptingguy/archive/2010/07/25/windows-powershell-invalid-certificates-and-automated-downloading.aspx

there you will read that all it takes is to set the following just before you download the file …

[Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}

the solution:

the complete script then would be something like:

$url = "https://server/file.ext"
$path = "c:\downloads\file.ext"
[Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
$webClient = new-object System.Net.WebClient
$webClient.DownloadFile( $url, $path )