PowerShell script exchange
Post Reply
Posts: 11
Liked: never
Joined: Mar 17, 2021 3:22 am
Full Name: Donald Li

How to get Cloud Connect Backup session Task Name

Post by donaldli »

Case #04785594

As a service provider, I need to get Cloud Connect Backup session Task Name. Because I need these to identify which disks being hotadded to proxy are valid, which are added but not being released properly.

I know I can view Real-Time Statistics as instruced in following link.
https://helpcenter.veeam.com/docs/backu ... ml?ver=110
I need the apache02 in this image. However, I need to get this information through CLI, not the GUI.

I can use following API to get active sessions.

Code: Select all

[Veeam.Backup.Core.CCloudSession]::GetAll() | ?{$_.State -eq "Working"} 

I can see the properties and methods of this Type. But there is no tasks information. I also tried to further check details of the Logger and SessionInfo, still no tasks information.

The task name can be found in database from CloudTaskSession at column object_display_name. Is there any means to get it through PowerShell API?

Code: Select all

   TypeName: Veeam.Backup.Core.CCloudSession

Name                                     MemberType Definition
----                                     ---------- ----------
AbortSession                             Method     void AbortSession()
AddCloudSessionLog                       Method     void AddCloudSessionLog(System.Nullable[guid] originalClou...
AddCloudTaskSessionLog                   Method     void AddCloudTaskSessionLog(System.Nullable[guid] original...
AddErrorToLog                            Method     void AddErrorToLog(string message)
CalcBaseSessionResult                    Method     Veeam.Backup.Model.CBaseSessionInfo+EResult CalcBaseSessio...
CheckStop                                Method     void CheckStop(), void ISessionStopChecker.CheckStop()
Close                                    Method     void Close(Veeam.Backup.Model.CBaseSessionInfo+EResult suc...
CompleteBase                             Method     void CompleteBase()
CompleteWithFailure                      Method     void CompleteWithFailure()
CompleteWithResult                       Method     void CompleteWithResult(Veeam.Backup.Model.CBaseSessionInf...
CompleteWithSuccess                      Method     void CompleteWithSuccess()
CompleteWithWarning                      Method     void CompleteWithWarning()
Equals                                   Method     bool Equals(System.Object obj)
FindSessionStarterInfo                   Method     Veeam.Backup.Model.CSessionStarterInfo FindSessionStarterI...
GetFullLogsSubfolder                     Method     Veeam.Backup.Common.CPath GetFullLogsSubfolder(Params stri...
GetHashCode                              Method     int GetHashCode()
GetType                                  Method     type GetType()
HandleTenantSideException                Method     void HandleTenantSideException(System.Exception ex)
InitializeLogsSubFolder                  Method     void InitializeLogsSubFolder()
IsPersistent                             Method     bool IsPersistent()
IsSessionNotHeldByJobProcess             Method     bool IsSessionNotHeldByJobProcess()
IsStoped                                 Method     bool IsStoped([ref] string stopDetails), bool IsStoped([re...
LogAndSetOperation                       Method     void LogAndSetOperation(string format, Params string[] args)
NotifyCloud                              Method     void NotifyCloud(Veeam.Backup.Model.CSessionEventDescripto...
SaveBackupJobInfo                        Method     void SaveBackupJobInfo(bool isRequireRetry, bool isForever...
SetAuxData                               Method     void SetAuxData(string auxData)
SetAverageSpeed                          Method     void SetAverageSpeed(uint64 averageDataRate)
SetHardwareQuota                         Method     void SetHardwareQuota(Veeam.Backup.Core.IHardwareQuota har...
SetIsDisksProcessing                     Method     void SetIsDisksProcessing(bool isDisksProcessing)
SetLeaseId                               Method     void SetLeaseId(guid leaseId)
SetOperation                             Method     void SetOperation(string format, Params System.Object[] ar...
SetProgress                              Method     void SetProgress(int progress)
SetRepositoryQuotaIfNeeded               Method     void SetRepositoryQuotaIfNeeded(Veeam.Backup.Core.CTenantQ...
SetResult                                Method     void SetResult(Veeam.Backup.Model.CBaseSessionInfo+EResult...
SetSpec                                  Method     void SetSpec(string spec)
SetState                                 Method     void SetState(Veeam.Backup.Model.CBaseSessionInfo+EState s...
ToString                                 Method     string ToString()
TrySetStateStopping                      Method     bool TrySetStateStopping()
UpdateDataAmountsAndTransferRateIfNeeded Method     void UpdateDataAmountsAndTransferRateIfNeeded(uint64 sentT...
UpdateSessionStarterInfo                 Method     void UpdateSessionStarterInfo(Veeam.Backup.Model.CSessionS...
AuthenticatedUser                        Property   Veeam.Backup.Core.ICloudAuthenticatedUser AuthenticatedUse...
AuxData                                  Property   string AuxData {get;}
BaseProgress                             Property   int BaseProgress {get;}
CloudType                                Property   Veeam.Backup.Model.ECloudSessionType CloudType {get;}
CreationTime                             Property   datetime CreationTime {get;}
CreationTimeUTC                          Property   datetime CreationTimeUTC {get;}
Description                              Property   string Description {get;}
EndTime                                  Property   datetime EndTime {get;}
EndTimeUTC                               Property   datetime EndTimeUTC {get;}
Id                                       Property   guid Id {get;}
InstallationID                           Property   guid InstallationID {get;}
IsCompleted                              Property   bool IsCompleted {get;}
IsLowerAgentPriority                     Property   bool IsLowerAgentPriority {get;}
IsPostprocessing                         Property   bool IsPostprocessing {get;}
IsStarting                               Property   bool IsStarting {get;}
IsWorking                                Property   bool IsWorking {get;}
JobId                                    Property   guid JobId {get;}
JobName                                  Property   string JobName {get;}
JobSpec                                  Property   string JobSpec {get;}
JobType                                  Property   Veeam.Backup.Model.EDbJobType JobType {get;}
JobTypeString                            Property   string JobTypeString {get;}
LeaseId                                  Property   guid LeaseId {get;}
Logger                                   Property   Veeam.Backup.Core.IXmlLogger Logger {get;}
LogName                                  Property   string LogName {get;}
LogsSubFolder                            Property   string LogsSubFolder {get;}
Name                                     Property   string Name {get;}
Operation                                Property   string Operation {get;}
ProductId                                Property   System.Nullable[guid] ProductId {get;}
ProductVersion                           Property   version ProductVersion {get;}
Result                                   Property   Veeam.Backup.Model.CBaseSessionInfo+EResult Result {get;}
SessionInfo                              Property   Veeam.Backup.Model.CBaseSessionInfo SessionInfo {get;}
State                                    Property   Veeam.Backup.Model.CBaseSessionInfo+EState State {get;}
Tenant                                   Property   Veeam.Backup.Core.CCloudTenant Tenant {get;}
TenantName                               Property   string TenantName {get;}
Tracer                                   Property   Veeam.Backup.Core.ILogTracer Tracer {get;}

Veeam Software
Posts: 890
Liked: 318 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov

Re: How to get Cloud Connect Backup session Task Name

Post by oleg.feoktistov » 1 person likes this post

Hi Donald,

Unlike for cloud sessions, there is, indeed, no relevant classes for cloud task sessions implemented in Core namespace. I did a bit of research and managed to reverse engineer cloud task session info back to DBManager instance methods. Here is an interesting one:

Code: Select all

[Veeam.Backup.DbManager.CDbManager]::Instance.CloudTaskSession.GetCloudTaskSessionByUniqueCols(guid cloudSessionId, string objectId, string uniqueHash)
If I pass values from relevant columns in CloudTaskSession table as arguments to the method above, I'm able to obtain an instance of CDbCloudTaskSession class, which is unsupported, but still gives enough data to work with. However, even with cloudSessionId and objectId easily parsed, I couldn't figure out where to get uniqueHash value other than from copying it directly from CloudTaskSession table. I believe, it is somehow relevant to vCenter guid kept in CHost.Info.HostUniqueId property, but it has different format and length, so no luck here as well.

Anyway, I'll ask around internally if it is possible to get cloud task sessions from SP side through Powershell/.NET with another approach and what uniqueHash actually stands for.

Best regards,

Posts: 11
Liked: never
Joined: Mar 17, 2021 3:22 am
Full Name: Donald Li

Re: How to get Cloud Connect Backup session Task Name

Post by donaldli »

Thank you, Oleg!

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests