Saturday, April 27, 2013

Email not sent until application closes in C#

Email not sent until application closes in C#

It may happen that your email via SMTP will not get sent until the application closes in C#.net

To send the email immediately and at the same time the application is working, you can include the below mentioned line of code:

System.Net.ServicePointManager.MaxServicePointIdleTime = 1

Saturday, April 13, 2013

Creating batch file for Scheduled Task Count


Creating batch file for Scheduled Task Count

@echo off
title Scheduled Task Count
setlocal enabledelayedexpansion

schtasks /query /fo table

echo.
set /a count = 0
for /f %%i in ('schtasks /query /fo table /nh') do (
set /a count = !count! + 1
)

echo Total Tasks Count : !count!
set /p=