Wednesday, April 19, 2017

BizTalk : Querying Receive Location

USE BizTalkMgmtDb
GO

-- Receive Location:
SELECT rl.Id, [Receive Location] = rl.Name, [URI] = rl.InboundTransportURL, [Receive Pipeline] = p.Name
FROM
 [dbo].adm_ReceiveLocation rl WITH(NOLOCK)
 LEFT JOIN [dbo].[bts_pipeline] p WITH(NOLOCK) ON p.Id = rl.ReceivePipelineId  
WHERE @KeyWord IS NULL OR rl.Name Like '%' + @KeyWord + '%'
ORDER BY 2
-- End of Receive Location:

PowerShell : BizTalk Error Send Email Alert.ps1

# biboyatienza - 13Jan.2017 15:59
# To Run => powershell -ExecutionPolicy Bypass -File "C:\BizTalk_Dropzone\PowerShellScripts\BizTalk Error Send Email Alert.ps1"
# biboyatienza - 19.April.2017 15:20 GMT+8 => Added detailed error:
##############################################################################
$SQLServer = "The_Server" #use Server\Instance for named SQL instances!
$SQLDBName = "IntegrationDb"
$SqlQuery = "EXEC [dbo].[usp_BizTalk_GetSuspended]"

$SqlConnection = New-Object System.Data.SqlClient.SqlConnection
$SqlConnection.ConnectionString = "Server = $SQLServer; Database = $SQLDBName; Integrated Security = True"

$SqlCmd = New-Object System.Data.SqlClient.SqlCommand
$SqlCmd.CommandText = $SqlQuery
$SqlCmd.Connection = $SqlConnection

$SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
$SqlAdapter.SelectCommand = $SqlCmd

$DataSet = New-Object System.Data.DataSet
$SqlAdapter.Fill($DataSet)

$SqlConnection.Close()

$DataSet.Tables[0]

foreach ($row in $DataSet.Tables[0].Rows)
{
    $ApplicationName = $row[0].ToString().Trim()
    $DateSuspended = $row[1].ToString().Trim()
    $Adapter = $row[2].ToString().Trim()
    $URI = $row[3].ToString().Trim()
    $ErrorDescription = $row[4].ToString().Trim()
    $Status = $row[5].ToString().Trim()

    # Email sending:
    $From = "NoReply <no_reply@biboyatienza.com>"
    $To = "admin@biboyatienza.com", "DBA <dba@biboyatienza.com>"
    $Bcc = "biboyatienza@gmail.com"
    $Subject = "Biztalk Error : " + $ApplicationName
    $Body = "Hi BizTalk Admin(s), `r`n`r`n"
    $Body = $Body + "Application Name: " + $ApplicationName + "`r`n"
    $Body = $Body + "Date Suspended: " + $DateSuspended + "`r`n"
    $Body = $Body + "Adapter: " + $Adapter + "`r`n"
    $Body = $Body + "URI: " + $URI + "`r`n"
    $Body = $Body + "Error Description: " + $ErrorDescription + "`r`n"
    $Body = $Body + "Status: " + $Status + "`r`n"
    $Body = $Body + "`r`n`r`n`r`n br,`r`n biboy atienza"
    $SMTPServer = "mail.biboyatienza.com"
    $SMTPPort = "25"
    Send-MailMessage -From $From -to $To -Cc $Cc -Subject $Subject `
    -Body $Body -SmtpServer $SMTPServer -port $SMTPPort
}
##############################################################################

Thursday, April 6, 2017

Introducing my new laptop at home

The Lenovo n22 n3050;


https://www.cnet.com/products/lenovo-n22-80s6-11-6-celeron-n3050-4-gb-ram-32-gb-ssd/specs/

Though it is equipped with windows 10 pro 64 bit, I still need to wipe it out and install a fresh new Ubuntu 16.04 LTS. I want to utilized it's full power. I only have 32gig disk space and Windows will surely eat it all in the long run. :(

First thing should do is to download Ubuntu installer here,



Then since I am still working on Windows environment, I need an app to create a bootable Ubuntu usb, and Rufus (Create bootable USB drives the easy way) with do that for me.