-
- Enthusiast
- Posts: 84
- Liked: 8 times
- Joined: Jul 04, 2012 6:32 am
- Full Name: Tobias Elfstrom
- Contact:
Enterprise Manager Powershell?
Hello.
Are there any powershell-hooks into Enterprise manager?
For example when you use Enterprise manager you can click on the "VMs" tab and get a very nice list of all backed up VM all your connected Veeam servers know about (see picture). I'd like to do this from powershell instead. That is get a a list of every VM with name, backup server, job name, restore points, location of the backup and the last date it run successfully.
I could probably go see what is happening on the SQL side of things and just do raw SQL queries to the Enterprise Manager Database but then if some future updates changes the Database scheme or whatever I will have to update my scripts..
BR Tobias
Are there any powershell-hooks into Enterprise manager?
For example when you use Enterprise manager you can click on the "VMs" tab and get a very nice list of all backed up VM all your connected Veeam servers know about (see picture). I'd like to do this from powershell instead. That is get a a list of every VM with name, backup server, job name, restore points, location of the backup and the last date it run successfully.
I could probably go see what is happening on the SQL side of things and just do raw SQL queries to the Enterprise Manager Database but then if some future updates changes the Database scheme or whatever I will have to update my scripts..
BR Tobias
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Enterprise Manager Powershell?
Unfortunately, there are none.Are there any powershell-hooks into Enterprise manager?
However, as far as I can understand, the following script should provide quite a similar view:
Code: Select all
asnp VeeamPSSnapin
Foreach ($Job in (Get-VBRJob | where {$_.JobType -eq "Backup"}))
{
Foreach ($VM in $Job.GetViOijs())
{
Get-VBRBackup -name $Job.name | Select-Object -Property `
`@{N="VM Name";E={$VM.name}},
`@{N="Job Name";E={$_.Name}} ,
`@{N="Restore Points";E={($_ | Get-VBRRestorePoint -name $VM.name | Measure-Object).count}},
`@{N="Path";E={$_.Info.DirPath}},
`@{N="Creation Time"; E={($_ | Get-VBRRestorePoint -name $VM.name| Sort-Object creationtime -Descending| Select-Object -First 1).creationtime}}
`| Sort Name -Descending | Format-Table
}
}
Thanks.
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Enterprise Manager Powershell?
Additionally, have you already known that RESTful Api will be implemented in the upcoming version of Veeam Backup and Replication. Using such functionality, you will be able to everything that you can do with Enterprise Manager UI; so, stay tuned.
Thanks.
Thanks.
-
- Enthusiast
- Posts: 84
- Liked: 8 times
- Joined: Jul 04, 2012 6:32 am
- Full Name: Tobias Elfstrom
- Contact:
Re: Enterprise Manager Powershell?
To bad, well hopefully sometime there will be.v.Eremin wrote: Unfortunately, there are none.
Indeed you can run queries such as this against each backup server but the whole point of Enterprise Manager is to gain a single pane of view and not having to maintain a list of backup servers anywhere else. Thanks for your suggestion though.v.Eremin wrote: However, as far as I can understand, the following script should provide quite a similar view:
BR Tobias.
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Enterprise Manager Powershell?
Yep, I’ve forgotten to mention, that you will have to run the aforesaid script against each backup server deployed in your environment. Probably, usage of invoke method should answer your requirements – so, kindly search this subforum for “remote PowerShell” key words.
Thanks.
Thanks.
-
- Influencer
- Posts: 17
- Liked: 3 times
- Joined: Nov 10, 2010 2:18 pm
- Full Name: Martin Pugh
- Location: Massachusetts
- Contact:
Re: Enterprise Manager Powershell?
While it's not EM level consolidation, you could certainly place all of the backup servers in their own OU and use Get-ADComputer to retrieve them all:
Also, instead of piping into Format-Table you could pipe into Out-Gridview to get a dynamic look at the data. Or better yet just leave it as object output and then you could use this piece of code as a function for several other things (HTML reports, emailed reports, etc)
Code: Select all
ForEach ($Server in (Get-ADCompter -Searchbase ou=backupou,dc=domain,dc=com))
{ ...vladimir's code here...
}
Martin
www.thesurlyadmin.com
@thesurlyadm1n
www.thesurlyadmin.com
@thesurlyadm1n
-
- Enthusiast
- Posts: 84
- Liked: 8 times
- Joined: Jul 04, 2012 6:32 am
- Full Name: Tobias Elfstrom
- Contact:
Re: Enterprise Manager Powershell?
If one where to but the backup server with one OU one could most likely do it in such a way yes.
And just to clarify if someone actually tries to do what the VMs tab in Enterprise Manager shows it is worth to mention that Vladimirs example code does not produce the same output information and i would believe that it is only provided as an inspiration where to start.
I will wait until v7 and use the RESTful Api to be able to work with the Enterprise Manager directly.
BR Tobias.
And just to clarify if someone actually tries to do what the VMs tab in Enterprise Manager shows it is worth to mention that Vladimirs example code does not produce the same output information and i would believe that it is only provided as an inspiration where to start.
I will wait until v7 and use the RESTful Api to be able to work with the Enterprise Manager directly.
BR Tobias.
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Enterprise Manager Powershell?
Of course, it’s nothing but a tip of the iceberg and one’ll have to put some efforts in order to consolidate the data coming from different backup servers. Though, I’m interested in hearing what particular information, apart from corresponding backup server, you believe, lacks there.
Thanks.
Thanks.
-
- Enthusiast
- Posts: 84
- Liked: 8 times
- Joined: Jul 04, 2012 6:32 am
- Full Name: Tobias Elfstrom
- Contact:
Re: Enterprise Manager Powershell?
Sure, the missing parts are only:v.Eremin wrote:Of course, it’s nothing but a tip of the iceberg and one’ll have to put some efforts in order to consolidate the data coming from different backup servers. Though, I’m interested in hearing what particular information, apart from corresponding backup server, you believe, lacks there.
Thanks.
* In your example you make a selection for only backup jobs where as in the VMs tab you get replicas as well
* last successful backup (in your example you take out the oldest run on the job and you only need to change select-object -Last to -First to get the latest restore point, not sure if you need to verify that it is an actual successful restore point)
* backup location (repository if backup) (you have file path but since we do not know on what server this is its only part of the information ) I would guess you can get this information by looking at the StorageID.
-
- VP, Product Management
- Posts: 27377
- Liked: 2800 times
- Joined: Mar 30, 2009 9:13 am
- Full Name: Vitaliy Safarov
- Contact:
Re: Enterprise Manager Powershell?
Tobias_Elfstrom wrote:That is get a a list of every VM with name, backup server, job name, restore points, location of the backup and the last date it run successfully.
Don't want to hijack this thread, but do you have Veeam ONE (part of VBMS) deployed in your VI? Veeam ONE v7 will have a rich set of predefined report templates that should give you the information you need, so I suggest taking a look at this functionality once it is available.Tobias_Elfstrom wrote:* In your example you make a selection for only backup jobs where as in the VMs tab you get replicas as well
* last successful backup (in your example you take out the oldest run on the job and you only need to change select-object -Last to -First to get the latest restore point, not sure if you need to verify that it is an actual successful restore point)
* backup location (repository if backup) (you have file path but since we do not know on what server this is its only part of the information ) I would guess you can get this information by looking at the StorageID.
-
- Enthusiast
- Posts: 84
- Liked: 8 times
- Joined: Jul 04, 2012 6:32 am
- Full Name: Tobias Elfstrom
- Contact:
Re: Enterprise Manager Powershell?
I do not have Veeam One in any VI implementation we run but would I be able to work with powershell to trigger a report end get the report back as powershell objects in the v7 version?Vitaliy S. wrote: Don't want to hijack this thread, but do you have Veeam ONE (part of VBMS) deployed in your VI? Veeam ONE v7 will have a rich set of predefined report templates that should give you the information you need, so I suggest taking a look at this functionality once it is available.
I'm only interested here to get the data and pass it along to other systems, now I know I could get all of the data straight out of the SQL databases but I prefer not to and use something, such as powershell comandlets in order to to be too much affected by internal updates of the Veeam software.
BR Tobias
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Enterprise Manager Powershell?
Since in case of replication restore points are stored in VMware native format (snapshots), it might be worth putting into use PowerCLI in order to check corresponding information regarding them (count, creation time):In your example you make a selection for only backup jobs where as in the VMs tab you get replicas as well
Code: Select all
asnp VeeamPSSnapin
asnp VMware.Vimautomation.core
Connect-VIServer -Server "vCenter" -User "User" -Password "Password"
Foreach ($Job in (Get-VBRJob | where {$_.JobType -eq "Replica"}))
{
Foreach ($VM in ($Job | Get-VBRJobObject))
{
$Snapshots = Get-Snapshot -vm (Get-VM -name $VM.name)
Get-VM -name $VM.name | Select-Object -Property `
`@{N="VM Name";E={$VM.name}},
`@{N="Job Name";E={$Job.Name}},
`@{N="Restore Points";E={($Snapshots | Measure-Object).count}},
`@{N="Path";E={$VM.Info.Location}},
`@{N="Creation Time"; E={($Snapshots | Sort-Object created -Descending | select -First 1).Created.DateTime}}`
`| Sort Name -Descending | Format-Table
}
}
Yep, there must have been a typo, I’ve fixed it already.last successful backup (in your example you take out the oldest run on the job and you only need to change select-object -Last to -First to get the latest restore point, not sure if you need to verify that it is an actual successful restore point)
Assuming that you utilize some remote methods to connect to different servers, you’ll be able to combine the name of this server with the aforesaid path, and it, in its turn, will be a direct location of backup data (sever1.yourdomain.net -> D:\Repository#1, for instance).backup location (repository if backup) (you have file path but since we do not know on what server this is its only part of the information ) I would guess you can get this information by looking at the StorageID.
Hope this helps.
Thanks.
-
- VP, Product Management
- Posts: 27377
- Liked: 2800 times
- Joined: Mar 30, 2009 9:13 am
- Full Name: Vitaliy Safarov
- Contact:
Re: Enterprise Manager Powershell?
If you're referring to some kind of API that can be used to get report data and pass it further, then in the upcoming version it will not be available. Can you please tell me where would you like to pass this data to? In v7 you can create reports with required parameters and then schedule them on daily/weekly/monthly basis.Tobias_Elfstrom wrote:I do not have Veeam One in any VI implementation we run but would I be able to work with powershell to trigger a report end get the report back as powershell objects in the v7 version?
-
- Enthusiast
- Posts: 84
- Liked: 8 times
- Joined: Jul 04, 2012 6:32 am
- Full Name: Tobias Elfstrom
- Contact:
Re: Enterprise Manager Powershell?
Yes but then I would have to loop trough every vcenter server as well and well, it builds up into a lot of looping and keeping tabs on instead of just working with one instance of Veeam Enterprise Managerv.Eremin wrote: Since in case of replication restore points are stored in VMware native format (snapshots), it might be worth putting into use PowerCLI in order to check corresponding information regarding them (count, creation time):
Actually no, it won't. There is nothing saying that the path is local to the backup server. The path i relative to the server holding the repository and not the backup server it self therefor the need to look for the location.v.Eremin wrote: Assuming that you utilize some remote methods to connect to different servers, you’ll be able to combine the name of this server with the aforesaid path, and it, in its turn, will be a direct location of backup data (sever1: D:\Repository#1, for instance).
BR Tobias.
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Enterprise Manager Powershell?
Hmm, then, what about combining information regarding repository mounted host, and its path; might be, indeed, what you’re looking for:
Yep, I know that it’s not that trivial; however, since this topic was created in PowerShell subforum, I have been trying to provide you with possible options of how this task can be achieved via PS.
Thanks.
Code: Select all
asnp VeeamPSSnapin
Foreach ($Job in (Get-VBRJob | where {$_.JobType -eq "Backup"}))
{
Foreach ($VM in $Job.GetViOijs())
{
Get-VBRBackup -name $Job.name | Select-Object -Property `
`@{N="VM Name";E={$VM.name}},
`@{N="Job Name";E={$_.Name}},
`@{N="Restore Points";E={($_ | Get-VBRRestorePoint -name $VM.name | Measure-Object).count}},
`@{N="Repo Mounted Host";E={($_.findrepository().findmounthost().realname)}},
`@{N="Path";E={($_.findrepository().path)}},
`@{N="Creation Time"; E={($_ | Get-VBRRestorePoint -name $VM.name| Sort-Object creationtime -Descending| Select-Object -First 1).creationtime}} `
`| Sort Name -Descending | Format-Table
}
}
Thanks.
-
- Enthusiast
- Posts: 84
- Liked: 8 times
- Joined: Jul 04, 2012 6:32 am
- Full Name: Tobias Elfstrom
- Contact:
Re: Enterprise Manager Powershell?
In this particular case I just want to insert the data into another SQL DB, a sort of CMDB.Vitaliy S. wrote: If you're referring to some kind of API that can be used to get report data and pass it further, then in the upcoming version it will not be available. Can you please tell me where would you like to pass this data to? In v7 you can create reports with required parameters and then schedule them on daily/weekly/monthly basis.
And since I have all the data I need already in Enterprise manager I though that it would be nice if there was an official way of using powershell to grab it and just insert into my other DB rather than taking the data from the Veeam DB directly.
-
- Enthusiast
- Posts: 84
- Liked: 8 times
- Joined: Jul 04, 2012 6:32 am
- Full Name: Tobias Elfstrom
- Contact:
Re: Enterprise Manager Powershell?
Almost, that gave me the host where the repository was.. defined I guess but using:v.Eremin wrote:Hmm, then, what about combining information regarding repository mounted host, and its path; might be, indeed, what you’re looking for:
Code: Select all
.FindRepository().findhost().realname
And I do appreciate your efforts.v.Eremin wrote: Yep, I know that it’s not that trivial; however, since this topic was created in PowerShell subforum, I have been trying to provide you with possible options of how this task can be achieved via PS.
I know I said I would wait until we get the REST against the Enterprise Manager's webinterface but now I think I will implement it like this as a workaround until that time comes.
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Enterprise Manager Powershell?
Glad to hear that you’ve finally nailed it down; and the RESTful API once released might, indeed, answer all the requirements you have. Thanks.
Who is online
Users browsing this forum: Bing [Bot] and 17 guests