Powershell cluster verification
Powershell cluster verification
break
}
#endregion
$LogDir = "$GlobalPath\Log"
$LogFile = $LogDir+"\"+$file
#endregion
#endregion
Function CreateDirorFile
{
param($Path, $Type)
$Path = $Path.replace("""","")
}
else
{
#endregion
Function WriteLog
{
param([string]$LogComment)
$now=Get-Date -format "dd-MMM-yyyy HH:mm:ss"
Add-Content $Logfile "$now -> $LogComment"
Function sendEmail
{
param($from,$to,$subject,$smtphost,$body,$cc)
# $body = "Kindly find Monthly Patching verification Report."
$smtp= New-Object System.Net.Mail.SmtpClient $smtphost
$msg = New-Object System.Net.Mail.MailMessage $from, $to, $subject, $body
$msg.cc.add($cc)
$msg.isBodyhtml = $false
$msg.Priority = "High"
#$msg.Attachments.Add($Attachments)
$smtp.send($msg)
}
#endregion
$errorflag = 0
#endregion
#$arrError = @()
SELECT
@ErrorMessage = ERROR_MESSAGE(),
@ErrorSeverity = ERROR_SEVERITY(),
@ErrorState = ERROR_STATE();
SELECT
@ErrorMessage = ERROR_MESSAGE(),
@ErrorSeverity = ERROR_SEVERITY(),
@ErrorState = ERROR_STATE();
Else
Print 'No AlwaysOn'
" -ErrorAction Stop
Write-Host "Eveything looks good on the server."
WriteLog "Eveything looks good on the server.."
Catch
{
WriteLog $CaughtException
WriteLog $ExceptionType
WriteLog $ExceptionMessage
Thanks,
Datavail Corporation."
continue
}
#endregion