Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions public/Get-DbaDbMailAccount.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ function Get-DbaDbMailAccount {
- ReplyToAddress: The reply-to email address for emails sent from this account
- IsBusyAccount: Boolean indicating if the account is currently busy sending messages
- MailServers: Collection of SMTP servers configured for this account
- MailProfile: Collection of Database Mail profile names associated with this account

Additional properties available (from SMO SqlMailAccount object):
- Account: The account owner or associated account information
Expand Down Expand Up @@ -128,10 +129,13 @@ function Get-DbaDbMailAccount {
$accounts = $accounts | Where-Object Name -notin $ExcludeAccount
}

$accounts | Add-Member -Force -MemberType NoteProperty -Name ComputerName -value $mailserver.ComputerName
$accounts | Add-Member -Force -MemberType NoteProperty -Name InstanceName -value $mailserver.InstanceName
$accounts | Add-Member -Force -MemberType NoteProperty -Name SqlInstance -value $mailserver.SqlInstance
$accounts | Select-DefaultView -Property ComputerName, InstanceName, SqlInstance, ID, Name, DisplayName, Description, EmailAddress, ReplyToAddress, IsBusyAccount, MailServers
foreach ($acct in $accounts) {
$acct | Add-Member -Force -MemberType NoteProperty -Name ComputerName -value $mailserver.ComputerName
$acct | Add-Member -Force -MemberType NoteProperty -Name InstanceName -value $mailserver.InstanceName
$acct | Add-Member -Force -MemberType NoteProperty -Name SqlInstance -value $mailserver.SqlInstance
$acct | Add-Member -Force -MemberType NoteProperty -Name MailProfile -value $acct.GetAccountProfileNames()
$acct | Select-DefaultView -Property ComputerName, InstanceName, SqlInstance, ID, Name, DisplayName, Description, EmailAddress, ReplyToAddress, IsBusyAccount, MailServers, MailProfile
}
} catch {
Stop-Function -Message "Failure" -ErrorRecord $_ -Continue
}
Expand Down
13 changes: 8 additions & 5 deletions public/Get-DbaDbMailProfile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function Get-DbaDbMailProfile {
- Description: Text description of the profile's purpose or intended use
- ForceDeleteForActiveProfiles: Boolean indicating if the profile will be forcefully deleted even if actively used
- IsBusyProfile: Boolean indicating if the profile is currently busy processing mail messages
- MailAccount: Collection of Database Mail account names associated with this profile

Additional properties available (from SMO MailProfile object):
- Parent: Reference to the parent SqlMail object
Expand Down Expand Up @@ -131,11 +132,13 @@ function Get-DbaDbMailProfile {

}

$profiles | Add-Member -Force -MemberType NoteProperty -Name ComputerName -Value $mailserver.ComputerName
$profiles | Add-Member -Force -MemberType NoteProperty -Name InstanceName -Value $mailserver.InstanceName
$profiles | Add-Member -Force -MemberType NoteProperty -Name SqlInstance -Value $mailserver.SqlInstance

$profiles | Select-DefaultView -Property ComputerName, InstanceName, SqlInstance, ID, Name, Description, ForceDeleteForActiveProfiles, IsBusyProfile
foreach ($prof in $profiles) {
$prof | Add-Member -Force -MemberType NoteProperty -Name ComputerName -Value $mailserver.ComputerName
$prof | Add-Member -Force -MemberType NoteProperty -Name InstanceName -Value $mailserver.InstanceName
$prof | Add-Member -Force -MemberType NoteProperty -Name SqlInstance -Value $mailserver.SqlInstance
$prof | Add-Member -Force -MemberType NoteProperty -Name MailAccount -Value $prof.EnumAccounts().AccountName
$prof | Select-DefaultView -Property ComputerName, InstanceName, SqlInstance, ID, Name, Description, ForceDeleteForActiveProfiles, IsBusyProfile, MailAccount
}
} catch {
Stop-Function -Message "Failure" -ErrorRecord $_ -Continue
}
Expand Down
Loading