Friday, September 5, 2014

VB script to start stopped app pools

This VB script will start the stopped app pool and send email to desired email address, also it will exclude the undesired apppool. It will send email only and after if a apppool was stopped and started by this script:
=========================================================================


Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")
Set oAppPools = oWebAdmin.InstancesOf("ApplicationPool")
'Search in all App Pools
For Each oAppPool In oAppPools
 IF (oAppPool.name <> "Devtesting" ) Then
   IF oAppPool.GetState= 1 Then
 'wscript.echo "App Pool Started"
 
 ElseIF  oAppPool.GetState= 3 Then
   'wscript.echo "App Pool Stopped"
   ' Following command Starts App Pool
    oAppPool.Start
   temp = temp & ", " & oAppPool.Name
    END IF
END IF
Next
 IF (temp <> "") Then
  Set objMessage = CreateObject("CDO.Message")
  objMessage.Subject = "Monitoring APP POOLS on SP Farm"
  objMessage.From = "santosh.sethi@gmail.com"
  objMessage.To = "santosh.sethi@gmail.com"
   objMessage.TextBody = "Monitorinig Message, App Pool: "   & temp & " was down and automatically started."

  '==This section provides the configuration information for the remote SMTP server.
  '==Normally you will only change the server name or IP.
  objMessage.Configuration.Fields.Item _
  ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  'Name or IP of Remote SMTP Server
  objMessage.Configuration.Fields.Item _
  ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "SMTP server name"
  'Server port (typically 25)
  objMessage.Configuration.Fields.Item _
  ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
  objMessage.Configuration.Fields.Update
  '==End remote SMTP server configuration section==
  objMessage.Send
 END IF
set oWebAdmin = nothing
Set oAppPools = nothing
Set objMessage = nothing


**Reference link : http://msdn.microsoft.com/en-us/library/ms691445(v=vs.90).aspx

Thursday, September 4, 2014

Powershell to Start the stopped Appools at a server

#The following powershell script will start the stopped apppools, the excluded a appools can be included in place of "Devtesting". Also this script will be in sleep mode in every 300 sec
===================================================================


Import-Module WebAdministration
$logPath = "D:\AppPool\logs\iis-recycle-" + (Get-Date).ToShortDateString() -replace "/","-"
$logPath += ".txt"
#Specify the time counter over here
$TimeCounter = 300
#Run in Infinite Loop
While ($true)
{
$Date = Get-Date
Write-Output $date | Out-File -FilePath $logPath -Append
$AppPools = Get-WmiObject -Class IIsApplicationPool -Namespace "root/MicrosoftIISv2" | Select-Object -property @{N="Name";E={$name = $_.Name; $name.Split("/")[2] }}
$ApppoolsEXclude = $AppPools | where-object {$_.Name -ne "Devtesting"}
foreach($Pool in $AppPoolsExclude)
{
$PoolName = $pool.Name
        $State = Get-WebAppPoolState -Name $PoolName
        $StateValue = $State.Value
        if($StateValue -eq "Stopped")
        {
            Write-Output "Found $PoolName as $StateValue. Proceeding to start..." | Out-File -FilePath $logPath -Append
            Start-WebAppPool -Name $PoolName
            if(-not $?)
            {
                Write-Output "Encountered an error. Pls check manually." | Out-File -FilePath $logPath -Append
            }
            else
            {
                Write-Output "Started" | Out-File -FilePath $logPath -Append
            }
        }
        else
        {
        }  
    }
     
   Write-Output "Proceeding to sleep for $TimeCounter seconds." | Out-File -FilePath $logPath -Append
   Sleep $TimeCounter
}

Friday, January 31, 2014

SharePoints List BaseTemplateType

SharePoint has many Lists. Following is a list of BaseTemplateType of some of the SharePoint List that I know for a quick reference.
Notused-1
NoListTemplate0
GenericList100
DocumentLibrary101
Survey102
Links103
Announcements104
Contacts105
Events106
Tasks107
DiscussionBoard108
PictureLibrary109
DataSources110
WebTemplateCatalog111
UserInformation112
WebPartCatalog113
ListTemplateCatalog114
XMLForm115
MasterPageCatalog116
NoCodeWorkflows117
WorkflowProcess118
WebPageLibrary119
CustomGrid120
SolutionCatalog121
NoCodePublic122
ThemeCatalog123
DesignCatalog124
AppDataCatalog125
DataConnectionLibrary130
WorkflowHistory140
GanttTasks150
HelpLibrary151
AccessRequest160
TasksWithTimelineAndHierarchy171
MaintenanceLogs175
Meetings200
Agenda201
MeetingUser202
Decision204
MeetingObjective207
TextBox210
ThingsToBring211
HomePageLibrary212
Posts301
Comments302
Categories303
Facility402
Whereabouts403
CallTrack404
Circulation405
Timecard420
Holidays421
IMEDic499
Microfeed544
ExternalList600
MySiteDocumentLibrary700
PublishingPageLibrary850
PublishingImageLibrary851
IssueTracking1100
AdminTasks1200
HealthRules1220
HealthReports1221
DeveloperSiteDraftApps1230
PersonalDocumentLibrary2002
PrivateDocumentLibrary2003

Monday, January 20, 2014

"About me" texts are bunched in user profile

Issue:
"About Me" texts are bunched in users' profile of SharePoint 2010

Workaround:
Copy the content of "About Me" and paste it in text file==> format it(remove spaces if any) ==> paste it back in "About Me" section of that user

Thursday, January 16, 2014

Search webparts in Search pages- SharePoint 2010

Search Webparts used in Search Page
Search paging:

 It display links for navigating pages containing search results. user can configure "Max Pages links before current", "Max Page links after current", " Previous link text label", "Previous link image URL", "Image URL for previous link in right-to-left languages",

Search Core Results:
 It shows the results, metadata and URLs. It includes description of results also known as snippet. Results layout can be modified by using its XSLT. The look and feel view and options can be modified through this webparts settings.
In this webpart settings we have location option with in it, we can Local search results or Internet search results or Local people search results etc.
We can increase "Results per page". Characters in summary", Characters  in URL, "Results can be sorted with relevance or modified date", "Remote duplicate results", "Ignore Noise Words", "Query lanugage can be changed", "Show More results link", etc.

Top federated results:
The Top Federated Results Web Part settings are used to execute and display search results from different locations/zone like intranet, local, FAST etc. They contain the same search settings as the Search Core Results Web Part with the exception of the Location properties(Here we can add more than one location to aggregate results from more than one location). A notable advantage of this Web Part is the option to aggregate results from several locations/zone like intranet, local, FAST etc. In this section, we will look at the following search-related settings of the Top Federated Results: choosing a federated location and using the asynchronous Ajax options.

People matches:It is very much similar to Search core webpart except in "location" dropn down it have default value as Local People search results, this settings/option can be view through it webpart settings.

Related queries:It provides a list of link to queries similar to keywords or phrases(used in best bets) entered in the search box. Searched term/text will be added as suggestion if it is used more than 6 times. Timer job is doing this process.

Search Action links:
It shows search action links on search page. It allows users to click on hyperlinks in the results set such as RSS, Alert, Relevance, Modified date, Search from windows, Alert me, allow users to display language picker.
It contains very similar settings as compared to search core except RSS, Alert, Relevance, Modified date, Search from windows, Alert me, allow users to display language picker. Admin can select to display it in search page accroding to its requirement.

Search statistics:It displays search statistics such as display mode in one or two line, display number of results on page, total number of results, search response time, latency traces(debug)

Refinement Panel:It helps users to refine its search results in search page. Also add custom refiners based on managed metadata property.
In its settings the filter category can be modified as per requirement.

Advanced search box:
It displays different parameter search options based on properties and combination of words. It also helps to create query based on including all the words,Exact phrase, Any of words, None of words. These sections of this webpart can be hide or show based on requirement.

Federated search:It returns search results from federated search locations for the provided search query. It works with all search products. Federated connectors are required to fetch results from federated location. Available connectors are News(Bing news, Business week, Google news, The register, Yahoo news), Media(Bing Image, Flickr, Yahoo Images, YouTube), Blogs(Google blog Search), Information resources(Bing, Bing local, Encyclopedia, Britannica, MSDN, Technet, Wikipedia, Yahoo!)

People refinement panel:
This webpart is similar to refinement panel webpart. This webpart renders on left hand side of the search page. It helps users to refine search results. Also add custom refines based on managed metadata property.

People search box:
It allows users to search for the peoples. Metadata property for user will be search.

Search visual best bets:Its a feature of fast search for SharePoint. It displays high confidence visual results on a search results page. Results could be also html page, picture and videos.

Search summary:
Displays suggestions for current search query. Example: If you are searching for SharePoin then below that one a suggestion will display like: Did you mean SharePoint?

Create "Best Bets" at Search page in SharePoint 2010

Keywords and Best Bets are manually configured by a site collection administrator and are a great way to target important information in your search results. When a user enters a keyword into the search box, the Best Bets are displayed as part of the search results at the top of the page marked by a yellow star.
The keywords for Best Bets are created under Top level site collection of that search page. In some architect design admins are creating search page as different site collection and some are creating as sub site.
Here are the steps to create best bets at Top level site collection of search page:
Site Action  ==> Site Settings ==> Search Keywords ==> Click on "Add Keywords" ==> Enter required information

Tuesday, January 14, 2014

Import a picture from AD for the user profile

Update-SPProfilePhotoStore -CreateThumbnailsForImportedPhotos 1 -MySiteHostLocation http:///my

http://support.microsoft.com/kb/2394320

Import User Profile Information of Enabled User Accounts from Active Directory to SharePoint Server 2010

To import user profile information of user accounts that are enabled in Active Directory to SharePoint Server 2010, follow these steps:
  1. On the Manage Profile Service page, click Configure Synchronization Connections.
  2. On the Synchronization Connections page, click the Active Directory connection that you want to edit, and then click Edit Connection Filters.
  3. On the Edit Connection Filters page, follow these steps:
    1. In Exclusion Filter for Users, change the Attribute drop-down to userAccountControl.
    2. In Exclusion Filter for Users, change the Operator drop-down to Bit on equals.
    3. In the Exclusion Filter for Users, select Filter box typeto 2.
    4. Click Add.
  4. Click OK.