Wednesday, February 23, 2011

Rename servername in MS-SQL when computer hostname changes.

When you change computer hostname, MS-SQL servername is not automatically updated. In order to update MS-SQL servername I used following SQL commands

sp_dropserver 'oldHostname'
go

sp_addserver 'newHostname',local
go

Now restart your SQL server instance and when follwing command is executed, you will see newHostname appears.

select @@servername as 'Server Name'

or

select * from sys.servers

Wednesday, February 16, 2011

Creating symbolic link in Windows

In order to create new symbolic link in Windows, I used the following command from the command prompt.

mklink /D myLink c:\Software\

where myLink is name of the symbolic link and C:\Software\ is the target path.

Stop and Start IIS7 website

In order to stop and start only specific site using IIS7, I used the following command from command prompt.

%systemroot%\system32\inetsrv\appcmd stop apppool /apppool.name:MySite

%systemroot%\system32\inetsrv\appcmd start apppool /apppool.name:MySite

where MySite is the name of the site which you want to stop and start.