Posted in Admin

PowerShell For DBA Part-8 (Write PowerShell output in email body or send as attachment)

Watch Part-1, Part-2, Part-3, Part-4, Part-5, Part-6, Part-7 Send the output as email body Get-Credential “YourEmail@gmail.com”|Export-Clixml D:\PowerShell\Cred.txt $credential=Import-Clixml D:\PowerShell\Cred.txt $Header = @” <style> TABLE {border-width: 1px; border-style: solid; border-color: black;…

Continue Reading... PowerShell For DBA Part-8 (Write PowerShell output in email body or send as attachment)
Posted in Admin

PowerShell For DBA Part-7 (Agent job monitoring and formatting HTML)

Watch Part-1, Part-2, Part-3, Part-4, Part-5, Part-6   Scripts Get-DbaAgentJob -SQLinstance localhost,localhost\SQL2017|Select * Get-DbaAgentJob -SQLinstance localhost,localhost\SQL2017|Select Computername,Name,CurrentRunStatus,LastRunOutcome | ConvertTo-Html | Out-File -FilePath D:\PowerShell\AgentJob.html Invoke-Expression D:\PowerShell\AgentJob.html Get-DbaAgentJob -SQLinstance localhost,localhost\SQL2017|Where-Object {$_.LastRunOutcome -eq…

Continue Reading... PowerShell For DBA Part-7 (Agent job monitoring and formatting HTML)