Sunday, December 8, 2013

To get the complete version of SQL Server

To get the complete version of SQL Server

You can use the command below in a new query window of SQL Server.

select @@VERSION

Alternate commands:
SELECT
SERVERPROPERTY('Edition') AS Edition,
SERVERPROPERTY('ProductVersion') AS ProductVersion,
SERVERPROPERTY('ProductLevel') AS ProductLevel


To get the dll from the GAC(Global Assembly Cache)

To get the dll from the GAC(Global Assembly Cache)

For Pre-defined assemblies, type the below command in Run prompt

%windir%\assembly\gac

For the custom(user) dll

%windir%\assembly\GAC_MSIL

Wednesday, October 2, 2013

Rename multiple files in a folder incrementally using this batch file

Rename multiple files in a folder incrementally using this batch file


::Setup the stage...
SETLOCAL ENABLEDELAYEDEXPANSION
SET folder=D:\ABC
SET count=1
::Action
CD "%folder%"
FOR %%F IN ("*.jpg") DO (
 MOVE "%%F" "!count!.jpg"
 SET /a count=!count!+1
)
ENDLOCAL

Note: Put this batch file in that folder where other files that needs to be renamed are available and then run the same. 

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=

Tuesday, February 19, 2013

Restart a server using command prompt

Restart a server using command prompt

Use command:

shutdown -r -f -t0

-r : restart
-f : forcefully
-t : time (Here we have given 0 secs, which means server will be rebooted immediately)

If you dont specify time, default time taken for shutting down is 30 secs.

Tuesday, January 1, 2013

Taking site backup in MOSS 2007 using stsadm

Taking complete site backup in MOSS 2007 using stsadm command on cmd:

1) First go to the path using command prompt:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN

2) Fire the command:
stsadm -o backup -url http://sharepoint:8888 -filename c:/filename.dat

Note:
1) This backup only contains Sharepoint related stuff (i.e Config DB, Content DB, Sharepoint Site Pages)
2) If there are any custom pages that are available outside sharepoint, then those pages needs to be incorporated manually.
3) Also if there are some databases(like aspnetdb or custom DB) other than the sharepoint related databases then those databases needs to be restored separately.