Solved

Retrieving Enterprise Manager information using powershell


Userlevel 4
Badge

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!

icon

Best answer by DChiavari 14 January 2022, 18:16

View original

11 comments

Userlevel 7
Badge +17

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...

Userlevel 7
Badge +12

@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:

Userlevel 7
Badge +8

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.

Userlevel 6
Badge +7

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.

Userlevel 4
Badge

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

 

Userlevel 7
Badge +17

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 😎👍🏼

Userlevel 7
Badge +13

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:

Userlevel 7
Badge +17

Nice solution, thank you :thumbsup_tone3:

Userlevel 4
Badge

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

 

Userlevel 4
Badge

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!

Userlevel 2
Badge +3

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?

Comment