Skip to main content
Answer

Retrieving Enterprise Manager information using powershell

  • January 1, 2022
  • 11 comments
  • 2339 views

jcolonfzenpr

Hello,

 

First of all Happy New Year!

 

I have been working on a veeam implementation report using the AsBuiltReport framework created by Tim Carman @tpcarman see report here:

 

Project Report:

 

https://github.com/rebelinux/AsBuiltReport.Veeam.VBR

 

Sample Report:

 

https://technomyth.zenprsolutions.net/wp-content/uploads/2021/12/Veeam-VBR-As-Built-Report.html

 

Now the important thing, I would like to add to the report if the backup server is configured with an Enterprise Manager.

 

Does anyone know if there is a way in powershell to identify which Enterprise Manager the Backup server is connected to?

 

Thanks in advance!

Best answer by DChiavari

I wasn’t able to find a way, with Powershell, to check if a VBR server is managed by an Enterprise Manager… the only place where I could find this info is the VBR configuration database (SQL Server).

As already mentioned, interacting directly with the database is unsupported and generally not recommended.

That said, the following Powershell code should not do any harm :slight_smile: and just pull the Enterprise Manager info (if any) from the database.

#Query the SQL database to retrieve Enterprise Manager connection info (if any)
$info = Invoke-Sqlcmd -ServerInstance <YOUR_VBR_SQL_INSTANCE_HERE> -query "select value from [Veeambackup].[dbo].[Options] where name = 'EnterpriseServerInfo'"

#Parse and display the info (XML attributes / child nodes) obtained from the database
$([xml]$info.value).ChildNodes

Example output:

Note: if the VBR server is not managed by an Enterprise Manager server, the “EnterpriseServerInfo” row and data won’t be present at all.

11 comments

marcofabbri
Forum|alt.badge.img+12
  • On the path to Greatness
  • January 3, 2022

Hi @jcolonfzenpr ,

this is the bible of cmdlets, check if can help you:

https://helpcenter.veeam.com/docs/backup/powershell/get-vbrserversession.html?ver=110

and this is the section for Enterprise Manager cmdlets:

https://helpcenter.veeam.com/docs/backup/em_rest/em_web_api_reference.html?ver=110

:grin:


JMeixner
Forum|alt.badge.img+16
  • On the path to Greatness
  • January 3, 2022

This are the REST API cmdlets, not Powershell :sunglasses:

As far as I know the Enterprise Manager has a REST API only and no Powershell interface...


Mildur
Forum|alt.badge.img+12
  • Influencer
  • January 3, 2022

@jcolonfzenpr

I don’t know a way or method to get the enterprise manager with the help of the veeam Powershell Module.

You could get your answer from the vbr sql database if a EM is connected. And you can get also the FQDN. But that’s an unsupported method. 

Maybe oleg.feoktistov from veeam can help you in the R&D Forums. He is the real veeam powershell guru :sunglasses:


SteveHeart
Forum|alt.badge.img+11
  • Influencer
  • January 5, 2022

You could leverage netstat or Get-NetTCPConnection to see the connections on port 9392. Exclude the hosts accessing the VBR server using the Veeam Backup & Replication Console from the output and be aware that the connection from the EM server to the VBR server is not permanent.


DChiavari
Forum|alt.badge.img+7
  • Veeam MVP
  • Answer
  • January 14, 2022

I wasn’t able to find a way, with Powershell, to check if a VBR server is managed by an Enterprise Manager… the only place where I could find this info is the VBR configuration database (SQL Server).

As already mentioned, interacting directly with the database is unsupported and generally not recommended.

That said, the following Powershell code should not do any harm :slight_smile: and just pull the Enterprise Manager info (if any) from the database.

#Query the SQL database to retrieve Enterprise Manager connection info (if any)
$info = Invoke-Sqlcmd -ServerInstance <YOUR_VBR_SQL_INSTANCE_HERE> -query "select value from [Veeambackup].[dbo].[Options] where name = 'EnterpriseServerInfo'"

#Parse and display the info (XML attributes / child nodes) obtained from the database
$([xml]$info.value).ChildNodes

Example output:

Note: if the VBR server is not managed by an Enterprise Manager server, the “EnterpriseServerInfo” row and data won’t be present at all.


JMeixner
Forum|alt.badge.img+16
  • On the path to Greatness
  • January 14, 2022

Nice solution, thank you :thumbsup_tone3:


CptAmerica
Forum|alt.badge.img
  • Comes here often
  • March 28, 2022

Sorry, I’m a little late to the party, but I have a method in PowerShell that doesn’t require calling Invoke-SqlCmd cmdlet as it’s not installed by default in Windows Server (unless you also have SQL installed on the server or have installed manually).

 

Import-Module Veeam.Backup.PowerShell -WarningAction SilentlyContinue

[Veeam.Backup.Core.SBackupOptions]::GetEnterpriseServerInfo() | Select IsConnected, ServerName, Url | Format-List

 


JMeixner
Forum|alt.badge.img+16
  • On the path to Greatness
  • March 28, 2022

Sorry, I’m a little late to the party, but I have a method in PowerShell that doesn’t require calling Invoke-SqlCmd cmdlet as it’s not installed by default in Windows Server (unless you also have SQL installed on the server or have installed manually).

 

Import-Module Veeam.Backup.PowerShell -WarningAction SilentlyContinue

[Veeam.Backup.Core.SBackupOptions]::GetEnterpriseServerInfo() | Select IsConnected, ServerName, Url | Format-List

 

Great @CptAmerica 😎👍🏼


jcolonfzenpr
  • Author
  • Experienced User
  • March 30, 2022

Sorry, I’m a little late to the party, but I have a method in PowerShell that doesn’t require calling Invoke-SqlCmd cmdlet as it’s not installed by default in Windows Server (unless you also have SQL installed on the server or have installed manually).

 

Import-Module Veeam.Backup.PowerShell -WarningAction SilentlyContinue

[Veeam.Backup.Core.SBackupOptions]::GetEnterpriseServerInfo() | Select IsConnected, ServerName, Url | Format-List

 

Thanks!


poulpreben
Forum|alt.badge.img+3
  • Not a newbie anymore
  • December 19, 2023

Hi folks. This command does not seem to work with 12.0/12.1 and PostgreSQL. The .NET call returns the following:

Exception calling "GetEnterpriseServerInfo" with "0" argument(s): "Object reference not set to an instance of an object
."
At line:1 char:1
+ [Veeam.Backup.Core.SBackupOptions]::GetEnterpriseServerInfo() | Selec ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : NullReferenceException

Any clues?


CptAmerica
Forum|alt.badge.img
  • Comes here often
  • December 19, 2023

Hi folks. This command does not seem to work with 12.0/12.1 and PostgreSQL. The .NET call returns the following:

Exception calling "GetEnterpriseServerInfo" with "0" argument(s): "Object reference not set to an instance of an object
."
At line:1 char:1
+ [Veeam.Backup.Core.SBackupOptions]::GetEnterpriseServerInfo() | Selec ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : NullReferenceException

Any clues?

 

Heya! Yeah, in 12.x the command no longer works unless you run any other Veeam cmdlet prior in order to fully load up the modules (Import-Module doesn’t work, either). Here’s the updated way that I use it:

Get-VBRServer | Out-Null

[Veeam.Backup.Core.SBackupOptions]::GetEnterpriseServerInfo() | Format-List