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