get sender email address

PowerShell script exchange

get sender email address

Veeam Logoby masber » Sun 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?

Posts: 5
Liked: never
Joined: Tue Jun 10, 2014 12:15 am
Full Name: masber

Re: get sender email address

Veeam Logoby tsightler » Sun 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
Veeam Software
Posts: 4928
Liked: 1855 times
Joined: Fri Jun 05, 2009 12:57 pm
Full Name: Tom Sightler

Return to PowerShell

Who is online

Users browsing this forum: No registered users and 1 guest