Code: Select all
$parentPid = (Get-WmiObject Win32_Process -Filter "processid='$scriptPid'").parentprocessid.ToString()
$parentCmd = (Get-WmiObject Win32_Process -Filter "processid='$parentPid'").CommandLine
$parentCmdArgs = $parentCmd.Replace('" "','","').Replace('"','').Split(',')
$currentJobSessionGUID = $parentCmdArgs[-1]
$currentJobSession = [Veeam.Backup.Core.CBackupSession]::GetByOriginalSessionId($currentJobSessionGUID) | Select-Object -Last 1
>> TerminatingError(): "Unable to find type [Veeam.Backup.Core.CBackupSession]."
**********************
When i run directly in the powershell terminal on the same system, it works.
Code: Select all
PS C:\Scripts> $session=[Veeam.Backup.Core.CBackupSession]::GetByOriginalSessionId("c0f80ec7-1294-4d8b-8003-c50c4dc69e3b") | Select-Object -Last 1
PS C:\Scripts> $session
Job Name State Start Time End Time Result
-------- ----- ---------- -------- ------
Backup Job 20 (In... Stopped 5/28/2024 6:41:28 AM 5/28/2024 6:42:32 AM Warning
PS C:\Scripts>
Thanks & regards,
Neelakantan K.