Upload a .STP Template File
This is a quick way to programmatically upload a .STP template file within SharePoint using PowerShell – useful if you’re transferring list templates from a development to a live environment. $web =...
View ArticleHow Many Users In An Active Directory Group?
This is a useful PowerShell snippet for determining how many users there are in an Active Directory group. (Get-ADGroup "CN=MyGroup,DC=domain,DC=co,DC=uk" -Properties *).Member.Count
View ArticleTrouble Shooting SharePoint Errors
For viewing in command prompt: Get-SPLogEvent | ?{$_.Correlation -eq "<GUID>"} | SELECT Area, Category, Level, EventID, Message | Format-List Export the results as text file: Get-SPLogEvent |...
View ArticleUsing PowerShell To Analyse The Contents Of A Folder
# The path to interrogate $targetPath = "X:\Shared\FolderToBeInterrogated" # The path to save the exported report $exportPath = "C:\Reports" # Recursively get all files Get-ChildItem -Path $targetPath...
View ArticleSharePoint Content Type IDs
This is a handy PowerShell snippet for returning a list of all Content Types and their IDs within a SharePoint site. $site = Get-SPSite http://www.domain.com $web = $site.RootWeb ForEach( $contentType...
View ArticleSecure credentials within PowerShell
For PowerShell scripts that need to access resources (e.g. a site within SharePoint) and be run as scheduled tasks, I will normally use an encrypted password… Read-Host "Enter Password" -AsSecureString...
View ArticleCreating SharePoint alerts via CSOM
I’m posting this as a useful reminder. It outlines how alerts can now be created via CSOM. New SharePoint CSOM version released for SharePoint Online – February 2017 The included code sample is in C#,...
View ArticleTask Scheduler & PowerShell
To manage repeating tasks, its common for us (the team I work with 9-5) to automate things with a PowerShell script and then schedule it to repeat at specific times using a scheduled task. When I...
View ArticleAdding users to a Yammer group
I’m making a note of this blog post as I can foresee a future need to be able to subscribe specific subsets of users to Yammer groups. How To Add A User To Yammer Group Using PowerShell Also see the...
View ArticleInvoke-SqlCommand
For whatever reason, sometimes you just can’t upgrade the installed version of PowerShell on a server. In this case, I wanted to make use of the Invoke-SqlCommand command. The most simple way around...
View Article