Monday, March 22, 2010

Killing a process consuming more memory using PowerShell

There would be performance issues coming up in a server where we find that the server memory is being consumed by unnecessary processes. In order to prevent its unnecessary memory consumption, We can use the below powershell script which shall kill the process that consumes 100000000 KB of memory.

$computer = "mymachine"

$a = Get-Process -ComputerName $computer
$objs = $a | where-object {$_.WorkingSet -gt 100000000}
$processes = $objs | select {$_.ProcessName}


$i = $processes.Count

for ($k = 0; $k -lt $i; $k++)


{


$obj=get-wmiobject -comp $computer -query "select * from win32_process where name=$processes[$k]"
$obj.Terminate()


}


 Hope this helps....

List of services running on the server using PowerShell

As a systems administrator, there would always be a requirement for us to check if the particular services in the servers are running on that. To fix this, we can use the powershell script which shall give us the list of services running on a particular server and its status. We can also have a list of servers and get the powershell script run which would give details of the services from all the servers, We need to make sure that the account using which you would run this script is an administrator on all the servers on which you want to validate.

The powershell script is

$a = get-wmiobject win32_service -ComputerName "mymachine"

$a | select name,startname,startmode,state

Hope this helps....

Monday, March 15, 2010

Configuration Database details in Registry of the Sharepoint Server

For MOSS 2007, we can find the details about the configuration database and the SQL server where it's hosted in the below path in the registry of the sharepoint server.

HKLM\Software\Microsoft\Shared Tools\Web Server Extensions\12.0\Secure\ConfigDb

This path is applicable for WSS 3.0 also.

When we are planning for the migration of the SQL server and we face any issue during that, we can validate if the sharepoint is pointing to the correct SQL server or not from the above path.

Hope this helps someone.

Monday, March 1, 2010

Configuring FBA in MOSS 2007

What is LDAP?
Many a times this question comes up and how can we integrate it with Sharepoint. LDAP stands for Light Directory Access Protocol. In sharepoint, its equivalent to FBA i.e. Form Based Authentication.

FBA in Sharepoint is always recommended for Extranet sites and for the internet sites. The reason for not setting up it in intranet is very nicely explained by Nick in his blog http://planetmoss.blogspot.com/2009/02/using-ldap-authentication-with.html .

Well, coming to configuration for the FBA, I configured it following the steps from the site http://www.fivenumber.com/configuring-ldap-authentication-in-moss-2007/ and this worked as a charm for me.
I am providing the details in brief -
1> Create a website and extend it. Once the website is extended, select authentication as NTLM.
2> Copy and paste the tags which are basically the membership provider registration as mentioned in the site above. make sure that you provide your server name in the tags.
3> Once done, go to Central Administration > Application Management > Authentication Providers
Click on the extended web application, then select authentication type as Forms.
4> then click on Save.
5> Add the LDAP user. Once done, try to access the extended site using the LDAP user that was added.