Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.
Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.

Administration

IIS – no default pool recycle, set 1AM

Background

When SharePoint 2013 installs IIS application pools are created for content, service applications, central admin, and workflow.    Only the content pools appear to be given a daily recycle time.    However, I have noticed errors with Service Applications which can be fixed after recycling the pool.    Personally I prefer to recycle pools daily and ensure maximum stability.   Below is PowerShell code to accomplish that.  

shades_smile

 

image

 

Symptoms

  • Excel Services Web Part error visible to end users –  “We don’t know what happened, but something went wrong.  Could you please try that again?”
  • WCF errors on eventlog
  • Slow or unresponsive HTTP endpoints with “.svc”
image

Resolution

Apply 1AM IIS daily recycle time to any SharePoint pools without a schedule.

PowerShell Code

# Bypass IIS Defaults
$exclude=@(".NET v2.0",".NET v2.0 Classic",".NET v4.5",".NET v4.5 Classic","Classic .NET AppPool","DefaultAppPool");
# Loop SharePoint pools
$pools = Get-ChildItem IIS:\AppPools;
foreach ($p in $pools) {
	if (!$exclude.contains($p.name)) {
		$pn = $p.Name;
		$s = $p.recycling.periodicRestart.schedule.collection.value;
		if (!$s) {
			# Missing recycle schedule.  Set 1AM daily
			Set-ItemProperty -Path "IIS:\AppPools\$pn" -Name Recycling.periodicRestart.schedule -Value @{value="01:00"}}
		}
	}
}

FIXED – UPS missing Edit Connection LDAP filter menu

Recently while working on SharePoint 2013 I wasn’t able to edit the LDAP filters of the User Profile Service connection.   The hover menu wasn’t even visible.

 

Enabling Compatibility View for the Central Admin URL fixed it.   This page has older HTML which doesn’t work well in the IE 11 modern render engine.   Once Compatibility View was enabled everything worked as expected.    

shades_smile

 

image

 

image

 

image

SPLaunch – new CodePlex for PowerShell automation

Yesterday I published a new CodePlex project to automate PowerShell remoting.   Basically I got tired of RDP-ing to 10 machines to type the same command 10 times.  Why not use a local PowerShell window to read CSV with server names and execute remotely in bulk?    Well, now you can.

 

Give it a try for an hour to download, setup, and run.  You can save that much time in just a day by using this in instead of juggling RDP and typing multiple PowerShell commands.   Please leave a comment or CodePlex review to let me know what you think.  

Smile

 

http://splaunch.codeplex.com/

 

 

Business Challenge

  • Growing list of servers
  • Inconsistent configuration (DEV has, TEST lacks, PROD just crazy)
  • Need to reduce admin time. Make room for business analysis, teach how to use, evangelize features

Technical Solution

  • PowerShell remoting + automation wrapper = rapid fire commands
  • PS1 with functions
  • Noun CSV with server farms and login user
  • Verb CSV with "shortcut" alias PowerShell commands
  • Mix and match Noun/Verb CSV with automation wrapper (New-PSSession / Invoke-Command)

Examples

Open all servers in the "DCO" farm (Development Collaboration) and show total RAM size with percent used:

  • LaunchFarm DCO
  • LaunchShortcut ram | ft -a

Open just the first server across all farms and show the SharePoint build number:

  • LaunchFarm ALL 1
  • LaunchShortcut spver | ft -a

NOTE – MUST MANUALLY UPDATE "Noun" CSV file with target machine names, AD domain,
and user account before any commands can be run.

 

Screenshots

1

2

3

4

Getting Started

  • Enable PowerShell remoting and WSMan CredSSP on all target servers. "Enable-PSRemoting -Force"and "Enable-WSManCredSSP -Role Server" http://dustinhatch.tumblr.com/post/24589312635/enable-powershell-remoting-with-credssp-using-group
  • Enable PowerShell client with "Enable-PSRemoting -Force" and "Set-Item wsman:\localhost\client\trustedhosts * -Force"
  • Update NounCSV with servers and user names
  • Run "SPLaunch.ps1 -install" to add to $profile so it starts with new PowerShell windows
  • Run LaunchAFarm to see farms
  • Run LaunchAFarm DCO to connect to that farm (comma separated allows multiple farms)
  • Run LaunchAShortcut to see shortcuts
  • Run LaunchAShortcut RAM to execute the "RAM" command (end with " | ft" to format as table)
  • Enjoy!

Warnings

  • Account lockout – Possible if typing the password wrong and open many sessions at once.
  • System update – Verb CSV can modify configuration on many servers quickly. Use carefully for changes.

Please drop me a line via email spjeff@spjeff.com or Twitter @spjeff with ideas. I’m always open to suggestions and improvements.

© Copyright 2016
@ SPJeff

Return to Top ▲Return to Top ▲