PowerShell

Error occurred in deployment step ‘Recycle IIS Application Pool’: The local SharePoint server is not available.

For security and availability purposes we’ve moved away from using the SharePoint Farm account for development. Adding new devs to your farm can be pretty simple if you know what tools to use. Frist, I always add my devs to the local admin group. Second you need to run the following commands. This adds the domain user to the appropriate roles Get-SPDatabase | Where-Object {$_.WebApplication -like “SPAdministrationWebApplication”} | Add-SPShellAdmin domain\username…

Run C# code in PowerShell

Ever wanted to run a snippet of C# code in PowerShell? Some times this is useful for testing code in environments without requiring a full deployment of software. This can also be used and an advanced troubleshooting technique. Open a PowerShell Prompt with Elevated permissions. Load your C# class into a string variable C:\Temp>$source = @" public class MathClass { public static int Add(int a, int b) { return (a…

Execute .NET Compiled code from PowerShell

I was troubleshooting some third party software the other day, it was some .NET code that was written by another vendor. Their logging scheme was lacking and the error on the browser side was less than helpful. I was mulling over the problem and the thought occurred to me, can’t I just load the DLL in to PowerShell and start executing methods until I find the problem? After a little…

PowerShell

Powershell – Get Site Template ID

The following PowerShell script will return Template Name and the Internal ID. $url = “http://sp2013/” $site= new-Object Microsoft.SharePoint.SPSite($url ) $loc= [System.Int32]::Parse(1033) $templates= $site.GetWebTemplates($loc) foreach ($child in $templates){ write-host $child.Name “ ” $child.Title}

PowerShell

Powershell – Access Request Settings (SharePoint 2010 & 2013)

I had a request to turn on all access requests or notifications on all sites with a web application. PowerShell is your best bet for doing these types of occasional tasks. This script will turn access requests on for all sites. Change the email address below to the intended recipient. # Get All Web Application $webApp=Get-SPWebApplication # Get All site collections foreach ($SPsite in $webApp.Sites) { # get the collection…

PowerShell

PowerShell – Find SharePoint Group Assignments

This PowerShell script will enumerate through all sites in the collection and return any sites that contain a given group name. Replace the red text, Administrative Members with the name of the group. # Get All Web Application $webApp=Get-SPWebApplication # Get All site collections foreach ($SPsite in $webApp.Sites) { # get the collection of webs foreach($SPweb in $SPsite.AllWebs) { foreach($SPG in $SPweb.Groups) { if ($SPG.Name -eq “Administration Members“) { Write-Host…

SharePoint 2013 place holder

SharePoint Powershell , Get all site workflows by list

This PowerShell Script returns all sites that have a list with workflows. It pipes to an output file named output.txt $webApp=Get-SPWebApplication "Powershell script by Jeremy @ <a href="http://www.BondByte.com">http://www.BondByte.com</a>" | Out-File output.txt " "  | Out-File output.txt -append    # Get All site collections     foreach ($SPsite in $webApp.Sites)     {        # get the collection of webs        foreach($SPweb in $SPsite.AllWebs)         {         foreach($SPList in $SPweb.Lists)         {         if…