PowerShell script exchange
Post Reply
tomcec
Novice
Posts: 4
Liked: never
Joined: Feb 20, 2012 11:00 am
Full Name: Tommaso Cecchi
Contact:

Windows PS and veeampssnapin discrepancies

Post by tomcec »

Hello, I am trying to automate a sort of check about wich VMs has been backed up in the last 24h. The point is that I have a different output from commands when I invoke them inside powershell launched from veeam console and when I invoke them from a Windows Powershell. Here is what I get when I run it from Veeam PS:

Code: Select all

PS C:\Users\veeamservice> get-vbrjob -name Job_SCSI0

Job Name                  Type            State      Last Result  Description
--------                  ----            -----      -----------  -----------
Job_SCSI0                 VMware Backup   Stopped    Warning      Created by VEEAMBS01\veeamservice at 2/3/2012 3:40:46
and the more verbose output when I run it from windows PS:

Code: Select all

PS C:\Users\tcecchi> Add-PSSnapin VeeamPSSnapIn
PS C:\Users\tcecchi> get-vbrjob -name Job_SCSI0


Id                     : e3d479b5-f69e-4e84-bf5f-05008703616c
Info                   : Veeam.Backup.Model.CDbBackupJobInfo
JobType                : Backup
SourceType             : VDDK
JobTargetType          : Backup
TargetType             : Other
TypeToString           : VMware Backup
Description            : Created by VEEAMBS01\veeamservice at 2/3/2012 3:40:46 PM.
Name                   : Job_SCSI0
BackupPlatform         : EVmware
TargetHostId           : 342c62a6-a28e-437d-aace-6a70409b9b05
TargetDir              : F:\rep02
TargetFile             : Job_SCSI0
Options                : Veeam.Backup.Model.CJobOptions
IsContinuous           : False
HvReplicaTargetOptions : Veeam.Backup.Model.CDomHvReplicaTargetOptions
BackupStorageOptions   : Veeam.Backup.Model.CDomBackupStorageOptions
BackupTargetOptions    : Veeam.Backup.Model.CDomBackupTargetOptions
HvSourceOptions        : Veeam.Backup.Model.CDomHvSourceOptions
JobOptions             : Veeam.Backup.Model.CDomJobOptions
NotificationOptions    : Veeam.Backup.Model.CDomNotificationOptions
PostJobCommand         : Veeam.Backup.Model.CDomPostJobCommand
ViReplicaTargetOptions : Veeam.Backup.Model.CDomViReplicaTargetOptions
ViSourceOptions        : Veeam.Backup.Model.CDomViSourceOptions
VssOptions             : <CVssOptions><Enabled>True</Enabled><IgnoreErrors>False</IgnoreErrors><GuestFSIndexingType>Non
                         e</GuestFSIndexingType><Credentials><UserName>veeamservice</UserName><Password>AQAAANCMnd8BFdE
                         RjHoAwE/Cl+sBAAAAjH89M7Pb6E+zLIKW9sKF6QQAAAACAAAAAAAQZgAAAAEAACAAAAAw1dLIcPIz7ERXl8e0kAYI4b2iH
                         xyXJ2Z3au2u/XhEywAAAAAOgAAAAAIAACAAAADKh+WtLsEkArKy6Oj+pVWDg8T453++6JOOUAgvGDNLhRAAAAB4ty8upJ/
                         y/v4ZnNCrs6ebQAAAAJ2niOGmi2tVK8IYpN74omPstw96bxfu9lHQ/TjR2BN9AjXB0eK+CKe9LpFIKpzTJ7w2CF4MO/fW6
                         KMtXjDS8Aw=</Password><IsLocalProtect>True</IsLocalProtect><CurrentUser>False</CurrentUser></C
                         redentials><TransactionLogsTruncation>OnlyOnSuccessJob</TransactionLogsTruncation><IsFirstUsag
                         e>True</IsFirstUsage><IncludedIndexingFolders /><ExcludedIndexingFolders><string>%windir%</str
                         ing><string>%ProgramFiles%</string><string>%TEMP%</string></ExcludedIndexingFolders></CVssOpti
                         ons>
ScheduleOptions        : Start time: [2/3/2012 10:00:00 PM], Latest run time: [3/14/2012 10:00:09 PM], Next run time: [
                         03/15/2012 22:00:00], Daily options: [Enabled: True, DayNumberInMonth: Everyday, Days: Sunday,
                          Monday, Tuesday, Wednesday, Thursday, Friday, Saturday]Monthly options: [Enabled: False, Time
                         : 2/3/2012 10:00:00 PM, Day Number In Month: Fourth, Day Of Week: Saturday, Months: January, F
                         ebruary, March, April, May, June, July, August, September, October, November, December]Periodi
                         cally options: [Enabled: False, Period: 1 hour(s), ScheduleString: <scheduler><Sunday>0,0,0,0,
                         0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Sunday><Monday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
                         0,0,0,0,0</Monday><Tuesday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Tuesday><Wednesday
                         >0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Wednesday><Thursday>0,0,0,0,0,0,0,0,0,0,0,0,
                         0,0,0,0,0,0,0,0,0,0,0,0</Thursday><Friday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Fri
                         day><Saturday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Saturday></scheduler>]Continuou
                         s options: [Enabled: False]
IsScheduleEnabled      : True
IsInitialReplica       : False
IsBackup               : True
IsSnapshotReplica      : False
IsLegacyReplica        : False
IsReplica              : False
IsVmCopy               : False
Do you know how I can have the same output. I am trying to automate this so I am going to put this commands in a .bat file where I will load the veeam snapin and I want to have the "standard veeam output" in this environment as well.

Thanks for your help.

Tommaso
ThomasMc
Veteran
Posts: 293
Liked: 19 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: Windows PS and veeampssnapin discrepancies

Post by ThomasMc »

You can format the output like so

Code: Select all

Get-VBRJob -Name "Job Name" | Select @{Name="Job Name"; Expression = {$_.Name}},
@{Name="Type"; Expression = {$_.JobType}}, @{Name="State"; Expression = {$_.GetLastState()}},
@{Name="Last Result"; Expression = {$_.Info.LatestStatus}}, Description | ft -AutoSize
tomcec
Novice
Posts: 4
Liked: never
Joined: Feb 20, 2012 11:00 am
Full Name: Tommaso Cecchi
Contact:

Re: Windows PS and veeampssnapin discrepancies

Post by tomcec »

Just the command I was looking for. Thanks Thomas for you response.

Tommaso
ThomasMc
Veteran
Posts: 293
Liked: 19 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: Windows PS and veeampssnapin discrepancies

Post by ThomasMc »

No probs Tommaso :)
Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests