How to enable Query Latency Trend report for Sharepoint 2010

Sharepoint Server 2010 has contains builting Search administration reports. You can find them via
Central Administration -> Administrative Report Library -> Search Administration reports.

One of the reports that is very useful is the Query Latency Trend chart. This does not work out of the box because verbose query monitoring is disabled.

To enable the Query Latency Trend report, you must run the following Windows PowerShell cmdlets:

$app = Get-SPEnterpriseSearchServiceApplication “<application name>”
$app = Set-SPEnterpriseSearchServiceApplication -VerboseQueryMonitoring “True”
$app = Get-SPEnterpriseSearchServiceApplication “<application name>”
$app.Update()

Example:

$sar = Get-SPEnterpriseSearchServiceApplication
$sar.VerboseQueryMonitoring = $true
$sar.Update()
Resource:
http://technet.microsoft.com/en-us/library/ee808861.aspx

how to delete sharepoint timer job using powershell

When developing custom sharepoint timer jobs sometimes you want to delete junk jobs created by deployment attempts .

Warning !!! DO NOT DELETE ANY TIMER JOB UNLESS BE SURE

Searching listing and find timer job to delete.We need an id.
Get-SPTimerJob | where { $_.name -like “*<your search criteria>*” } |ft id,name

Set job to a variable
$job = Get-SPTimerJob -id <GUID>

And delete it.
$job.Delete()

just it.

Missing Sharepoint Central Administration application

Somehow our friendly Central Administration web application was deleted or collapsed irreversably. Than how could you reprovision it ? sure you can rerun Configuration Wizard but it will take time and makes lots of change. Thanks to Microsoft that we have console executable named psconfig.exe in DRIVE:\Program Files\Common Files\Microsoft Shared\Web Server Extentions\14\BIN\psconfig.exe

To provision CA use that command:

psconfig.exe -cmd adminvs -port 9999 -provision -windowsauthprovider onlyusentlm

Manages the SharePoint Central Administration Web application on the local computer. Takes the following optional parameters:

[-provision]

Provisions the SharePoint Central Administration Web application on this server. Provisioning creates a new SharePoint Central Administration Web application and an application pool running under the server farm administrator’s account.

[-unprovision]

Unprovisions the SharePoint Central Administration Web application from this server. Unprovisioning removes the SharePoint Central Administration Web application and its application pool.

[-port <port number>]

The SharePoint Central Administration Web application port is a global setting to the server farm. When changing the port, a SharePoint Timer service job is dispatched to synchronize the port for all SharePoint Central Administration Web applications in the server farm. If a port is not specified, the port that is used for existing SharePoint Central Administration Web applications in the server farm is used. If a SharePoint Central Administration web Application has not been provisioned in the server farm, the default port selected will be random if a port is not specified.

[-windowsauthprovider <enablekerberos | onlyusentlm>]

The SharePoint Central Administration Web application authentication provider is a global setting to the server farm. When you change the authentication provider, a SharePoint Timer service job will be dispatched to synchronize the provider on all SharePoint Central Administration Web Applications in the server farm. If onlyusentlm is specified, NTLM will be the exclusive authentication provider for all SharePoint Central Administration Web applications. All other authentication providers are disabled and NTLM will be the only authentication provider allowed. If enablekerberos is specified, Kerberos authentication is enabled for all SharePoint Central Administration Web applications. If an authentication provider is not specified, the provider that is used for existing SharePoint Central Administration Web applications in the server farm will be used. If a SharePoint Central Administration Web application has not been provisioned in the server farm, the Kerberos authentication provider will be enabled if an authentication provider is not specified.

More Info:
Psconfig command-line reference (SharePoint Server 2010)
http://technet.microsoft.com/en-us/library/cc263093.aspx

How to prevent install Sharepoint using Group Policy

Many organizations would like to have the ability to control who can install SharePoint. For instance they might not want end-users to install SharePoint even if they are a local computer administrator. In SharePoint Foundation 2010 this ability to block SharePoint install will be possible via Active Directory group policy.
HKLM\Software\Policies\Microsoft\Shared Tools\Web Server Extensions\14.0\ SharePoint\

To block installation, set DWORD DisableInstall=00000001

Sharepoint Send Email workaround via WCF Service

When you try to send an email with classical way in WCF service which is served in sharepoint you probably getting an error. As a workaround, you have to set HttpContext.Current = null. it will use the right context .

Here is the example:

try {    using (SPSite site = new SPSite("http://blog.bugrapostaci.com"))    {        SPWeb web = site.RootWeb;         {             //Save context to temp variable than set null             HttpContext tempContext = HttpContext.Current;             HttpContext.Current = null;             string MailTo = "admin@blog.bugrapostaci.com";             string Subject = "Make it easy";             string Body = "A message from Bugra";             bool success = SPUtility.SendEmail(web, true, true, MailTo, Subject, Body);             HttpContext.Current = tempContext;         }     } } catch (Exception ex) {     // Exception Handling }
Happy coddings...