Get-BEJob substatus (and other properties)
The following blog entry was originally posted as a reply to a comment here on SymConnect. The techniques demonstrated here are useful in virtually any PowerShell session, so I've reposted it here for the BEMCLI community:
With PowerShell, developers can provide a default 'view' for the format-list and format-table cmdlets. BEMCLI does this a lot -- only the most important/common properties of BEMCLI objects are shown automatically.
BEMCLI> get-bejob Name : KIRKF-OFFICE.hro.rnd.veritas.com Backup 00010-Full JobType : Backup TaskType : Full TaskName : Full IsActive : False Status : Scheduled SubStatus : Ok SelectionSummary : Fully selected Storage : Any disk storage Schedule : Friday every 1 week(s) at 11:00 PM effective on 6/18/2012. IsBackupDefinitionJob : True Name : KIRKF-OFFICE.hro.rnd.veritas.com Backup 00010-Incremental JobType : Backup TaskType : Incremental TaskName : Incremental IsActive : False Status : Scheduled SubStatus : Ok SelectionSummary : Fully selected Storage : Any disk storage Schedule : Every 1 day(s) at 11:00 PM effective on 6/18/2012. IsBackupDefinitionJob : True
To see the rest of the properties, you can use the Format-List * syntax:
BEMCLI> get-bejob | format-list * Name : KIRKF-OFFICE.hro.rnd.veritas.com Backup 00010-Full Id : 9a7f78fa-e622-47bf-a867-afc37ab9619a TaskName : Full IsActive : False Status : Scheduled SubStatus : Ok JobType : Backup TaskType : Full Schedule : Friday every 1 week(s) at 11:00 PM effective on 6/18/2012. SelectionSummary : Fully selected NextStartDate : 6/22/2012 11:00:00 PM Priority : Normal Storage : Any disk storage StorageId : 00000006-0001-0000-0000-000000000000 KeepDiskDataFor : 14.00:00:00 MediaSet : MediaSetId : 00000009-03eb-0000-0000-000000000000 MediaVault : MediaVaultId : 00000000-0000-0000-0000-000000000000 IsBackupDefinitionJob : True BackupDefinition : KIRKF-OFFICE.hro.rnd.veritas.com Backup 00010 BackupDefinitionId : fb199c4a-70e1-4ca1-b613-7b6cd6d4240d AgentServer : KIRKF-OFFICE.hro.rnd.veritas.com AgentServerId : 3423e496-04de-4e69-996c-23735b3a1364 BackupExecServer : BackupExecServerId : 00000000-0000-0000-0000-000000000000 SupersedingJob : SupersedingJobId : 00000000-0000-0000-0000-000000000000 Name : KIRKF-OFFICE.hro.rnd.veritas.com Backup 00010-Incremental Id : 757b69af-82fd-4468-bf21-4d9087de20bf TaskName : Incremental IsActive : False Status : Scheduled SubStatus : Ok JobType : Backup TaskType : Incremental Schedule : Every 1 day(s) at 11:00 PM effective on 6/18/2012. SelectionSummary : Fully selected NextStartDate : 6/22/2012 11:00:00 PM Priority : Normal Storage : Any disk storage StorageId : 00000006-0001-0000-0000-000000000000 KeepDiskDataFor : 7.00:00:00 MediaSet : MediaSetId : 00000009-03eb-0000-0000-000000000000 MediaVault : MediaVaultId : 00000000-0000-0000-0000-000000000000 IsBackupDefinitionJob : True BackupDefinition : KIRKF-OFFICE.hro.rnd.veritas.com Backup 00010 BackupDefinitionId : fb199c4a-70e1-4ca1-b613-7b6cd6d4240d AgentServer : KIRKF-OFFICE.hro.rnd.veritas.com AgentServerId : 3423e496-04de-4e69-996c-23735b3a1364 BackupExecServer : BackupExecServerId : 00000000-0000-0000-0000-000000000000 SupersedingJob : SupersedingJobId : 00000000-0000-0000-0000-000000000000
You can see the "SubStatus" field. Let's probe that a bit:
BEMCLI> get-bejob | Get-Member SubStatus TypeName: BackupExec.Management.CLI.BEJob Name MemberType Definition ---- ---------- ---------- SubStatus Property BackupExec.Management.CLI.BEJobSubStatus SubStatus {get;}
You can see here that the SubStatus is of type "BackupExec.Management.CLI.BEJobSubStatus". That's an enumeration value; where possible, BEMCLI uses enumerations ("enums") so you can discover the complete set of possible values. You use the "[enum]::GetValues()" function to do that:
BEMCLI> [enum]::GetValues("BackupExec.Management.CLI.BEJobSubStatus") Unknown Ok InternalError InvalidInput InvalidStorageDevice InvalidJob DestinationCannotBeABackupExecServer StorageCannotBeStorageDevicePool NoBackupExecServersAvailable NotReadyDiscoveringStorageDevices IncompatibleResumes ServerLicenseNotAvailable MultiServerLicenseNotAvailable AdvancedOpenFileOptionLicenseNotAvailable SqlAgentLicenseNotAvailable ExchangeAgentLicenseNotAvailable Windows2000LicenseNotAvailable NetwareLicenseNotAvailable NoWindowsNT4Server NoWindows2000Server NoNetwareServer LocalBackupExecServerRequired LotusNotesLicenseNotAvailable OracleAgentLicenseNotAvailable LotusDominoAgentLicenseNotAvailable SharepointAgentLicenseNotAvailable NoServersInBackupExecServerPool LocalServerNotBackupExecServer DestinationServerNotInBackupExecServerPool StorageDeviceNotOnLocalBackupExecServer StorageNotConfiguredForBackupExecServer UnixAgentLicenseNotAvailable MacintoshAgentLicenseNotAvailable NoIdleDevicesAvailable CascadedPoolNotAllowed CascadedPoolIsEmpty StorageDevicePoolIsEmpty NoDevicesInCascadedPoolAreAvailable NoEligibleDevicesAvailableInStorageDevicePool WillRunAfterBlockingJobCompletes JobQueueOnHold BackupExecServerNotAvailable OracleOnLinuxAgentLicenseNotAvailable BlockedByActiveLinkedJob DB2AgentLicenseNotAvailable MicrosoftVirtualServerAgentLicenseNotAvailable VMwareAgentLicenseNotAvailable NoBackupExecServersWithDeduplicationOptionLicenseAvailable No64BitBackupExecServersAvailableForExchangeResources BackupExecArchivingOptionLicenseNotAvailable EnterpriseVaultLicenseNotAvailable StorageCannotBeVault StorageCannotBeStorageArray InvalidManagedBackupExecServer NoIdleDevicesOnTargetBackupExecServerAvailable NoIdleDeviceInStoragePoolAvailable NoCompatibleBackupExecServersAvailable StorageRequiresRestrictedSelection PreferredBackupExecCatalogServerNotAvailable
PowerShell can help work around filtering limitations of cmdlets by using the "Where-Object" and filtering the complete list of objects the "Get-" cmdlet outputs.
Here's a demo of filtering jobs by substatus -- first the jobs whose substatus is NOT "Ok", then those with an "Ok" substatus:
BEMCLI> Get-BEJob | Where-Object { $_.SubStatus -ne "Ok" } BEMCLI> Get-BEJob | Where-Object { $_.SubStatus -eq "Ok" } Name : KIRKF-OFFICE.hro.rnd.veritas.com Backup 00010-Full JobType : Backup TaskType : Full TaskName : Full IsActive : False Status : Scheduled SubStatus : Ok SelectionSummary : Fully selected Storage : Any disk storage Schedule : Friday every 1 week(s) at 11:00 PM effective on 6/18/2012. IsBackupDefinitionJob : True Name : KIRKF-OFFICE.hro.rnd.veritas.com Backup 00010-Incremental JobType : Backup TaskType : Incremental TaskName : Incremental IsActive : False Status : Scheduled SubStatus : Ok SelectionSummary : Fully selected Storage : Any disk storage Schedule : Every 1 day(s) at 11:00 PM effective on 6/18/2012. IsBackupDefinitionJob : True
All two of my jobs are "Ok" so far -- the first pipeline correctly returned zero jobs, the second returned both.
-Kirk out.