Falchion.PowerShell.CopyAsHtmlAddOn.zip
This is an add-on for Windows PowerShell ISE V3 which allows you to copy text as HTML for pasting into applications such as Windows Live Writer. You can find more details here.

SharePoint 2007 has made great improvements over previous versions in the handling of item versioning. However, many have noticed that web part pages did not benefit from the versioning changes. While page fields and associated meta data is properly versioned, web part changes are not. This is true of publishing pages as well as standard web part pages within a document library. The purpose of this project is to capture these changes and allow a seamless integration with the out of the box restore mechanisms.

A simple template Visual Studio project that can be used as a starting place for creating your own custom SharePoint 2007 STSADM extensions. The project includes utilities and classes to help declare and work with parameters as well as build a WSP solution to deploy your new extensions.

I presented this at the European Best Practices Conference in London, April 2011. There's really not much going on in the deck as the bulk of the presentation was walking through various PowerShell examples.

I presented this at the European Best Practices Conference in London, April 2011. There's really not much going on in the deck as the bulk of the presentation was walking through various PowerShell examples.

I recently presented this deck at the Colorado Springs SharePoint User Group Meeting and did a trimmed down version of it for a live webcast in March. There's also a recording of the demo (~21MB) which I used during the presentation (the recording does not contain any audio but will help you see what the upgrade experience looks like).

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly ‘Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’ or one of its dependencies. The system cannot find the file specified.File name: ‘Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’ at Microsoft.SharePoint.StsAdmin.SPStsAdmin.Main(String[] args)

I’m trying to install the powershell and I’m getting an error Error 1001 Unable to get installer types in the c:\program files\Gary Lapointe\PowerShell Commands for Sharepoint. PowerShell.Commands.dll assembly -> Unable to load one or more of the rquested types. Retrieve the LoaderExceptions property for more information. Any ideas?

I have downloaded the STSADM Commands template to create my own operations. It was working fine until recently that my team wants to sign the assembly with another key with password protected. (Default used: key.snk)

When I build the program and tries to list down the operation in the Command Prompt, I received an error.

Do I need Powershell installed to run the commands. I downloaded the Moss only .wsp and tried running the first command as per instructions in the same directory. Gets the ‘stsamd is not recognized error’.am i missing anything

Is there a way to use your commands to set or create a new site collection role? Example: I have been asked to create a new role called “Author” and grant all permissions except Create subsites. This is not a web app policy but rather created under each site colleciton, of which we have over 50

I installed the MOSS commands withoout a problem. However when i install the WSS commands I get the following error: A solution with the same name “lapointe.sharepoint.stsadm.commands.wsp” or id “2625fbe6-4884-4666-a1ae-6b06f0db8a6f” already exists in the solution store.Lapointe.SharePoint.STSADM.Commands.WSS.wsp: The Solution installation failed.

Hi GaryI have 5 different master pages which needs to be applied to the site on daily basis. I dont have powershell and would like to make a .bat file and use windows scheduler to apply the masterpage. How can I go about this?? Thanks..

We have got 5 masterpages with different color schemes so need to apply different color on different day… So would like to do it automatically…. I tried what you explained in your blog… but getting an error on these lines:

You should just deploy the WSP and call the command rather than trying to call my assembly directly from code (it’s not really intended to be used by code). If I were you though I’d change my master page so that it dynamically loads a css file based on the day rather than trying to swap the master page every day (1 masterpage, 5 css files) – changing the masterpage daily is a very unusual way to solve the problem you’ve identified.

I’m attempting to install the PowerShell commands Setup64.msi on a 64-bit OS (W2K3 R2) with MOSS 2007 SP2 and get the following error: “Error 1001: An exception occured in the OnAfterInstall event handler of Lapointe.SharePoint.PowerShell.Commands.SnapIn -> The SPFarm object cannot be null”.

First of all congratulations for this set of tools. Unfortunately, I can’t use them and dunno why.I’m using WSS 3.0 and I installed the WSS tools version without problems.I can see the new commands just executing stsadmn. However, when I try to use them or run the help with any of your commands, it’s like if it were a wrong command what was specified.

Patrick – try playing with some of the include and exclude parameters (can’t remember what I named them but do a help on the commands and you’ll see them) – you should be able to exclude all dependencies and children on the export.

I am unable to download any of the files. I jsut get a Page cannot be displayed error from every computer I am trying this from. I’m not the smartest guy in the world but I am usually pretty good at downloading stuff. Any chance you could help me with this? The tools sound great and could make my life much easier.

First of all thanks for the wonderful article.I ran this command on Widows 2003 OS with SP1 on dev server and everything worked fine. I want to run the comand on productio server which has Win 2008 server with SP1. Is it okay to run the stsadm command with SP1 on Win 2008 OS. Thanks for your help.

That sounds like there’s something wrong with your farm. I’m assuming you’re using an account that has farm admin rights and that you have the path to the WSP file path correct and that your farm is actually built (you’d probably get a different error otherwise). You might want to check the ULS logs to see if you can get a stack trace – that might help to narrow down the issue.

Is there a way to change the ID of this solution? Some must have created a solution with the same name. I get A solution with the same name “duke.sharepoint.stsadm.comands.wsp” or id “2625fbe6-4884-4666-a1ae-6b06f0db8a6f” already exists in the solution store.

Hi,I’m trying to install the commandlets on a 64-bit OS with MOSS 2007, but, like John, I see the following error:“Error 1001: An exception occured in the OnAfterInstall event handler of Lapointe.SharePoint.PowerShell.Commands.SnapIn -> The SPFarm object cannot be null”You responded by saying this could be because PowerShell v2 was installed instead of v1. My machine definitely has v1. Are there any other causes for this error?Thanks

Scripting all the service applications is possible but very complex. There are some scripts that have been posted (by myself and others) – I’ll eventually post for all of them but I’m not quite ready to do that (and may delay for quite a while as I’m writing a book which will cover this and don’t want to blog all my content).

After installed, in powershell I get an error;There were errors in loading the format data file:Lapointe.SharePoint.PowerShell.Commands, C:\Program Files\Gary Lapointe\PowerShell Commands for SharePoint\Console.psc1 Commands for Sharepoint\Lapointe.SharePoint.Format.pslxml : File skipped because of validation exception: “File C:\Program Files\Gary Lapointe\PowerShell Commands for SharePoint\Lapointe.SharePoint.Format.ps1xml cannot be loaded because the execution of scripts is disabled on this system

Sean – unfortunately no – the architecture for stsadm (and indeed just about everything else) changed drastically between 2003 and 2007 so none of the stuff I’ve put together will work on 2003 – time to upgrade

I have been trying to use the CopyList and Import/Export commands and while it claims i have been successful nothing is appearing in the target list – the log files record the list item ids being copied but nothing appears in the target list? any ideas

Have to ask the obvious first: are you using the SP Management Shell or otherwise loading the snap-in (after installing the WSP)? If you’re in the same session as you were when you installed the WSP then you need to remove the snap-in and re-add it.

If you load the SharePoint 2010 Management Shell then that will have the SharePoint PowerShell snap-in loaded which includes the Add-SPSolution cmdlet. You can then install my 2010 cmdlets and you’ll have the Backup-SPSite cmdlet that replaces the gl-backupsites stsadm command.

I’ve found that the sp2010 commandlets install into the GAC but I can’t use Add-PSSnapin to include them into the command shell (either a new one or the existing one). Also, an entry for the snapin doesn’t show up in the registry here:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellSnapIns

Mark – just saw your first comment so now your statement about add-pssnapin makes more sense to me (downside of reading email from most recent first).

So – my PowerShell commands don’t are not a standalone snap-in – they are registered by the Microsoft.SharePoint.PowerShell snapin so there’s nothing you need to do other than deploy the WSP. This adds the appropriate registration files that are needed by the SharePoint Snapin so that the cmdlets are registered just as though it were part of the built in snap-in.

If you load the SharePoint 2010 Management Shell then that will have the SharePoint PowerShell snap-in loaded which includes the Add-SPSolution cmdlet. You can then install my 2010 cmdlets and you’ll have the Backup-SPSite cmdlet that replaces the gl-backupsites stsadm command.

OK, I figured out why add-spsolution didn’t work. It requires the full pathname of the file even though the file is in the current directory. I’m an old-timey command-line guy, but I gotta ask … who really thinks PowerShell and Exchange Management Shell and SharePoint 2010 shell are better?

PowerSehll as a technology is better but it’s up to the cmdlet authors to test their stuff properly – and in the case of SharePoint, testing was not exactly optimal. In this case they should have accounted for a relative path but they didn’t test that scenario. One way you can get around it is to use the Resolve-Path cmdlet.

Thanks Ivan! I had made a change to my analytics stuff and didn’t realize that Google made a breaking change with their updated page tagging. I reverted back to the old code and that seems to have fixed it.

I’m working on it. I had only partially migrated the blog as the downloads were coming from the domain which also hosts my email and I wasn’t ready to move that. I’ve updated my DNS information this morning for that domain so eventually it will point to the new location.

I’m working on it. I had only partially migrated the blog as the downloads were coming from the domain which also hosts my email and I wasn’t ready to move that. I’ve updated my DNS information this morning for that domain so eventually it will point to the new location.

I’m working on it. I had only partially migrated the blog as the downloads were coming from the domain which also hosts my email and I wasn’t ready to move that. I’ve updated my DNS information this morning for that domain so eventually it will point to the new location. As for the speed – it was much slower on my old hosting provider but I feel it is running much faster now – at least it is from where I’m sitting.

Great tools Gary. I was just wondering if you have added to them, a way to export/import keywords, Best Bets, and Scopes…I know there’s a way to do it, but I’m certainly no programmer and not sure how to do it. I’ve found this blog, but it’s over my head.

Hi Gary,
I an trying to deploy SharePoint 2010 STSADM Commands and PowerShell Cmdlets WSP Files.I kept the file at 14/Bin folder.Now when I am trying to run the command
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN>Add-
SPSolution Lapointe.SharePoint2010.Automation.wsp, it is showing
‘Add-SPSolution’ is not recognized as an internal or external command,
operable program or batch file.

Hi Gary, while i am trying to run stsadm –o gl-copycontenttypes –sourceurl “http://intranet/operations” -targeturl “http://intranet/hr” -nodoctemplate, i am getting the follwing error.”Missing operation name or the operation name is invalid”. The same error is also coming while i am doing for list import and export command. Please help me out.

Gary,
I really appreciate your presentation you gave in Denver this weekend. I looked for the PowerPont but none of those listed on your site are the one you used in the presentation. Could you send me a link to it? Thank you!

Hi Gary, I’ve downloaded and successfully installed the SharePoint 2010 Server Cmdlets (x86, x64) on my sharepoint server. However, im not capable of running any of the cmdlets. Its like they dont exists. The WSp intalled properly. If I do a Get-Command your cmdlets are not listed. Have I missed any steps?

Excellent Tools. I’m getting an error trying to convert a web to a site.

ConvertTo-SPSite : Value cannot be null.
Parameter name: uriString

By looking at some of the blog entries it looks like you recommended to another getting the same error to download the source code and deploy the debug version so they can get the stack trace. I’ve downloaded the source code and have built it, but my question is how do I install it. I thought maybe there would be a new wsp file but I don’t see one. I just see the dlls. Do I need to put the dlls somewhere or register them?

We have a customized SharePoint 2010 web site that uses Publishing Infrastructure.

We have a requirement to separate each sub site into a site collection. When we tried the standard steps to migrate a sub site to a site collection, we keep getting this error in the event log –> “This page is not using a valid page layout. To correct the problem, edit page settings and select a valid page layout”.

Check with SharePoint Manager 2010 if the “Description” propertie does exist inside the XML in Role propertie of the web, that you are going to export. In my case, some XML had no description attribute and it was the reason of such error. I`ve edited empty “Description” field of role definition in UI by simple editing (have added 1 sign in empty field and delete it) and saving after that. That was the solution.

HI Gary, I have installed “MOSS Only STSADM Extensions (x86, x64)” on my 2010 farm but I am getting the error “Microsoft SharePoint Foundation Administration Tool has stopped working”. I get this error only when I execute the command
stsadm -help gl-execadmsvcjobs

Rest all the commands run fine.Please suggest.

Also removed the first one and then deployed “SharePoint 2010 Foundation Only Cmdlets (x86, x64)
” but still get the same error for the same command.

New User question, i have installed your SharePoint 2010 STSADM Commands and PowerShell Cmdlets WSP File, its added and deployed sucessfully (globally), but when i enter any of the commands, e.g. “Propagate-SPContentType” it says thats not the name of an existing cmdlet, please help. thank you!

Ali,
I had the same issue. I believe it is due to either the fact I was copying navigation to a site where the same content and structure did not exist, or if it was because I was copying to a site with a managed path.
I was able to get around the error by opening the xml file after the export completed, and modifying the second line as follows:

Changed from serverRelativeUrl=”/” to serverRelativeUrl=”/mymanagedpath/mytargetsite”

Gary, I attended “Automating SharePoint Administration with Windows PowerShell – 2013″ and would like your code if it is still available. I search your blog, but could not pinpoint it. It was a great class. I am still learning. Thanks.

I assume you’re talking about the webinar I did for penton media? I honestly don’t remember what code I referenced in that class. If you bing/google a function name that I used you should be able to find it on the blog (assuming I blogged about it). There’s no general download for that webinar.

Gary, Great set of tools, thank you for your efforts. Is it possible to use gl-exportlist from SP2010 and gl-importlist to SP2013. The export from 2010 went great but I am getting a mysterious “Command Line Error” when I run the gl-importlist command on the SP2013 side. I am wondering if anything can be manually edited to allow this type of migration. Thank s again.

Pretty sure going from 2010 to 2013 won’t work though not sure why you’re getting a command line error. Either way you should use the cmdlets and not the stsadm commands as I’ve not invested any time in making sure stsadm still works (they just kind of came along for the ride and I made sure they compiled and that was it – cmdlets are the way to go).

When I run the Add-SPSolution $pwd\Lapointe.SharePoint.PowerShell.wsp command I get the following exception

Add-SPSolution : Could not load file or assembly ‘C:\Windows\Temp\solution-eb80f134-4905-4db4-a58e-a1babd20f154\Lapointe.SharePoint.PowerShell.dll’ or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
At line:1 char:15
+ Add-SPSolution <<<< $pwd\Lapointe.SharePoint.PowerShell.wsp
+ CategoryInfo : InvalidData: (Microsoft.Share…dletAddSolution:SPCmdletAddSolution) [Add-SPSolution], BadImageFormatException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletAddSolution

I added and installed the solution for SharePoint 2010 server cmdlts, but they did not show when I entered Get-Command. Is there anything else involved in the installation to make these cmdlts available for use?

Trying to use your cmdlet help generation code, and I’m having some problems getting it to go. I’m able to reference the dll in my project, and I added just a cmdletdescription decoration to my code. Then in PowerShell I followed your instructions on loading the generator assembly and calling the generateHelp method with the path to my cmdlet.dll and targetpath, and the bool for onefile set to true. I get the following error:
Exception calling “GenerateHelp” with “3″ argument(s): “The given key was not present in the dictionary.”
At line:1 char:1
+ [Lapointe.PowerShell.MamlGenerator.CmdletHelpGenerator]::GenerateHelp …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : KeyNotFoundException

I’ll be posting it shortly. I just have to fix a script that I included in the deck so as soon as I get that done I’ll post it. If you want to see it sooner then send me an email and I’ll send you what I presented.

I have done term store export and import Import-SPTerms, a number of time for various clients and really the only issue I have had is unknown users in the destination farm which is quick search and replace in the .xml.
However in the case of getting a UAT term store to a standalone dev farm ( same patch level) I am getting:

WARNING: The Source Term, Quality, was not found. Quality will be created without linking.
Import-SPTerms : Terms can not be shared multiple times in the same term set
At line:1 char:1
+ Import-SPTerms -TaxonomySession https://intranet.domain.com -InputFile C:\Dev …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Lapointe.ShareP…dletImportTerms:SPCmdletImportTerms) [Import-SPTerms], TermStoreOperationException
+ FullyQualifiedErrorId : Lapointe.SharePoint.PowerShell.Cmdlets.ManagedMetadata.SPCmdletImportTerms

Looked at the XML and nothing odd appears – haven’t tried individual term groups as yet. BTW I have sent more details to you in a email.

Thanks for asking. Right now you can’t post the entire source but if you want to post the changes you made that’s fine. I’d just prefer people to download the main source from my site for now. I may eventually move it into github and then you can create your own fork but for now it is what it is (mostly because I’ve not had time to migrate it and want to make sure I do it right when I do).

Thanks for your reply. I would be very grateful if you would move the source to git ASAP. I have several projects (clients) that urgently need a solution like your various cmdlets but they are reluctant to adopt your solution because of a couple of bugs / gaps in the cmdlets. Of course we / they can each individually modify the source but that wastes effort in duplicating the changes, and they are less likely to both to do so if they don’t see the benefit of the shared code base and community collaboration. Instead they may simply abandon the Lapointe cmdlets and roll their own. It is really the community value add that makes the shared tools and source code valuable. Thanks for listening.

Do you have any build notes to go along with the source code? For example I didn’t have the correct Windows SDK on my machine so I got a build error. Of course I can work through any pre-reqs and issues one by one, but it would be useful to have all the info up front. Also, given that VS solution contains both the SP2010 and SP2013 versions of the source, I presume that means I build everything on a SharePoint 2010 dev box including the SP2013 version of the tools. Is that correct?

Has anyone ever run into something list this? installed the 2010 Foundation cmdlets with the .wsp
receiving this when opening sharepoint mgmt shell:
Could not load type ‘Microsoft.Office.Server.Audience.Audience’ from assembly ‘M
icrosoft.Office.Server.UserProfiles, Version=14.0.0.0, Culture=neutral, PublicKe
yToken=71e9bce111e9429c’.
a subset of the cmdlets installed. missing get-spgroup for example.
this occurs on two separate rackspace servers at version 14.0.7132.5000 (sept 2014)

Unfortunately I don’t currently have a SP2010 Foundation server that I can use to test (had to trash my last VM with it and haven’t had time to build a new one). It’s entirely possible that somewhere along the line I introduced a cmdlet or something that is referencing this assembly which wouldn’t exist on Foundation. I did a quick search through the code and couldn’t find anything that stood out.