Code: Select all
PS C:\Users\administrator> $PSVersionTable.PsVersion
Major Minor Build Revision
----- ----- ----- --------
3 0 -1 -1
Code: Select all
$Uri = "http://" + $ExternalHost + ":5985"
$username = $Domain + "\********"
# Setup and start remote session
$pw = convertto-securestring -AsPlainText -Force -String "********"
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $pw
$session = new-pssession -ConnectionUri $Uri -credential $cred
$report = Invoke-Command -Session $session -ScriptBlock {
Add-PSSnapin -Name VeeamPSSnapIn -WarningAction SilentlyContinue -ErrorAction SilentlyContinue
$sessionVMSummary = @()
get-vbrjob | foreach{
$session = $_.findlastsession();
if (($session -ne $NULL) -and ($_.isScheduleEnabled -eq $TRUE)) {
$Info = [Veeam.Backup.Core.CBackupTaskSession]::GetByJobSession($session.id) | select -Property ObjectName, Reason, QueuedTime, Status
$sessionDocument = New-Object PSObject -Property @{
"Name" = $session.Name
"Result" = $session.Result
"CreationTime" = $session.CreationTime
"EndTime" = $session.EndTime
"JobType" = $session.JobType
"ObjectStatus" = $Info
}
$sessionVMSummary += $sessionDocument
}
}
return $sessionVMSummary
}
Code: Select all
"WARNING: You should update your PowerShell to PowerShell 2.0 version. <== I NEED TO GET RID OF THIS WARNING MESSAGE
[
{
"Name": ********,
"CreationTime": "\/Date(1402290392717)\/",
"ObjectStatus": {
"ObjectName": ********,
"Reason": "",
"QueuedTime": "\/Date(1402290405917)\/",
"Status": {
"value": 0,
"Value": "Success"
}
},
"Result": {
"value": 0,
"Value": "Success"
},
"EndTime": "\/Date(1402291286497)\/",
"JobType": {
"value": 0,
"Value": "Backup"
},
"PSComputerName": ********,
"RunspaceId": "ad3ea82d-48dd-4135-9648-8bf3bba75e46",
"PSShowComputerName": true
}
]
"
thanks