Tanmaya Thopate, Chincholi Morachi, Low cost WEBSITE development in Pune, Windows Tips n Tricks

Friday, November 14, 2008

Check heart beat of SQL Server services

Helpful for Database administrators to test the heart beat of SQL Server services daily.

Step1
Create c:\HeartBeat folder and a file ServiceList.txt which will contains following text in it with all the servers and services would like to check.

SQL,MSSQLServer
SQL,SQLSERVERAGENT
YUKON,MSSQLServer
YUKON,SQLSERVERAGENT
YUKON,MSSQLServerOLAPService
ETL,MSSQLServer
ETL,SQLSERVERAGENT
Note: Need to add server names and its related service names.

Step2
Make a file c:\HeartBeat\CheckHeartbeat.vbs and copy the below code into the file.

'Objective: TO check the Heartbeat of all SQL Server services

on error resume next
Set iFSO = CreateObject("Scripting.FilesyStemObject")
Set oFSO = CreateObject("Scripting.FilesyStemObject")

InputFile="c:\Heartbeat\Servicelist.txt"
Outputfile="c:\Heartbeat\Status.txt"

Set ifile = iFSO.OpenTextFile(inputfile)
Set ofile = ofso.createTextFile(OutputFile, True)

Do until ifile.AtEndOfLine
servicelist= ifile.ReadLine
strcomputer=left(servicelist,instr(servicelist,",")-1)
Service =right(servicelist,len(servicelist)-instr(servicelist,","))
ofile.writeline Now()
ofile.writeline "ServerName: " & strcomputer
ofile.writeline "ServiceName: " & Service

Set objWMIService =nothing
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

if err.number<>0 then
ofile.writeline "Error: " & err.number
ofile.writeline "Error: " & err.description
else

Set colItems = nothing
query=""
query = "Select * from Win32_Service where name = '" & Service & "'"
'msgbox query
Set colItems = objWMIService.ExecQuery(query,,48)
if err.number<>0 then
ofile.writeline "Error: " & err.number
ofile.writeline "Error: " & err.description
else
For Each objItem in colItems
ofile.writeline "Status: " & objItem.Status
ofile.writeline "State: " & objItem.State
next

next
end if
end if
err.number=0
Loop

msgbox "SQL Service Status Check completed"
Step3
Execute the above VB script. The message will show the status of it.
In addition, it creates a file c:\HeartBeat\Status.txt with detailed logs for the status.

Ref: Check MSSQL Server's status

Tuesday, October 28, 2008

How hacker exploits a website?

Hacking Web Sites:

Hackers are with tons of mechanisms attack, they decide the one most appropriate to vulnerability. Its organized plan to exploit.
There are so many techniques of hacking used by hackers, following are couple of them explained in details.

How hacker exploits a website

MySQL memcache

In current web scenario, the access speed of website is more crucial. If your web site is running on MySQL database with number of records in it, can be slow processed as each record needs execution of the SQL query and resulting of the data from the database. So that queries on tables, which are in the process, are locked, this may result in delay of query and reduce the speed.
memcache for MySQL

Tuesday, October 21, 2008

Hindi supported on Joomla


Here is how you can enable Joomla to write in Indian languages.

Step 1:Install indiaPlugin for tinyMCE

Upload files to hosting server,
• Download the India Plugin
• Extract this file in a folder named indiaplugin.
• Now FTP the indiaplugin folder and all files inside it, to “plugins\editors\tinymce\jscripts\tiny_mce\plugins ” in case of Joomla 1.5.x
Modify the ‘tinymce.php‘ file
• Edit tinymce.php file in “editors\tinymce”.
In Joomla 1.0.x

For further detailed steps, follow Indian Language support on Joomla

Tuesday, October 7, 2008

SQL Server 2005 Deployment on Windows Shared Server Hosting

SQL Server 2005 Deployment management on Windows Shared Server Hosting Plan

Requirement:

Windows shared hosting Server should be with 32-bit processor and minimum of 3GB of RAM including Windows Server™ 2003 operating system.

Possibilities:

a) In various situations, managing several instances of SQL Server on a particular server can support additional users than a single instance of SQL Server.

b) CLR integration with SQL Server offers developers who are well-known with .NET programming the skill to code database objects by using the programming language they previously know.

EXEC sp_configure ‘show advanced options’, 1
RECONFIGURE
GO

EXEC sp_configure ‘clr enabled’, 1
RECONFIGURE
GO

c) Using the query cost governor
can avoid run off queries from overwhelming lots of resources on a Windows shared hosting server.

Whenever SQL Server obtains a query, the query optimizer produces probable time that the query is likely to take. The query cost governor limit can be used to stop all queries that are probable to take more than a particular amount of time. However, it is possible for the probable time to be inaccurate, which will cause fast-running queries to be cancelled. The choice to apply query cost governor limits is a negotiation between maintaining suitable server performance under load versus the possible for generating client support issues.

EXEC sp_configure ‘show advanced options’, 1
RECONFIGURE
GO

EXEC sp_configure ‘query governor cost limit’, 300

RECONFIGURE
GO

d)
Disabling or Renaming the Built-in SA Account
In SQL Server 2005, the built-in system administrator (SA) account was kept for backward compatibility. As long as it is not necessary, this account ought to be disabled or renamed.
These commands can be used to disable or rename SA account:
ALTER LOGIN sa DISABLE;
ALTER LOGIN sa WITH NAME = [sys-admin];

Tuesday, September 30, 2008

Login failed for user computer\ASPNET

Common reason behind this is, with a Web application is trying to access a Microsoft SQL Server. The definite error or exception that is raised depends on whether the Web server is also running SQL Server? This problem arises because the Web application is not passing valid credentials to SQL Server. You can check following steps,

Login failed for user computer\ASPNET

Thursday, September 25, 2008

ASP.NET Web Applications under IIS 6.0


Hi All,

You might be all curious about How ASP.NET web applications run under IIS6.0 on Windows Web hosting Server

In the following post, I've briefed it, may it will help you to understand an idea about its layout.


Your ASP.NET application need to be under an IIS virtual directory, working under application root. These ASP.NET applications have compiled assemblies settings stored in a text-based Web.config file; pages; server controls; and XML Web services..... ASP.NET Web Applications under IIS 6.0

Sunday, September 21, 2008

How to prevent MSSQL injection?

How to prevent MSSQL injection?

In reaction to the recent mass MSSQL injection attacks, Microsoft has developed a new static code examination tool for discovery MSSQL Injection vulnerabilities in ASP code.
Web site developers can run the tool on their ASP source code to recognize the root cause of the attack and tackle them to reduce their coverage to future attacks in the MSSQL databases.

The tool will scan ASP source code and generate warnings linked to SQL Injection vulnerabilities. The tool also provides explanation support that can be used to develop the scrutiny of the code which will prevent MSSQL injection.

Directions to complete, follow these steps :

Download from this link and install the Microsoft Source Code Analyzer for Microsoft SQL Injection :

1. Download msscasi_asp_pkg.exe to a temporary directory.
2. Run msscasi_asp_pkg.exe.
3. Enter an installation directory when prompted.
4. After extracting the files, read the usage section of the Readme.htm file for next steps.

Friday, September 19, 2008

What is FSMO?

FSMO is Flexible Single Master Operations, There are five FSMO roles:

* PDC emulator (one per domain): It permits Windows Server 2003 to perform as a Windows NT primary domain controller (PDC), and it not only offers replication support for Windows NT-based backup domain controllers (BDCs), but also helps with time and group policy synchronization.

* Infrastructure master (one per domain): It is responsible for updating the group-to-user references every time the members of groups alter or obtain new names.

* Relative ID (RID) master (one per domain): It makes sure that every object formed has a unique identification number.

* Schema master (one per forest): It is responsible for maintaining and modifying the Active Directory schema.

* Domain naming master (one per forest): It is responsible for the addition and deletion of domains in a forest.

Now the real thing is which servers hold these roles in an Active Directory forest?

To find the PDC emulator, the infrastructure master, and the RID master, follows these steps:

1. Go to Start | Administrative Tools | Active Directory Users and Computers.
2. Right-click the domain, and select Operations Master.

The resultant three tabs will explain you which server holds each respective role.

To find the schema master, follow these steps:

1. Go to Start | Run.
2. Enter regsvr32 schmmgmt.dll in the Open text box, and click OK.
3. Go to Start | Run.
4. Enter mmc in the Open text box, and click OK.
5. Go to File | Add/Remove Snap-In, and click Add.
6. Click Active Directory Schema, click Add, click Close, and click OK.
7. Right-click Active Directory Schema, and select Operations Master from the shortcut menu.

To find the domain naming master, follow these steps:

1. Go to Start | Administrative Tools | Active Directory Domains And Trusts.
2. Right-click Active Directory Domains And Trusts, and select Operations Master from the list.

Each option features a modify button, which allows you to move the role to another domain controller.

Wednesday, September 17, 2008

Execute a batch file in ASP

How do I execute a batch file in ASP?

On the Web hosting Server , one needs WSH, ASPExec or DynuExec available on the Hosting Server to execute the scripts which tries to execute batch files.

For example,

1) To start w3svc.
----------------------------------------------------------------------------------------------
<%
set wshell = CreateObject("WScript.Shell") wshell.run "c:\execute.bat"
set wshell = nothing
%>
----------------------------------------------------------------------------------------------

This bat file contains
----------------------------------------------------------------------------------------------
net stop iisadmin /y
net start w3svc
----------------------------------------------------------------------------------------------

2) Ping response in your ASP code.
----------------------------------------------------------------------------------------------
<% Response.Buffer = true %>
<%
url = "www.host.co.in"
Set objWShell = CreateObject("WScript.Shell")
Set objCmd = objWShell.Exec("ping " & url)
strPResult = objCmd.StdOut.Readall()
set objCmd = nothing: Set objWShell = nothing

strStatus = "offline"
if InStr(strPResult,"TTL=")>0 then strStatus = "online"

response.write url & " is " & strStatus
response.write ".
" & replace(strPResult,vbCrLf,"
")

%>
----------------------------------------------------------------------------------------------

Some time, you may come across errors if code is improrely configured:
1)
----------------------------------------------------------------------------------------------
Error Type:
(0x80070002)
/.asp, line
----------------------------------------------------------------------------------------------

it means that the file is not found, you will need to check the name and path of the file

2)
----------------------------------------------------------------------------------------------
Microsoft VBScript runtime error '800a0046'
Permission denied
/.asp, line
----------------------------------------------------------------------------------------------

Either IUSR_MachineName or an authenticated user does not have permissions to the file or folder or the IUSR does not have permissions to one or more of the commands being called within the file. Never assume that IUSR_machineName is included in the "Everyone" group... and never just give "Everyone" full access to this folder, or put IUSR in the Administrators group. You have to explicitly give IUSR permissions to file, folder, and anything else that the command has to touch.

And one more thing, never include such script which needs users interaction, because this code runs in background and may be waiting for response from the User. This may lead to Web hosting Server hang.

Sunday, September 14, 2008

Google is now 10 years old...

Happy Birthday Google, my friend!!!

When Larry Page and Sergey Brin established Google Inc. on September 7, 1998, they had little more than their creativity, four computers and an investor's $100,000 bet on their belief that an Internet search engine could change the humankind.

In the most recent example of its persistent expansion, Google has just released a Web Browser to make its search engine and other online services even easy to get to and attractive. Not every peripheral step has gone smoothly, though; several of the company's additional products have flopped or never lived up to the publicity.

But the lengthy to-do list also includes: making digital copies of the entire world's books; establishing electronic file cabinets for people's fitness account; leading the substitute power charge away from fossil fuels; selling computer programs to businesses over the Internet; and tweaking its search engine so it can better understand requests stated in basic words, like a human would.

Google as an daunting kingdom. It holds commanding leads in both the Internet search and advertising markets. The company processes nearly two-thirds of the world's online search requests.

The supremacy has enabled Google to rake in $48 billion from Internet Ads since 2001. Google hasn't hoarded all of that capital: the company has paid $15 billion in commissions to the Web sites that run its ads during the same period, serving to support major online destinations like AOL, Ask.com and MySpace as well as an array of bloggers.
 
Add to Technorati Favorites