PowerShell script exchange
Post Reply
Posts: 5
Liked: never
Joined: Jun 10, 2014 12:15 am
Full Name: masber

get sender email address

Post by masber » Jul 13, 2014 12:22 pm

Hi very simple question,

How could I get the sender email address from the Veeam global options/settings using powershell?


VP, Product Management
Posts: 5476
Liked: 2294 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler

Re: get sender email address

Post by tsightler » Jul 13, 2014 9:44 pm

I could be wrong, but I don't believe that any of the global server options are available via Powershell, however, you could probably get to that information directly from the SQL database. I believe that the "From Address" that you're looking for is stored in the "Options" table as an XML configuration, so something like this should work:

Code: Select all

$DBServer = "<SQL_Server>"  # Name of SQL Server hosting Veeam DB
$DBName = "VeeamBackup"  # Name of Veeam DB, default is VeeamBackup

# Setup SQL server connection
$SqlConn = New-Object System.Data.SqlClient.SqlConnection
$SqlConn.ConnectionString = "Server=$DBServer;Database=$DBName;Integrated Security=True"
$SqlCmd = New-Object System.Data.SqlClient.SqlCommand
$SqlCmd.Connection = $SqlConn

# Grab XML options for job from SQL table, and get the From email address
$SqlCmd.CommandText = "select value from dbo.Options where name = 'email_notification'"
$MailFrom = ([xml]$SqlCmd.ExecuteScalar()).CMailOptions.From

# Close the SQL Connection

# Write Mail From field to console
Write-Host $MailFrom

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests