Saturday, January 25, 2014

This site has moved to a new URL - anothersharepointblog

Move logging of the operating system drive and right size SharePoint 2013 intranet portal

Here are your steps and you have to do them on each server in the farm:

  1.  Make sure the server is resourced at 32 GB and at least 2 quad core processors and 100 GB for the  drive storing the logs (e.g. not the C:\) and 300 GB for the SharePoint drive and 500 GB if Drive is housing the search index. (e.g. 4vCPU assuming the server has quad core processors,  the C:\ sharePoint drive stores index, iis etc) Microsoft recommends turning on Publishing infrastructure and resourcing your servers at 32GB each, see this post:,
  2. Turn on publishing infrastructure

Go to your run bar on the server and run msinfo32, take note of the “Installed Physical Memory” and the “Page file space”.  The page file space should be at lease 1.5x the installed physical memory.  So if you have 32 Gb installed memory (recommended for publishing infra…) then you need page file to be set at 49152 MB (32GB x 1.5 x 1024 MB/GB)
Use sysdm.cpl to change the size of your paging file
1. click advanced  tab > Performance Settings... > advanced tab > Change...> Select a non system drive and increase the custom size accordingly

Microsoft makes a caveat  saying “Therefore, supplement this guidance with additional testing on your own hardware in your own environment. If your planned design and workload resembles the environment described in this article, you can use this article to draw conclusions about how to scale your environment”  I say that because I've seen only 16 GB and only 4 vCPU allocated to each web front end, run a minimal load (under 1000 users) without issues.

Making the drive that runs your Operating system have less writing will also improve your performance, a little because the servers will be writing logging to a separate set of spindles than the OS. 
One way to do this is to move log files to a different drive, they are in your 15 hive :
This post explains the process for SharePoint 2010 
just adjust for the 15 hive or move to a completely different path.  It is possible to move them to E:\SharePointLogs, so where you see thispicture that says “Notice not a C” , the settings are e:\sharepointlogs vs E:\Program files\common files\microsoft shared\web server extensions\15\logs
Then the powershell scripts that I ran was easier - -

Set-SPDiagnosticConfig –LogLocation “E:\SharePointLogs”


Set-SPUsageService –UsageLogLocation “E:\SharePointLogs”

Note:  Make sure the folder exists on every front end server in your farm before doing this

If you go the route suggested by Todd Klindt, or if you use a different path for your logs, make sure the entire path is there first on all of your servers before you modify the settings via the gui, or via powerhsell 

Here’s one way to make the path if you don’t want to do it manually:

Open powershell and type

New-item –Path “E:\Program files\common files\microsoft shared\web server extensions\15\logs” –itemtype directory

Saturday, January 18, 2014

Avoiding the Confirm prompt in scripts

There are two ways you can suppress confirmation from a script or console:

1. Set the automatic variable to 'None' or 0 in your
 $ConfirmPreference = 'None'

cd Variable:
then dir to see all the variables currently defined in your shell, the text above will change the behavior though, and then at the end of your script you could change it back to 'High'

 2. Pass $false to the Cmdlet's -Confirm switch

 ... -confirm:$false

Windows PowerShell blog on this topic:

Windows PowerShell blog home:

Saturday, January 11, 2014

Customizing your PowerShell window colors

The information about the settings for your PowerShell's shell colors are stored in the object model at:
System.Management.Automation.Internal.Host.InternalHost and at

under the PrivateData and RawUI Properties

you can see the various settings by typing

$host.PrivateData and pressing enter

PS C:\Users\Stacy> $host.PrivateData

ErrorForegroundColor    : Red
ErrorBackgroundColor    : Black
WarningForegroundColor  : Yellow
WarningBackgroundColor  : Black
DebugForegroundColor    : Yellow
DebugBackgroundColor    : Black
VerboseForegroundColor  : Yellow
VerboseBackgroundColor  : Black
ProgressForegroundColor : Yellow
ProgressBackgroundColor : DarkCyan

Or by typing $host.UI.RawUI

ForegroundColor:             DarkYellow
BackgroundColor:            Black
CursorPosition:                 0,70
WindowPosition :             0,21
CursorSize:                       25
BufferSize:                        120,3000
WindowSize:                     120,50
MaxWindowSize:              120,84
MaxPhysicalWindowSize: 274,84
KeyAvailable:                    False
WindowTitle :                    Windows PowerShell

Now if you don't care for the red error text and would rather see it in green, type this

(get-host).PrivateData.ErrorForegroundColor = 'Green'

You also could have used Get-Host alias $host, like this:

$host.PrivateData.ErrorForegroundColor = 'Green'

Either way, powershell will just prompt back to normal, it will seem like nothing happened.  You can verify that it worked by typing this

$host.PrivateData.ErrorForegroundColor = Green

without the single quotes and including Green.

It will result in an error, the error text will be Green with a black Error background color.

If you want to see information about the User Interface

$host.UI.RawUI | gm

If you wanted to change the background color of your current shell to black:

$host.ui.rawUi.backgroundcolor = 'Black'

press enter


press enter

If you want your shell to always open up with a black background, you could create a folder in your my documents folder and name this new folder, WindowsPowerShell.  Then create a .ps1 file and include these two lines of code:

$host.ui.rawUi.backgroundcolor = 'Black'

This channel, by Don Jones, on YouTube has really, quick and easy PowerShell tutorials on the above information and more:

Sunday, January 5, 2014

Backing up a SharePoint 2010 farm

There are a lot of good scripts out there to use for backing up your SharePoint.  This one is one of my favorites: 

Just download it, unzip it, create a folder to store your backups, share that folder complete the Params.xml and you're about ready to go! 

Read this detailed instruction guide written by the scripts author for step-by-step instructions:

Here is another, and probably the best script for backing up your SharePoint Farm.  It is written by John Ferringer, a SharePoint Guru -

If the Ferringer solution or the codeplex solution above seems a bit to daunting, you can copy and paste the powerhsell from this blog: into a .ps1 file and then set it up to run as a scheduled task using credentials that have Shell admin access and full control over the shared network location where the backups will be stored. 

You'll need to share a folder for the script to write into.  Here is the powershell script from bradcote with a few additional notes

# Backup all site collections in the farm, placing them in
# a directory on a shared location
# Note - Does not backup the /train site collection

# adds the SharePoint cmdlets to your powershell and effectively turns it into the SharePoint
#Management Shell

Add-PsSnapin Microsoft.SharePoint.PowerShell

# Take care of the disposable objects to prevent memory leak.
Start-SPAssignment -Global

# This is the backup path - must be shared with account that is executing the script and the
# farm account

# Remove all that backup folders created > 7 days ago
get-childitem $backupLocation |
     where {$_.Lastwritetime -lt (date).adddays(-7)} |
     remove-item -recurse -Confirm:$false

# Get current date for use in log file and format it to avoid
# invalid characters such as "/" and ":"

$today=Get-Date -format "MM-dd-yyyy"

# Create a folder in the backup location with todays date (sortable)

$todayFolder = $backupLocation + '\' + $((get-date).toString('MM-dd-yyyy'))
md $todayFolder

# Does not backup the /train site collection
# or the temporary web ap site collection on port 15702

# Disregard this, or use it, depending on whether you have a /train site collection, etc.

foreach ($site in get-spsite -limit all |
         where-object -FilterScript {$_.url -notlike "*/train*"} |
         where-object -FilterScript {$_.url -notlike "*15702"}) {
    write-Host Start backing up $site to $todayFolder
    try {
         # Create a new backup file and name it based on current date.
         # If you want to create only 1 backup file and overwrite it
         # each time the backup is run, you can replace "$today.bak"
         # with your desired file name.

         $pathName = ($todayFolder + '\' + $($site.ID) + '.bak')
         write-Host 'Backing up ' $site ' GUID = ' $($site.ID)

         # This farm does not have Enterprise SQL Server, so snapshots
         # cannot be used. This requires that the sites belocked for
         # update during the backup, so this should be run after hours

         Backup-SPSite -Identity $site -Path $pathName -EV Err
            -EA "SilentlyContinue"
         write-Host Backup succeeded.

         # Write success message to the log file
         write "$today $site GUID =
           $($site.ID) successfully backed up.">>logFile
    } catch {
        write-Host Backup failed. See $logFile for more information.
        # Write error message to the log file
        # change the logFile to some other name if you want, e.g. BackupHistory.txt
        $e = $Err[0].ToString()
        write "$today $site Error: $e">>logFile
Stop-SPAssignment -Global
Remove-PsSnapin Microsoft.sharepoint.powershell
write-Host "Finished script."

This blog has another script that you can use, also an easier to use version:

Make sure to update these variables:

$logfile = "SPFarm-Backup-" + $(Get-Date -Format dd-MM-yy) + ".log"
$ConfigDB = "SP_Config"
$DBServer = "server"
$BackupConfigFolder = "\\server\SharePoint\Backup\Config"
$BackupSAFolder = "\\server\SharePoint\Backup\ServiceApp"
$AdminEmail = <a href=""></a>
$MailServer = ""
$FromAddress = <a href="">sharepoint.notifications


Microsoft TechNet - - Backing up a Farm in SharePoint 2013

Petri blog - backup and restore advice - Good Read

John Ferringer on backups -

Microsoft's scripting guy defers to John Ferringer - - same here


Popular Posts