Wednesday, March 11, 2015

SharePoint Online Updated Feature: Limited-Access User Permission Lockdown Mode

Microsoft is at it again: Enabling features you didnt realize you needed until after a random update is applied, that leaves you banging your head against the desk for hours trying to figure out what has changed.  So is the case with a recent feature update called Limited-Access User Permission Lockdown Mode.

If you plan on setting unique permissions on a folder within a document library in Office365/SharePoint Online, you will need to disable this site feature that Microsoft has so graciously turned on for you.

You will know this feature has been enabled if you get this message when trying to apply unique permissions to a folder:

Here is Microsoft's notification regarding this change:

And more information regarding the feature can be found here:


Thursday, February 26, 2015

How To Fix One Drive for Business Sync Issues

A customer recently had an issue with syncing their SharePoint Online library with One-Drive for Business.  Some of the files were syncing properly, but some were throwing errors and displaying a red X.  Most of the time sync errors are caused by invalid characters or a bad file name, but this one wasn't the case.  Running repair didnt work, so I went in and manually cleared out all of the One Drive cache files and reconfigured the sync library.

Here's how to do that:

  1. Close all your Office processes like groove.exe, msouc.exe,  msosync.exe, etc
  2. Browse to “C:\Users\%username%\AppData\Local\Microsoft\Office\Spw” and delete all the content.
  3. Go to “C:\Users\%username%\AppData\Local\Microsoft\Office\15.0\OfficeFileCache” and also delete all content from this folder.
  4. After deleted everything,  start OneDrive again (using “C:\Program Files\Microsoft Office\Office15\GROOVE.EXE“)
  5. Configure the sync library again
Even Microsoft support couldnt provide this information to me, so hopefully this help you if you ever have a sync issue that you just cannot fix.

Thursday, October 9, 2014

SharePoint Powershell Scripting: Iterating through a Site Collection to find all BLOBs that havent been modified in over a year

This request came about during a SharePoint/Metalogix StoragePoint requirements gathering session with a customer.  They wanted to know what the storage savings would be if they externalized ONLY files that havent been modified in over a year vs all files.  Metalogix has a great tool affectionately called the "BLOBulator" which will analyze Content DBs (and drill down further into Site Collections), however as a free tool, there isnt much customization when it comes to filtering in criteria for said externalizations.

So I decided to use Powershell to iterate through a site collection of my choosing and output into a csv file. I could then do a quick calculation on all the documents to get a total size.

This script works fine, except at the end it will throw an error on the dispose function.  If anyone can help resolve that, please feel free to leave a comment and I'll update my post.  This script can also be adjusted to run against an entire we application as well.

Add this code to a text document and rename it with a .ps1 extension:

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue 

function Get-OldDocuments([string] $SiteURL)

{

    $Site = Get-SPSite $SiteURL


                foreach ($SPWeb in $SPSite.AllWebs)

                   {

                    foreach ($SPList in $SPWeb.Lists) 

                      {

                        # Get Document Libraries

                        if ($SPList.BaseType -eq "DocumentLibrary") 

                         {

                            foreach ($item in $SPList.Items)

                              {

                                $data = @{

                                "Site" = $SPSite.Url

                                "Web" = $SPWeb.Url

                                "list" = $SPList.Title

                                "Item URL" = $item.Url

                                "Item Title" = $item.Title

                                "Item Created" = $item["Created"]

                                "Item Modified" = $item["Modified"]

                                "Size (KB)" = $item.File.Length/1KB

                                "Size (MB)" = $item.File.Length/1MB

                                }


                                # add files older than 1yr old

                                $expireDate = Get-Date 
$expireDate = $expireDate.AddYears(-1)

                                if($item["Modified"] -lt $expireDate)

                                {

                                    Write-Host($SPSite.Url +"/"+ $item.Url)

                                    New-Object PSObject -Property $data

                                }

                            }

                        }
}
                     $SPWeb.Dispose();

                    }

                  $SPSite.Dispose()   

                }


#call the function 

Get-OldDocuments "http://sharepoint.com/site" | Export-Csv -NoTypeInformation -Path C:\temp\OldDocuments.csv



Thursday, September 18, 2014

"Save Site as Template" Option is Missing on Publishing Site in SharePoint 2013

At first glance, something appears to be wrong.  "Why cant you simply save the site as a template", I asked.  Perhaps Microsoft (in all it's infinite wisdom) decided to remove the "save a site as a template" feature by default with publishing sites.  That's okay, you can simply navigate to “_layouts/savetmpl.aspx” application page and save the site template, right?  Wrong!  This workaround does not work as expected in SharePoint 2013.

The url “_layouts/savetmpl.aspx” failed on the publishing site because by default in SharePoint 2013, “SaveSiteAsTemplateEnabled” is set as “false”.  Fortunately it's a very quick fix, simply change this switch to true in 3 simple steps!

  1. Open the site in SharePoint Designer
  2. Click Site Options from the ribbon
  3. Modify the "SaveSiteAsTemplateEnabled" and change it from "False" to "True"
The option still wont be displayed in Site Settings, but you can now you can navigate to “http://sitename/_layouts/15/savetmpl.aspx” and you will see the Save Site as Template Page as expected.

That's All Folks!





Friday, August 8, 2014

Iterate Through All Site Collections Within a Web Application to Change The Site Collection Administrator

If you have many Site Collections in a single web application and you want to set or change the Primary or Secondary Site Collection Administrator without going through each and every one in Central Administration, below is the script you can save as a .ps1 file and run in Powershell.  This script uses (-SecondaryOwnerAlias) to set the Secondary Site Collection Administrator. Change it to (-OwnerAlias) at line 19 to set the primary site collection admin.

## Input Parameters ##
[CmdletBinding()]
Param(
[string]$WebAppUrl=(Read-Host "Please enter a Web Application URL (Example: http://intranet)"),
[string]$Account=(Read-Host "Please enter an account (Example: DOMAIN\Administrator)")
)
## Add SharePoint Snap-in ##
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
### No need to modify these ###
$WebApp = Get-SPWebApplication $WebAppUrl
$AllSites = $WebApp | Get-SPSite -Limit ALL

##The Script - no need to modify this section ##
## Start SP Assignment for proper disposal of variables and objects ##
Write-Host "Starting SP Assignment..." -ForegroundColor Green
Start-SPAssignment -Global
## Use a ForEach-Object loop and Set-SPSiteAdministration to set an entire web application ##
Write-Host "Adding $Account to $WebAppUrl as a Site Collection Administrator..." -ForegroundColor Yellow
$AllSites | ForEach-Object { Set-SPSite -SecondaryOwnerAlias $Account -Identity $_.url }
## End SP Assignment for proper disposal of variables and objects ##
Write-Host "Disposing of SP Objects.." -ForegroundColor Green
Stop-SPAssignment -Global
## Tell us it's done ##
Write-Host "Finished!" -ForegroundColor Green

How To Set SharePoint Managed Service Account Password with PowerShell

Here is the scenario where this would be important:

Issue Cause
-       During the course of regular SharePoint administration duties a deployment process was hung up.  From past experience and part of the standard procedures in such situation, a SharePoint 2010 timer service was restarted and a command was run to force deployment of pending jobs.
-       When the jobs were forced to run, several pending jobs that were not scheduled to run were inadvertently triggered. The job that caused the issues was the automatic password change on SharePoint 2010 managed accounts. This job is typically scheduled for the 7th of every month, but is queued and marked as pending.  As the password change job was queued as pending the force command kicked off the password changes.  These jobs did not successfully complete and while the passwords were generated and updated in Active Directory, SharePoint was not updated.
-       This resulted in a password mismatch between the password in Active Directory and the password that the Web and Service Application Identities were using to run the sites. Furthermore, once the cached credentials on the IIS servers were refreshed the applications were no longer available.

Issue Resolution
Once the source of the problem was identified Admins needed to manually change the passwords on the affected accounts and then update the passwords in SharePoint.  Since CA was not accessible, passwords needed to be changed with PowerShell:

$P7 = ConvertTo-SecureString "password" -asplaintext -force

Set-SPManagedAccount -Identity <account name> -ExistingPassword $P7

Wednesday, July 16, 2014

THAT WAS EASY! How to check which Site Template was used in SharePoint 2013


Don't mess with logging into the server and running powershell cmdlets.  Here is the SUPER EASY way to check which Site Template was used in SharePoint 2013:

  1. Open your site in browser
  2. Open any page
  3. Right click on the page
  4. Select view source
  5. Search for: SiteTemplateID
List of Site Templates:
#0 - GLOBAL (SetupPath=global) - "Global template"
#1 - STS - "windows SharePoint Services Site", "Team Site", "Blank Site", "Document Workspace"
#2 - MPS - "Basic Meeting Workspace", "Blank Meeting Workspace", "Decision Meeting Workspace", "Social Meeting Workspace", "Multipage Meeting Workspace"
#3 - CENTRALADMIN - "Central Admin Site"
#4 - WIKI - "Wiki Site"
#7 - BDR - "Document Center"
#9 - BLOG - "Blog"
#20 - SPS (OBSOLETE) - "SharePoint Portal Server Site"
#21 - SPSPERS - "SharePoint Portal Server Personal Space"
#22 - SPSMSITE - "Personalization Site"
#30 - SPSTOC (OBSOLETE) - "Contents area Template"
#31 - SPSTOPIC (OBSOLETE) - "Topic area template"
#32 - SPSNEWS (OBSOLETE) - "News area template"
#33 - SPSNHOME (SubWebOnly) - "News Home template"
#34 - SPSSITES - "Site Directory area template"
#36 - SPSCOMMU (OBSOLETE) - "Community area template"
#38 - SPSREPORTCENTER - "Report Center Site"
#39 - CMSPUBLISHING (SetupPath=SiteTemplates\PUBLISHING) - "Publishing and Team Collaboration Site"
#40 - OSRV (SetupPath=SiteTemplates\OSRV) - "Shared Services Administration Site"
#47 - SPSPORTAL - "Corporate Intranet Site"
#50 - SRCHCEN - "Search Center"
#51 - PROFILES - "Profiles"
#52 - BLANKINTERNETCONTAINER - "Internet Presence Web Site"
#53 - BLANKINTERNET - "Publishing Site", "Press Releases Site", "Publishing Site"
#54 - SPSMSITEHOST - "MySite Host"
#90 - SRCHCENTERLITE (SetupPath=SiteTemplates\SRCHCENTERLITE) - "Search Center Lite"
#6221 - PWA (SetupPath=SiteTemplates\PWA) - "Project Web Access Site"
#6215 - PWS (SetupPath=SiteTemplates\PWS) - "Project Workspace"
#14483 - OFFILE - "Records Repository", "Records Repository"