MOSS MVP

I've moved my blog to http://blog.falchionconsulting.com!. Please update your links. This blog is no longer in use--you can find all posts and comments at my new blog; I will no longer be posting to this site and comments have been disabled.

Thursday, August 9, 2007

STSADM/PowerShell Commands

Below you will find a listing of all the STSADM commands and PowerShell Cmdlets that I've created.

Select the listing you would like to view:

As Released By Category Total Commands: 144
WSS Commands (available in both the WSS and MOSS downloads) MOSS Commands (only available as part of the MOSS download)
  1. gl-setnavigationsettings
  2. gl-createquotatemplate
  3. gl-editquotatemplate
  4. gl-setallowaccesstoonlinegallery
  5. gl-disableuserpermissionforwebapp
  6. gl-enableuserpermissionforwebapp
  7. gl-setselfservicesitecreation
  8. gl-connecttoportalsite
  9. gl-setsitecollectiontitle gl-setsitegeneralsettings
  10. gl-enuminstalledsitetemplates
  11. gl-enumavailablesitetemplates
  12. gl-addavailablesitetemplate
  13. gl-removeavailablesitetemplate
  14. gl-enumfeatures
  15. gl-copycontenttypes
  16. gl-repairsitecollectionimportedfromsubsite
  17. gl-convertsubsitetositecollection
  18. gl-enumtimerjobdefinitions
  19. gl-exportlist
  20. gl-importlist
  21. gl-copylist
  22. gl-getlistschemaxml
  23. gl-enumunghostedfiles
  24. gl-reghostfile
  25. gl-deletelistfield
  26. gl-moveweb
  27. gl-managecontentdbsettings
  28. gl-addsiteadmin
  29. gl-deleteweb2
  30. gl-upgrade2
  31. gl-enumpagewebparts
  32. gl-movewebpart
  33. gl-setwebpartstate
  34. gl-replacefieldvalues
  35. gl-publishitems
  36. gl-import2
  37. gl-setsearchcenter
  38. gl-replacewebpartcontent
  39. gl-enumeffectivebaseperms
  40. gl-createwebapp
  41. gl-deletewebapp
  42. gl-exportlistitem
  43. gl-importlistitem
  44. gl-copylistitem
  45. gl-deletelistitem
  46. gl-exportlistfield
  47. gl-importlistfield
  48. gl-updatelistfield
  49. gl-deletelist
  50. gl-copylistsecurity
  51. gl-updatelistview
  52. gl-setauditsettings
  53. gl-setusageanalysis
  54. gl-adduser2
  55. gl-adduserpolicyforwebapp
  56. gl-addlistitem
  57. gl-exportlistitem2
  58. gl-movesite
  59. gl-applytheme
  60. gl-createcontentdb
  61. gl-createsiteindb
  62. gl-exportcontenttypes
  63. gl-exportsitecolumns
  64. gl-importsitecolumns
  65. gl-setanonymousaccess
  66. gl-extendwebapp
  67. gl-unextendwebapp
  68. gl-backupsites
  69. gl-backup
  70. gl-exportlistsecurity
  71. gl-importlistsecurity
  72. gl-propagatecontenttype
  73. gl-exportlistfolder
  74. gl-importlistfolder
  75. gl-setmetadata
  76. gl-tracelog 
  77. gl-addlist
  78. gl-deleteallusers
  79. gl-setlistcontenttypes
  80. gl-addlistviewwebpart
  81. gl-enumemailenabledlists
  82. gl-addeventreceiver
  83. gl-deleteeventreceiver
  84. gl-enumeventreceivers
  85. gl-updateapppoolaccount
  86. gl-execadmsvcjobs
  87. gl-activatefeature
  88. gl-deactivatefeature
  89. gl-recalculateusage
  90. gl-setmasterpage
  91. gl-syncquotas
  92. gl-setlistproperties
  93. gl-setbackconnectionhostnames 
  1. gl-setmastersitedirectory
  2. gl-setuserprofiledefaultaccessaccount
  3. gl-setuserprofileimportschedule
  4. gl-gen2003to2007profilepropertymap
  5. gl-migrate2003profilesto2007
  6. gl-setpictureurlnewpath
  7. gl-setsitenamingformat (use gl-mysitesettings instead)
  8. gl-enumnavigation
  9. gl-addnavigationnode
  10. gl-setnavigationnodes
  11. gl-copynavigation
  12. gl-enumavailablepagelayouts
  13. gl-fixpublishingpagespagelayouturl
  14. gl-retargetcontentquerywebpart
  15. gl-applyupgradeareaurlmappings
  16. gl-updatev2tov3upgradeareaurlmappings 
  17. gl-setlocalsitedirectory
  18. gl-setsitedirectoryscanviewurls
  19. gl-enumprofileprivacypolicies
  20. gl-setprofileprivacypolicy
  21. gl-enumprofileproperties
  22. gl-editprofileproperty
  23. gl-setsspacl
  24. gl-createsearchscope
  25. gl-updatesearchscope
  26. gl-addsearchrule
  27. gl-retargetgroupedlistingswebpart
  28. gl-sitewelcomepage
  29. gl-enumwelcomepages
  30. gl-fixvariationrelationships
  31. gl-fixpagecontact (deprecated – addressed with the August 2008 Cumulative Update)
  32. gl-runprofileimportjob
  33. gl-createaudience
  34. gl-addaudiencerule
  35. gl-enumaudiencerules
  36. gl-deleteaudience
  37. gl-importprofileproperties
  38. gl-listaudiencetargeting 
  39. gl-updatedefaultcontentaccessaccount
  40. gl-createpublishingpage
  41. gl-setpictureurl
  42. gl-replacenavigationurls
  43. gl-configuresso
  44. gl-exportaudiences
  45. gl-importaudiences

There are also 4 commands related to timer jobs which I did not create so I won't list them here. I'll add to this list as I create more commands.

189 comments:

Renatas said...

Wow! This is absolutely fantastic set of tools.

Sherman Woo said...

Awesome, just awesome... and thank you thank you thank you! Thank you for doing, and most of all, thank you for sharing!

Jeff said...

Great tool. I was able to move a document library. My only question is my doc library does not inherit permissions. I tried the includeusersecurity but it still creates the new doc library with inherited perms. Any suggestions?

Gary Lapointe said...

Jeff - this definitely appears to be a bug with the deployment API. I know that's a crapy answer but unfortunately I'm completely at the mercy of the API unless I want to create my own from scratch (beginning to think I'll have to considering the number of bugs I've discovered with it). I've sent an email to Stefan Gobner who wrote the original article that I based my code on - hopefully he has some suggestions or can at least help to get it addressed in a future service pack. In the meantime I'm going to work on a new command (CopyListSecurity) which will hopefully help. I've found that the same inheritence issue exist for list items as well - not just the list itself. This seems like a real weakness with the API because it would be easy for someone to assume that the list's security settings were preserved when in fact they weren't.

aiwa said...

Thansk for providing the list of stsadm command. I'm wondering is there any tool or command where can use to delete contents in document libraries of site collection?

Gary Lapointe said...

The deletelistitem command will allow you to delete items from a document library or any other list type: http://stsadm.blogspot.com/2007/11/import-export-copy-and-delete-lists.html.

huyentruong said...

This is a fantastic tool, thank you. I have a question: how can i create about 2000 lists on a site by using stsadm command line.Could you please give me a solution?
Thanks so much
Huyen

Gary Lapointe said...

2000 Lists?!?! - wow - Are all the lists supposed to be in the same site? Are they all different? There's a few ways you could do it - you could set up a list the way you want as a template and then export the list without compression. This produces a Manifest.xml file which you could then manipulate with an xslt or code which and then write some more code to loop through some other data source defining your list creation criteria and import the manipulated site. If the list is simple then just bypass the Manifest.xml stuff and programatically add the list and it's columns. Unfortunately I've got nothing to do all of this but there are pieces that you can use (importlist if you choose to use the template and importlistfield if not (though you'll probably want to just pull the code and refactor into your own solution rather than trying to use my commands directly)).

wss101 said...

nice collection, great tool.

ryan.johnson said...

I am trying to export a site and then import it to a diffenent farm. Is there any way to bring over the created and modified dates along with the created by and modified by information.

This is a great site, thanks for sharing!

Ryan

Gary Lapointe said...

Ryan - I'm pretty sure that if you use the -includeusersecurity setting that it will preserve this information.

Matt said...

Gary,
Great set of tools. Thanks for sharing your efforts. I was curious if you might be able to tell me if your export tools are capable of exporting a site structure without any of the files. I want to copy a large site that has 1000's of files but only want the structure and security from the original site.
Thanks,

Gary Lapointe said...

Matt - Unfortunately I don't have a way to do this. I'd recommend just saving the site as a template and using that (you can exclude content with this approach). See this article on how to do it: All you ever wanted to know about SharePoint 2007 Site Templates

AAron nAAs said...

Wow. This is interesting reading as I have done a few console apps for the same thing. Now I want to rewrite everything as stsadm extensions! Thanks for contributing your research and snippets to the community!

Eric Popoff said...

Hello Gary!

Thanks for sharing your work with us :-)

I've been studying the commands looking for something I can use to set Document Library permissions. When I use a template to create doc libraries in a new site collection, they inherit the parent permissions. But, I need to set granular permissions on the individual libraries. Have you encountered this problem?

Thanks for your code and help!

Eric

PS: I'm also in CO - working for Ball Aerospace in Boulder!

Gary Lapointe said...

Eric - sorry for not getting back sooner (been a crazy week) - take a look at the copylistsecurity command - you should be able to take some of the code from that and tweak it to meet your needs (I don't have anything to do explicitly what you're looking for).

bryan said...

Gary,
Great stuff above. I have been looking for a list like you have provided, thanks.
Off subject here, but I live in Vail, Co and have been looking for someone local with extensive SPS, InfoPath, Project Server, SQL experience. I've even contacted NH with no help. I have quite a few questions with a few ideas I have in using the above technoligies together. Any suggestions?
Thanks,
Bryan

Gary Lapointe said...

Bryan - I haven't worked with Project Server but I've done a bit with SPS, InfoPath, and SQL Server - I've been real impressed with the guys that I've met at my new job at Statera and I'd recommend getting in touch with them - if you send me your contact info and what you're looking for I'd be happy to get you in touch with the right people to see if there's anything we can do to help you out (you can email me at glapointe at statera dot com). If we're not the right fit then we'll do our best to get you hooked up with another Microsoft partner that can help you.

Guillaume said...

Hi Gary,
many many thanks for sharing these great extensions. It's already helped me to
automate a number of tasks which I had to do manually!
I have a quick question for you though:
I am currently having to assign read permissions to an existing group over a
large number of sites and sub-sites that get re-generated every night.
So the only way I have found so far is to perform the following actions for
EVERY site URL:
- click "New", "Add Users"
- type the group name
- tick the "Give users permission directly" and the read permission checkbox.
Needless to say, this is far from being ideal.
I was wondering whether one of your stsadm extensions could help me automate
this process?
Many thanks in advance for your attention!
Guillaume

Gary Lapointe said...

I currently don't have anything that will do what you are looking for. I have to admit that I'm curious as to what your requirements are that result in these sites being re-created every night. One thing you may try is rather than assigning permissions directly to the site set up a policy within central admin for the web application that the sites live in.

Anonymous said...

Since export / import doesn't handle things like alerts, you might want to create an exportAlerts / importAlerts function.

Anonymous said...

Truly a great work! Thank you! I am looking for a utility to do a massive delete of User Profiles in MOSS. While your tools are awesome I could not find this feature. If you feel inspired to add this extension I would be even more grateful. Thanks for you awesome work!

Sherm said...

Gary, didn't know how else to contact you. Just wondering if you are in Seattle at SPC. Would be cool to meet you and say thanks in person. If you are here, email me!

Gary Lapointe said...

Sherm - yes, I'm at the SPC - I'm currently about to head out to Matthew's Advanced Search Configuration talk. If you see a guy looking very tired and wearing a Boston Bruins cap, that's me (I'm usually in the front row of the sessions I attend). Hope to see you and enjoy the conference...

Anonymous said...

Cool! Thank you for your great job. I am not a programmer but your tool is very useful for me. I downloaded the tool (not source code) but I don't know where I should to paste the file "Manifest.xml" ? By the way, I am using wss3.0, can these tool work well on it?

Gary Lapointe said...

You'll want to use the built in stsadm addsolution and deploysolution commands to deploy the WSP (you don't do anything with the contents of the WSP). If you don't want to use the WSP approach you can download the source and GAC the dll and copy the xml file to the 12 hive's config folder.

Anonymous said...

Thanks for sharing this great work. I am try to figure out how to extend an existing web application using a stsadm add-on.

Do you know how to do this via code. The MSFT help talks about adding an entry to SPIisSettings but I don't see any where to set port, virtual directory etc for new site.. any ideas?

Gary Lapointe said...

I haven't documented it yet but if you download the latest code you'll see that there's a new command called gl-extendwebapplication (note that I'm starting to prefix all my commands). You do in fact use the SPIisSettings object - you just need to set the SPServerBindings and SPSecureBindings objects. Download the code and you can see how I did this (note that I'm using some reflection to get the timer job to fire and using these objects does not allow you to create a new application pool - I'm mimicking the functionality that you get via the browser). If you want to be able to set the port, path, and create a new app pool then you have to use the obsolete SPGlobalAdmin.ExtendVirtualServerInWebFarm() method.

Jas said...

Great tool Gary! Got an issue when using exportlist - it's looking for a list template that is deployed as a feature that doesn't seem to exist anymore :-(
Is there any way to export a list even when the list template doesn't exist? Cheers.

Bray said...

I'm trying to move some lists that contain some lookup fields. When using the standard backup and restore only some of the lookups get moved. Would any of these custom extensions help me with this?

Gary Lapointe said...

Jas - you may be stuck - the only way I've been able to get around this is to deploy some sort of feature with a template that matches the list in question.

Gary Lapointe said...

Bray - you can try the exportlist/importlist commands or the exportlistitem/importlistitem commands or the exportlistitem2/addlistitem commands - not sure if any of these will help you or not (it's been a while since I've played with them myself and I simply can't remember how they treat the lookup columns - you'll just need to try them out).

Anonymous said...

Gary call me dumb but it looks like a great tool but how do I use it. I mean I downloaded it now what do I do to install it or use it?

Gary Lapointe said...

You have two install options - the recommended install is to download the WSP and use stsadm's addsolution and deploysolution commands to install the extensions. The second option is to just download the code and copy the xml file (found in the package folder) to the 12 hive's config folder and then just GAC the dll.

umkclag0 said...

For those of us really stupid can you elaborate on the install procedure. Where to download to,etc.

Gary Lapointe said...

The best way to install is to use the WSP. Download the WSP (the link is under the "My Custom Commands" part on the top right of the blog posts) to your web front end server. Then at a command prompt use the built-in stsadm addsolution and deploysolution commands:
stsadm -o addsolution -filename "c:\Lapointe.SharePoint.STSADM.Commands.wsp"
stsadm -o deploysolution -local -allowgacdeployment -name "Lapointe.SharePoint.STSADM.Commands.wsp"
stsadm -o execadmsvcjobs

Anonymous said...

Gary,
I've used these tools and they are wonderful!

We just upgraded our production servers to 64-bit. this may be a stupid question, but does this tool work for 64-bit servers?

Jakob Weinknecht said...

Hi,

first of all I need to tell, that you have done an awesome job on the stsadm. This tool is a great help for migrating.

One thing I was considering when looking on all the feature you have added is if your custom extentions can be used to deploy a list from one MOSS/WSS to another MOSS/WSS.

For exmaple. The marketing department puts in the dates of our exhibition calendar on your intranet. Once per day a scheduled job deploys the items of this calender to our customer extranet, which is also sharepoint based. The point is, that entries which are new in the intranet should be added to the extranet. Those which have been changed should be updated. And finally those deleted in the intranet should be removed in the extranet as well. I know the last is the most difficult.

Of course it would be very easy to deploy the full list once per night from the intranet to the extranet. But acting that way leads to the disadvantage that alerts in the extranet will lead to wrong results. If there is a true add and update, like a one way replication from intranet to extranet the alert feature would work correctly.

I did some tests and combinations of your features, but I was not able to build up a one way replication from one MOSS/WSS to another MOSS/WSS adding new entries of the intranet on the extranet server and updating modified ones from intranet to extranet. The deletion scenario is the one, which could be managed manually as well, as I know this one is more difficult.

Did you try to build up such a 1-one replication using your funcationalities so far? And if, how did you solve this.

Bye,

Jakob

Anonymous said...

Getting the following error:
Value cannot be null.
Parameter name: type

Deployed using the wsp and stsadm commands. Strangely I can enumsitetemplates but not export a list. Having the same problem with another set of extensions. Stumped...dll's are in the GAC.

Anyone got any thoughts?

Awesome work Gary :)

12 Log:
stsadm: Value cannot be null. Parameter name: type Callstack: at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type) at Microsoft.SharePoint.StsAdmin.SPStsAdmin.GetExtendedCommand(String type) at Microsoft.SharePoint.StsAdmin.SPStsAdmin.RunOperation(SPGlobalAdmin globalAdmin, String strOperation, StringDictionary keyValues, SPParamCollection pars)

Gary Lapointe said...

Not sure why that would happen - if the dll is in the GAC then you shouldn't be getting that error. If you're also seeing this with other extensions then it's possible that you GAC or the dll is corrupt but then a lot of other stuff shouldn't work either. Have you tried to manually register the dll in the GAC???

Gary Lapointe said...

In regards to running the commands on x64 - I've not done any testing of that as I don't have access to x64 hardware but in theory it should work.

Gary Lapointe said...

Jakob - I'd recommend that you look into the content deployment jobs that you can set up via central admin. It's pretty buggy right now but it may meet your needs - note that there will be something coming from Microsoft soon to help fix the content deployment issues (can't say anything beyond that right now). The main reason you may run into issues with my stuff is because you are reparenting the list items (the GUID of your target list and web don't match the source list and web) so you can't use the -retainobjectidentity flag which, if set, will address all your issues but the deletion scenario.

Drew Carmichael said...

Have you ever considered expanding on the -creategroup function so you can create a group which uses any roll rather than the 3 that SharePoint allows you to use "member|visitor|owner" ?

Attila Glosz said...

Great set of tools.

But we were having a problem using gl-fixpublishingpagespagelayouturl.
When no layout is set for the list item then the following error occurs:

Progress: Begin processing Pages/default.aspx.
Progress: Current layout set to .
Object reference not set to an instance of an object.


The problem is caused by the following check in FixPublishingPagesPageLayoutUrl.FixPages:

if (url.ToString().ToLowerInvariant() == page.ListItem[FieldId.PageLayout].ToString().ToLowerInvariant())
continue; // No difference detected to move on.


Adding a check for a non null page.ListItem[FieldId.PageLayout] fixes the problem:

if (page.ListItem[FieldId.PageLayout] != null && url.ToString().ToLowerInvariant() == page.ListItem[FieldId.PageLayout].ToString().ToLowerInvariant())
continue; // No difference detected to move on.


Hope that helps others having the same problem.

Anonymous said...

Very usefull for admins indeed... but as somebody who is new to Sharepoint and just coming straight into MOSS 2007. I find some very common user problems don't seem to be addressed.

For example, why is it not possible to copy a list item from one folder to another in the same list?

Why is sitemanager hidden away? and not enabled (publishing) automatically?

Sometimes how to do something is not very intuitive or consistent between different object types.

My two cents.

Gary Lapointe said...

Attila - thanks for the info - my dev environment is a bit hacked right now but as soon as I'm at a good point I'll make sure I get this fix in place.

Anonymous said...

Hi Gary,

Nice tool.How can i create a List using stsadm command.


Samarendra

Gary Lapointe said...

I don't have a command to create a list but you can create one easily enough. You just need to get the SPListCollection (web.Lists where web is an SPWeb object) and call the Add() method.

AJCGirl said...

Hello all... I am using WSS 3.0. I was able to download and install the stsadm commands (via .wsp install), but now when I try to use a command (gl-enumavailablesitetemplates), I get the following error: "Could not load file or assembly 'Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified." Can anyone help me? Please?

Gary Lapointe said...

AJCGirl - My original code was getting the template information from the PublishingWeb - not sure why I did that (brain fart I guess). I've changed the code to pull from SPWeb so it should now work for you (PublishingWeb is a MOSS assembly but it just wraps the SPWeb object).

Jared said...

Your STSADM extensions are wonderful... One of my developers is trying to write software to move sites around much like you are doing here. I gave your extensions a try in a test WSS 3.0 environment and when using the gl-convertsubsitetositecollection or gl-repairsitecollectionimportedfromsubsite extension I get an error "Specified method is not supported." In the log file I find this:

stsadm: Specified method is not supported. Callstack: at Microsoft.SharePoint.SPList.set_MajorWithMinorVersionsLimit(Int32 value) at Lapointe.SharePoint.STSADM.Commands.SiteCollectionSettings.RepairSiteCollectionImportedFromSubSite.SetMasterPageGallerySettings(SPSite sourceSite, SPSite targetSite, SPWeb targetWeb) at Lapointe.SharePoint.STSADM.Commands.SiteCollectionSettings.RepairSiteCollectionImportedFromSubSite.RepairSite(String sourceurl, String targeturl) at Lapointe.SharePoint.STSADM.Commands.SiteCollectionSettings.ConvertSubSiteToSiteCollection.Execute(String command, StringDictionary keyValues, String& output) at Lapointe.SharePoint.STSADM.Commands.OperationHelpers.SPOperation.Run(String command, StringDictionary keyValues, String& output) at Microsoft.SharePoint.StsAdmin.SPStsAdmin.RunOperation(SPGlobalAdmin globalAdmin, String strOperation, StringDictionary keyValues, SPParamCollection pars)

I have even created a new simple Team Site and tried to move it. The subsite does get moved and does work with the new url as a Top Level Site, but the links are wrong and there is no Nav bar.

Any ideas? I dream of the day I can seamlessly move sub sites into separate site collections.

Gary Lapointe said...

Jared - I'm honestly not sure why you'd get that error as the code is copying all settings from the source (the set method will throw a not supported exception when the value is not within the acceptable range or if the list doesn't support moderation or versioning but as the moderation and versioning settings and the limit is coming from the source the only thing I can say is that something about the source list is corrupted. I've added some simple error handling to ignore the error and just not copy the setting so that it can move on to the other issues.

Gary Lapointe said...

Jared - ignore my last comment - I'm an idiot - there's nothing wrong with your source list having moderation or versioning disabled - the code fix that I pushed out last night should resolve the problem for you.

Jared said...

Thank you for a quick response and update. It seems that the error I was having has passed, but now I am getting another one.

The type initializer for 'Microsoft.SharePoint.Publishing.Internal.Resources' threw an exception.

I am now wondering if we dont have another issue somewhere in our sharepoint implementation. I appreciate all your work and will be checking back for updates. One of our developers was happy I found your blog.

Gary Lapointe said...

Ugh - that looks like some sort of corruption with the dll but I'm honestly not sure. Unfortunately I don't think I can help you with this particular error.

Michael Sirotnik said...

Gary,
I was very thrilled when I first read about your stsadm extensions. A few months ago we

migrated Sharepoint from 2003 and there are some sites that did not migrate cleanly. If I

could export and import document libraries, I could easily clean much of it up.
Thought I would experiment with our dev environment using your added functionality. I

created a TestUtils site and added a document library, thestthis. I installed your utils

using the install.bat and all seemed well. From stsadm -help I can see all of your

extensions and can pull up help for each of those. However, when I try to use a simple

export command (my example below) all I get is a generic command line error and a list of

all the stsadm help files:

stsadm –o gl-exportlist -url "http://sharepoint2k7/tu/testthis/Forms/AllItems.aspx"

-filename "c:\docs" -includeusersecurity -versions 4 -nofilecompression

Did I miss something during the install?

I'm anxious to experiment with this cool stuff and would appreciate any assistance.
Thanks,
Michael Sirotnik

Gary Lapointe said...

Michael - Try re-typing the command (not sure this is what's going on but if you copied and pasted from your command line into your comment then there's an issue with the "-o" (looks like you have a non-standard hyphen)). Beyond that what you typed seems to be correct (if you can get the help for the command then the command is installed correctly).

Administrator said...

Thanks very much,,,

KevinHou said...

Gary,

Great looking set of commands. I'm looking for something that may not be possible though, is there a way to backup a single site beneath the collection level. The OOTB stsadm only works at the collection level, and from what I read about yours it appears to be the same. Am I reading it wrong?

Thanks,
Kevin

Gary Lapointe said...

Kevin - correct, the OOTB backup/restore commands are for site collections. You can use the export/import commands to backup an individual sub-site but there are limitations to what it can handle (no workflows, no personalization settings, no alert settings).

Mike Sharp said...

Hi Gary,

Thanks for sharing this!

I looked over your list of commands...but didn't see what I need. I'd like to use the stsadm createweb but be able to specify that it include the new web in the quicklaunch navigation of the parent, as you can when you use the GUI. Do you have a way of accomplishing this?

I have a feature that activates on the site creation that sets up branding, but would prefer this part to be specified in the call to create the web in the first place.

Thanks,
Mike

Patrick said...

Great tool set Gary. I use it quite a bit =) I was wondering if you knew of anyway to export a site without it's subsites? I need move a number of sites around and some sites need to be moved without their subsites.

Gary Lapointe said...

Patrick - I never got around to creating it but you could create your own version of the built-in export command and just add the include descendants property as a parameter. This property allows you to do an export without the sub-sites.

Gary Lapointe said...

Mike - I don't have a createweb command but you can use the addnavigationnode command to do it. This is the code code that runs when you create the web using teh UI:
if (bOnQuickLaunch)
{
SPNavigationNode node2 = Web.Navigation.CreateHomeNode(Web.Title);
try
{
Web.ParentWeb.Navigation.AddToQuickLaunch(node2, 0x402);
}
catch (SPException)
{
}
}

You could easily write your own command that will do effectively the same thing as the createweb and then add the Web.ParentWeb.Navigation.AddToQuickLaunch bit in.

Anonymous said...

Hi Gary,

I have a document library with 200 thousand documents with metadata. I want to move all these documents to a new Farm and ofcourse into a document library of same type. Do you suggest any tools from your list.

Thanks,
Raj

Gary Lapointe said...

200,000? WOW! - You could start with the gl-exportlist/gl-importlist or gl-exportlistitem/gl-importlistitem commands. If they don't work for you then you may want to look into third party tools such as those by Quest or AvePoint.

Yvan Hernandez said...

Hi Gary, like everybod else.. Great set of commands, love them.

I have a question.. We're in teh process of migrating a site collection from a external site (half way around the world) into a corporate owned one, however the backup came at 27Gb and even after the restore 10hrs later the thing came up.

Now, some of the lists are causing issues, we're not sure if it's due to the backup/restore/splitting of the orginal files or what.

The particular case is that a user creates a personal view and then the default view gets lost from the list and only this user starts to get Render Error; a workaround is to use the Site Content and Structure or copy the files using SharePoint Designer from the original place.

Do you have something similar to the gl-exportList / gl-importList only for the structure? no content data... I'm thinking more on the lines of something like gl-applyListTemplate to a list without disturbing the current list content.

Thank you

Gary Lapointe said...

Yvan - unfortunately I don't really have anything that addresses the issues you mentioned. You might try and apply the infrastructure update and then try your migrations again or use backup/restore instead of export/import.

brucecmc said...

Gary, You seem to be the man with the answers.

We have a test&dev environment that we want to "import" all of our web apps and associated site collections (small environment) from our production environment.

We have desparately been trying the stsadm export and import functions, but it seems that each time we do, there is a different set of errors and the majority of content is inaccessible or not locatable...

what are we doing wrong???

Gary Lapointe said...

brucecmc - the export/import commands have lots of issues. I'd recommend that if you wish to use them to migrate your content that you look into upgrading to the infrastructure rollout which released a couple of weeks ago. You can also try using the backup/restore option though the recommended approach to go from one farm to another like you're trying is the export/import option. When using the import option you may want to give my custom version (gl-import2) which adds a property for retaining object identities. That "sometimes" fixes "some" of the issues - it reall depends on what type of issues you are having. Also - if you don't need all versions you can try setting the version options for the command. Another thing to watch out for is any custom solutions/features - any that exist in your source environment must exist in your target (and of course your sharepoint versions should match). The infrastructure rollup though contains something like 60+ major fixes to the content deployment components (which is what export/import uses). Hope this helps!

brucecmc said...

thanks for the quick response...I'll give the gl-import2 extension a whirl...We tried the backup/restore, got a little further with that, but still there are issues with access denied, invalid paths, and pages not located...

I thought this was suppose to be an easy process? ;-)

Anonymous said...

I have a problem after registering the stsadm extension to WSS3.0

when i try to run "stsadm -help gl-setuserprofileimportschedule" i get this popup error, "Windows SharePoint Services administration tool has encountered a problem and needs to close. We are sorry for the inconvenience. If you were in the middle of something, the information you were looking on might be lost."

Anyone can help?

Anonymous said...

Anyone can help me?

I have install and deploy successfully for my WSS3.0 .wsp version.

However, when i try to run on the command line, "stsadm -help gl-setuserprofileimportschedule", it show this error:

Windows SharePoint Services administration tool has encountered a problem and needs to close. We are sorry for the inconvenience.

If you were in the middle of something, the information you were working on might be lost


Anyone knows what this error means?

Ken
Singapore

Papa said...

amazing project :)
Thanks for sharing it with the community.

Gary Lapointe said...

Ken - not sure what's up with the error but that particular command shouldn't be available at all for the WSS version as it only applies to MOSS. Are you sure you have the correct WSP installed? Can you confirm that you don't have an earlier version (before I split the project to two WSPs) installed?

Anonymous said...

Hi Gary,

Yes, is definitely WSS3.0 (standalone, Server 2003 Std 32bit, SQL2005 Std Edition) as I downloaded it from Microsoft site.

In fact what i need from your great program is the user profile synchronisation, betweem AD and SP user profile.

So once i run the "stsadm -help gl-setuserprofileimportschedule" command, my server give me this error.

Ken
Singapore

Anonymous said...

Hi Gary,

Apart on the installed and deployed sucessfully shown in my Central Administration > Operations > Solution Management, on the physical server, do i expected any changes on the file or inclusion of any files in the "C:\Program Files\Common Files\Microsoft Shared\web server extensions" folder?

Thanks alot!

Ken
Singapore

Anonymous said...

Hi Gary,

To confirm that I have installed and deployed properly, i try to run "stsadm -help gl-deleteallusers" and able to see message like "...copyright 2008 Gary Lapointe..."

But for some, it doesnt work. It prompt me the same error.

Karen said...

Is there any way to list a current setting? For instance, can you use stsadm to tell what SetSharedWebServiceAuthn is set to?

Gary Lapointe said...

Ken - you misunderstand - I have a WSS and MOSS version of my extensions. The user profile related commands are only in the MOSS version and will not work on a WSS install.

Gary Lapointe said...

There will be one or two xml files in the config folder depending on whether you installed the WSS or MOSS versions respectively.

Gary Lapointe said...

Karen - there may be a command that will give you that information but I can't think of any at the moment. Of course it would be pretty easy to write your own command to get this information.

Karen said...

LOL - If I knew how to create my own command to do this, I would not be asking ;-o

brucecmc said...

Gary,

Possibly you can give me some advise/point me in the right direction.

We are deploying our sharepoint infrastructure with both CAC and Forms Authentication.

The authentication pieces are functioning just fine...

However, we want to be able to link from our private site (exp: https://www.private.root.xxx.xxx.com) to our root site (https://www.root.xxx.xxx.com).

Obviously, these sites are on separate instances of IIS with their own name/IP resolution to the public...

The intent, is to move from one to the other WITHOUT reauthenticating (exp: private.root.x.x --> root.x.x)...

Is there any method for doing this AND not require authentication again? Or have you ever seen this deployed in this fashion.

Gary Lapointe said...

Because they are separate web applications you're going to have to re-auth. You might be able to get clevor with creating your own forms auth page and set the auth cookie be domain specific and not host (I've done this with straight up asp.net but it was a while ago and I'm not sure how/if it works with sharepoint). You might also be able to do something with ISA server but I've not looked into it.

brucecmc said...

thanks gary,

yes, we pretty much have resolved to having the repeat the auth, so I'm taking a different approach, not sure if it is feasible or not..

Your thoughts would be appreciated:

scenario is this.

1. Public facing site collection, completely open to any one browsing. On this site collection, the content would display general information about our organization (nation wide).

2. Private site collection where users with approriate access/permissions can access and manage site colletions, sites and sub-sites...This site is secured with SSL, Common Access Card Authentication and Forms Authentication.

3. Additionally, we would like to have users that have access to the private site be able to perform site/site collection administrator functions on the public site

We think, and this maybe our overall ignorance of MOSS2007, we can create a "public" site collection and a "private" site collection sharing a single site content database? Would this be possible???

Our users could then manage content from the private side and it populate the public side...

So far, I havent found how to do such a thing or even if it is possible...

exp: Site Collection A (Public) Site Collection B
(Private)
Single C O N T E N T D A T A B A S E

User modifies Site Collection B (Private site) changes are propogated to Site Collection A (Public)

Gary Lapointe said...

You can have the site collections exist in the same content database but they cannot share the same content. I'd actually recommend though that you not have them in the same content database for security reasons. What you'll need to do is use content deployment to propagate content changes from one site collection to another.

Gary Lapointe said...

One more thing - I'd even go far as to say that you should put both of these on separate web applications each with their own application pool. For both security and performance reasons but primarily for security.

brucecmc said...

thanks again...they actually are different web applications..."content deployment", I hate to keep the thread going, but is that an "out of the box" function of SP...going to poke around today to see what i can find...

Gary Lapointe said...

Yup, out of the box - if you google it you'll find a bunch of resources for it. Note that the infrastructure update adds tons of fixes for this - I'd recommend looking into deploying this update if you choose to go the content deployment route.

AlMo said...

Hey Gary, I agree your extensions are everything that MS left out of the STSADM tool. However, I've just experienced some less-than-happy results trying to "gl-importlist" from one site to another. My steps were:

1) Create a site from a template made from the source site.
2) Turn off all workflows on the site where I was moving to by disabling "Standard Features" at the site level.

I assumed that step 2 would keep emails from being generated when I imported the list to the new site. But for some strange reason, each new item added to the destination list sent an email to notify the approver, just as the parent list was programmed to do using OTB workflows.

Is there any parameter to the gl-importlist subcommand that might stop this from happening? Other than that your tool was the perfect solution to this archive request from our finance dept.

Appreciate any insight you might have.

Thanks,
Alex

Gary Lapointe said...

Alex - thanks for the feedback - unfortunately there's no options with the command to prevent those emails from going - I'm just using Microsoft's content deployment API so I'm kind of at the mercy of how their code works. The only thing I can think of would be to disable the workflow at the source, export, and then re-enable. Otherwise you might be able to look at the manifest.xml file that's generated by the export and then tweak that xml to adjust the settings to prevent any workflows from triggering (not sure what effort would be involved for that though).

Mladen said...

Hey Gary,

First of all this is a great tool, Second I have a quick question I want to export or copy security settings for a site inside a site collection, your exportlistsecurity is very helpful for my document libraries but how could i do the same thing for the site in particular. Thanks in advance

Mladen

Gary Lapointe said...

Unfortunately I don't have anything to deal with site level security. I know that there are third party applications that address this though (and I'm sure I'll probably have to build something eventually but as of yet I've not had a need).

David Lundell said...

Great stuff. I downloaded the code and then went to run the deploy batch file under the releasewss folder. I noticed one slight error
SET SOLUTION_NAME="Lapointe.SharePoint.STSADM.Commands.wsp"
should be
SET SOLUTION_NAME="Lapointe.SharePoint.STSADM.Commands.wss.wsp"

Gary Lapointe said...

Thanks for the feedback - I'd meant to fix that but had forgotten about it. I've made a change to my build scripts so it should be fixed now.

Tracey said...

Hey Gary
thanks for the great tools! I am very new to Stsadmin and was searching for a way to show the sites and subsites created in the Quick launch of my Moss 2007 and I ran across your site. Forgive the question, if it is fairly obvious.. but do you have a command/extension that will allow me to set the 'show me the site in the quick launch" when I create my sites in bulk.
Thanks in advance
Trace

Gary Lapointe said...

Tracey - you can use the gl-addnavigationnode command to add an item to the quick launch of your site.

Bogglor said...

Gary,

First some background:

There's no support for creating a recurring task in a task list in Sharepoint. You'd think that this would be a simple thing to do, but apparently, it's not.

I'm trying to set something up where every morning at 3 AM, an item is added to a list and that item has an approval workflow attach and start itself (I think this part is set in the GUI). I have to use a workflow since there are 3 people that are assigned the task -- a limitation since tasks are only assignable to 1 person.

Is there a way that I can use gl-addlistitem and other commands to automate this? If I've created a custom list with the fields I want, how do I get your command to add a new item and populate those fields? Sorry if this doesn't make sense. Thanks for any help you can provide.

Mark said...

Hi Gary,

Great set of tools. Do you know of a way we could delete a group of site columns? I noticed that you had the export and import extensions, but I didn't see anything about deleting them.

Gary Lapointe said...

Yes - you could use the gl-addlistitem command (probably in a batch file with a scheduled task) to add an item to the list. You might run into an issue with getting the workflow to trigger though so you'll want to play around with it. Failing using my commands I'd recommend creating a custom timer job and just add the item to the list programmatically.

Gary Lapointe said...

Mark - you are correct, I do not have anything to handle deleting site columns but if you are handy with c# it wouldn't take much at all to write something.

Frank said...

Hi Gary,

Great set of tools indeed! The only thing that I'm missing is a tool that can add or remove permissions on folder level. So if you have a Document Library with a set of subfolders under it, to grant or revoke a certain user (person/Sharepoint group/AD group) a certain role (contribute, reader etc.) to that folder. Of course it is possible to grant a user access on the DocLib and have it inherited to the child folders, but what if you want to have different permissions per folder? Any suggestions?

Thanks,
Frank

Gary Lapointe said...

Frank - take a look at the gl-importlistsecurity command. You might be able to use it or refactor it to meet your needs.

Nick said...

Hey Gary

Do you have any tricks on renameing a site collection to a new URL? I was trying to do it via stsadm using the backup, delete, then restore operations, but I keep getting an error on the restore that it cannot lock the file "wss*1_.tmp" where * is a random guid each time i try running the command.

Gary Lapointe said...

backup/delete/restore is the only way I know of to do it - not sure why you're getting that error though - could be a permissioning thing or possible that you're running out of disk space?

Francisco Sapio said...

Hi Gary,

I'm using many of your gl- commands. They are really great.

However, after having trouble when trying to deploy simple objects between servers ( e.g. gl-copylist, gl-import ), I went through the whole update procedure for both servers (the source and the target) up to the Infrastructure Update (both WSS and MOSS ) and ensured that both servers are at the same database level (12.0.0.6318).

As you mentioned in several posts, the deployment API has been updated significantly, so I hoped that this will solve the problem.

Unfortunately, I continue to receive the same message every time I'm trying to connect to the receiving server:

"The Web application at http://servername... could not be found. Verify that you have typed the url correctly ... etc "

All the references to this message I found so far mention that the account being used should have enough privileges, etc. Also, there are references to AAM ( Alternate Access Mapping).

So far, I tried every possible variation on this, trying to do it both from the source and from the target. Regardless of what I do, I'm always getting the same message, saying that the Web Application cannot be found.

Then I do 2 things.
1) I grap the url that the message puts next to " the web application at ... ", paste it into the browser and the application comes up. So, there are no typos.

2) I go to the other server and run "stsadm -o enumsite" or "stsadm -o enumsubwebs" and the url is there. So, the application is valid.

So, my question is:

any suggestion? Anything obvious I'm missing. This is preventing me from making any deployment.

Is there any place where we can debug this message? "The web application at ... could not be found. "

Any way to produce some logging? some extra detail?

Any help will be appreciated.

Francisco Sapio

Gary Lapointe said...

Francisco - all of the copy commands that I have will only work within the same farm - so you can't copy a list from one farm to another using the gl-copylist command but you can use gl-exportlist on your source farm, copy the files over to your target farm, and then use gl-importlist (the gl-copylist command just wraps those two up into one call for inter-farm copying).

brucecmc said...

Gary,

Wasnt sure where to post this, so I just went to the newest thing i could find...I have 2 questions:
1. is there a really good sharepoint forum (outside of yours of course) that i might routinely grab info and collaborate

2. I'm having a bit of a strange issue with IIS windows authentication.
-- with anonymous access turned on in IIS, the site collection and within the CA for the site collection, I am periodically prompted for windows authentication. I have tried with both having windows auth on and off in IIS with a variant of the behaviour, but ultimately the same result.

Win Auth on - After IISRESET, on first attempt, prompts for auth. if cancel is selected, 401 error. if i use my domain credentials when prompted, receive share point access denied. subsequent attempts takes me to site without failure?

Win Auth off - no prompt, straight to 401 error, with the subsequent attempt taking me to the site without failure?

I'm very perplexed by this...

your thoughts??

thanks.

Bruce

Gary Lapointe said...

Bruce - your best bet for submitting questions would be the Microsoft forums: http://social.technet.microsoft.com/Forums/en-US/category/sharepoint/ - there's a lot of MVPs (including myself) that monitor the forums. Regarding your issue - offhand the only thing I can think of would be if you're using Kerberos and it wasn't set up correctly - beyond that I'd say look in your web logs, event viewer, and ULS logs for anything additional errors. Also - try using my stsadm command to set the anonymous access - just in case you missed a setting (which it sounds like you didn't).

brucecmc said...

thanks for the quick reply...as always, you're very prompt...thanks for the link..i'll check that out...

it appears (for anybody that may have been watching this string) that a DLL that we recently dropped in the GAC for custom navigation may have been my culprit...Not sure exactly why, unless it was a permissions issue of some sort that was requiring the windows auth...

suffice it to say, that issue is fixed...on to the next... ;-)

thanks again...

Denise said...

Hi again Gary!
Do you know of anything that can delete the audit table data. We had auditing turned on, now off, and want to get rid of the data.
Any magic tricks up your sleeve?
(ps...i already know about the KB article released in July...got anything else??) ;o)
Denise

Gary Lapointe said...

The stsadm command released in the infrastructure update (the kb article you mention) is the only tool currently available to trim the logs.

bruce said...

Hi Gary, I posted this thread a few days ago

http://social.technet.microsoft.com/Forums/en-US/sharepointgeneral/thread/b4ec5bfa-6c7a-4f15-bb82-f07edd9c8e5b

SS Ahmed, posted a couple of responses, but neither of which resulted in corrective action..

Futher digging into this error, I have discovered that by stopping the Windows SharePoint Service Administration Service stops the generation of the error. I thought possibly the account running the service was not correct/had correct permissions. Changing to known good account resulted in same errors.

I disabled the Windows SharePoint Service Administration Timer Job on the CA, this too resulted in the stopping of error generation...

so, obviously the errors are a result of this service running, but for the life of me, I can find a resolution.

any assistance would be greatly appreciated.

Anonymous said...

Hi, I need to export/import groups and permissions from a site collection, can you make an extension to do this ?

I have an application in production and I want to save groups and permissions, replace the application by a new version (using stsadm -o import...) from a test environnement and reimport the groups and permissions in the new version.

Thanks

Rao Rajendra Singh said...

Can we create a content sources throgh these extensions?

Gary Lapointe said...

Sorry - I don't have anything to create content sources at this time.

Steve Schofield said...

Hi Gary,

I used your MOSS extensions to help automate nearly everything in our install. Thanks SO MUCH! One thing that I can't figure out is using the 'siteadmin' command to add a secondary site collections owner.

Our MOSS install uses a custom authentication provider (RSA). I can set the custom authentication provider with stsadm, but when I try to set the secondownerlogin property with stsadm, the user isn't found. It works when I use the GUI. You ever had a need to set a site collections owner that has a user account in a custom authentication provider? We are manually doing this now, but would like to save a few mouse clicks. :)

Thanks again for your tool. It's been a life saver. I'll be watching and testing your powershell stuff.

Take care,

Steve Schofield
Microsoft MVP - IIS

Eric said...

Is there a way to use STSADM to create a User Profile, so a user who's not in AD can be added to a site?

Gary Lapointe said...

Not via STSADM but if you do a search for sharepoint and membership providers then you will find some resources to help you. Another option you have is to use the BDC to get users from another location. I've not done any of this so I can't be of much use but if you dig around you should be able to find something helpful.

Laurent said...

Hi Gary,
I'm trying to add attachment to existing item in a custom list.
For this I use the operator "-o gl-addlistitem" and the xml file as follow :

Items
Item
Fields
Field Name="ID" 1/Field

/Fields
Attachments
Attachment
e:\License.DAT /Attachment
/Attachments
/Item
/Items

I get the next result :

Progress: Loading data from XML manifest file.
Progress: Processing item: -1
Field 'ID' is read only and will not be updated.
Progress: Publishing item:
Operation completed successfully.

And instead of adding attachement to my existing item, it create new one.
Am I doing wrong, is there no way to just add attachment to existing item ?

Regards,
Laurent

P.S.: I removed "<>" from the xml pasted because of this limitation :

Your HTML cannot be accepted: Tag is not allowed: Items

Kiran Chauhan said...

Hi Gary,

I have been using stsadm extension and I found it very useful. I have a suggestion for you, can you include "Authoritive Page" extension, it would be very helpful.

Gary Lapointe said...

Laurent - the current implementation of the gl-addlistitem command does not support updating existing items - only adding new items.

Gene said...

Hi,

I got the following when trying to install the MOSS Powershell Cmdlets on my 64x bit MOSS install:

===========
Error 1001. Error 1001. Unable to get installer types in the C:\Program Files (x86)\Gary Lapointe\PowerShell Commands for SharePoint\Lapointe.SharePoint.PowerShell.Commands.dll assembly. --> Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information., (NULL), (NULL),
==========

Am I missing something? Thanks

Gene

Gary Lapointe said...

Gene - Unfortunately I don't currently have access to an x64 machine that I can test the installer on so I'm not sure what's going on. Is there any additional info in the event log or did it get so far as to create any log files in the install directory? If so could you send them to me? You can of course install them manually using installutil (just download the source to get the dll).

Gene said...

Hey Gary,

Thanks for getting backup to me. I see that it created the "C:\Program Files (x86)\Gary Lapointe\PowerShell Commands for SharePoint" and 2 .tmp files. The full event log shows the following:

=========

Event Type: Error
Event Source: MsiInstaller
Event Category: None
Event ID: 11001
Date: 1/7/2009
Time: 8:27:01 AM
User: domain\myname
Computer: MyServer
Description:
The description for Event ID ( 11001 ) in Source ( MsiInstaller ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: Product: PowerShell Commands for SharePoint -- Error 1001. Error 1001. Unable to get installer types in the C:\Program Files (x86)\Gary Lapointe\PowerShell Commands for SharePoint\Lapointe.SharePoint.PowerShell.Commands.dll assembly. --> Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information., (NULL), (NULL), (NULL).
Data:
0000: 7b 39 45 35 34 32 45 36 {9E542E6
0008: 43 2d 34 46 41 36 2d 34 C-4FA6-4
0010: 34 44 35 2d 39 36 35 44 4D5-965D
0018: 2d 43 35 41 36 45 41 46 -C5A6EAF
0020: 36 37 31 33 41 7d 6713A}

Gene said...

I did additional testing on 4 outher x64 machines and the results were the same. Unfortunately, I don't have a 32bit server to test. What's strange is that I try installing on my xp laptop (32bit)... and got the exact same error.

BTW. There is no DLL in the MOSS srouce download. I've extracted the only DLL in the wsp download and ran "installutil Lapointe.SharePoint.PowerShell.Commands.dll"... but don't see it in the GAC.

Thanks
Gene

Gary Lapointe said...

Gene - I hate asking this but your comment about installing on XP makes me wonder - do you in fact have PowerShell installed? Also - you won't be able to use any of this on XP - it must be installed on your MOSS/WSS server. And yes, the source does not include the dll - you'll have to build it.

Gene said...

Hey Gary,

I have Powershell 2.0 CPT3 installed. I now uninstalled this version and reinstalled 1.0 x64. I ran your installer again and get:

"Error 1001. An exception occurred in the OnAfterInstall event handler of Lapointe.SharePoint.PowerShell.Commands.SnapIn. --> Object reference not set to an instance of an object".

The event log show the following:

Event Type: Error
Event Source: MsiInstaller
Event Category: None
Event ID: 11001
Date: 1/8/2009
Time: 9:16:08 AM
User: Gene
Computer: MyServer
Description:
The description for Event ID ( 11001 ) in Source ( MsiInstaller ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: Product: PowerShell Commands for SharePoint -- Error 1001. Error 1001. An exception occurred during the Rollback phase of the installation. This exception will be ignored and the rollback will continue. However, the machine might not fully revert to its initial state after the rollback is complete. --> Cannot delete a subkey tree because the subkey does not exist., (NULL), (NULL), (NULL).
Data:
0000: 7b 39 45 35 34 32 45 36 {9E542E6
0008: 43 2d 34 46 41 36 2d 34 C-4FA6-4
0010: 34 44 35 2d 39 36 35 44 4D5-965D
0018: 2d 43 35 41 36 45 41 46 -C5A6EAF
0020: 36 37 31 33 41 7d 6713A}


Thanks
Gene

Gary Lapointe said...

Ah - that makes more sense - I've only tested this with v1 - as for the null object exception - I'm working on that one - for some reason the SPFarm.Local object is coming back as null and I don't know why - you should be able to get around that by choosing to not install my extensions and just install them manually by deploying the wsp.

Gene said...

Hey Gary,

That worked. I manually deployed the WSP file. Tried running the Powershell using either shortcut and command line approache you've recommended... but go the following on the console:

"Add-PSSnapin: No Windows PowerShell Snap-ins are available for version1.
At line:1 Char:13
+ add-pssnapin <<<< -name "Lapointe.SharePoint.PowerShell.Commands".

Thanks
gene

Gene said...

More info... when I install PS v1 x64, it also installs a x86 version as well. Both version came back with different results as follow:

PowerShell x64
===============
WARNING: The following errors occurred when loading console C:\Program Files (x86)\Gary Lapointe\PowerShell Commands
for SharePoint\Console.psc1:
Cannot load Windows PowerShell snap-in Lapointe.SharePoint.PowerShell.Commands because of the following error: No
Windows PowerShell Snap-ins are available for version 1.
Windows PowerShell
Copyright (C) 2006 Microsoft Corporation. All rights reserved.

PS C:\Documents and Settings\svcSPAdminQA- add-pssnapin -name "Lapointe.SharePoint.PowerShell.Commands"
Add-PSSnapin : No Windows PowerShell Snap-ins are available for version 1.
At line:1 char:13
+ add-pssnapin ---- -name "Lapointe.SharePoint.PowerShell.Commands"
PS C:\Documents and Settings\svcSPAdminQA- get-spsite-gl -url *
The term 'get-spsite-gl' is not recognized as a cmdlet, function, operable program, or script file. Verify the term and
try again.
At line:1 char:14
+ get-spsite-gl ---- -url *
PS C:\Documents and Settings\svcSPAdminQA-
===============


PowerShell x86
==================
Windows PowerShell
Copyright (C) 2006 Microsoft Corporation. All rights reserved.

There were errors in loading the format data file:
Lapointe.SharePoint.PowerShell.Commands, C:\Program Files (x86)\Gary Lapointe\PowerShell Commands for SharePoint\Lapoint
e.SharePoint.Format.ps1xml : File skipped because of validation exception: "File C:\Program Files (x86)\Gary Lapointe\Po
werShell Commands for SharePoint\Lapointe.SharePoint.Format.ps1xml cannot be loaded because the execution of scripts is
disabled on this system. Please see "get-help about_signing" for more details.".

PS C:\Documents and Settings\svcSPAdminQA- add-pssnapin -name "Lapointe.SharePoint.PowerShell.Commands"
Add-PSSnapin : Cannot add Windows PowerShell snap-in Lapointe.SharePoint.PowerShell.Commands because it is already adde
d. Verify the name of the snap-in and try again.
At line:1 char:13
+ add-pssnapin ---- -name "Lapointe.SharePoint.PowerShell.Commands"
PS C:\Documents and Settings\svcSPAdminQA- get-spsite-gl -url *
Get-SPSite-gl : Object reference not set to an instance of an object.
At line:1 char:14
+ get-spsite-gl <<<< -url *

==================


Based on the above, it looks to me that extensions are not compatible with x64. Event if I run int under PS x86 within x64 OS, the extentions would show but have issues.

Thanks
Gene

Gene said...

Still experiencing issues. The script don't seem to work under x64PS. Under x86, I can execute some commands but with erros. Example:


PS C:\Documents and Settings\svcSPAdminQA> $test = get-spsite-gl -url *
Get-SPSite-gl : Object reference not set to an instance of an object.
At line:1 char:22
+ $test = get-spsite-gl <<<< -url *

Gary Lapointe said...

Gene - can you download the latest install and try again? When you run the command pass in "-debug" and it will output the stack trace which I can use to (hopefully) narrow down the error.

Alex said...

great stuff!
I am looking for some tool to replace one AD group by two other groups with the same permissions all over the server (several SC)

Kevin said...

I just found this site and the stsadm commands.

It looks great and could solve many problems I have in automatic site creation.

The problem is, how do I install the extensions. Is there an install document that I missed? Please advise.

John said...

Great tools, Gary! Microsoft should hire you to fix their weak stsadm operation set. You might also consider adding a How-to-install-wsps-for-newbs section to your home page for those that don't know anything about addsolution and deploysolution.

Gary Lapointe said...

Kevin - run the following commands:

stsadm -o addsolution -filename "c:\Lapointe.SharePoint.STSADM.Commands.wsp"
stsadm -o deploysolution -local -allowgacdeployment -name "Lapointe.SharePoint.STSADM.Commands.wsp"
stsadm -o execadmsvcjobs

Heath from Adelaide, Australia said...

Hi Gary,

Love your work! Thanks for sharing it ...

I'm particularly interested in the gl-setpictureurl command, but have a requirement to use the Employee Number as the variable in the URL.

We have a custom profile property "EmployeeNo" that maps to the AD attribute employeeNumber.

Any chance you'd add EmployeeNo as a variable to the gl-setpictureurl command?

Peter said...

Hi!
What we are looking for is the possibility to inherit permissions downwords. In MOSS unfortuantely it is not possible like in NTFS to inherit permissions throught a site, because if inheriting is disabled at some stage, it stays disabled. Does somebody know a solution oder command to do this?
Thank you very much in advance!!!

Peter

Gary Lapointe said...

Heath - my recommendation would be to download the stsadm template I provide on codeplex and then copy the source for the command into this template so that you can build and customize as you need.

Heath from Adelaide, Australia said...

Thanks Gary ... will check it out :-)

Denise said...

Hi Gary!
do you have a command that will provide us with a list of user permissions on site collections/sites??
Denise :o)

Anonymous said...

I think a nice command for convenience would be to reset the event log and trace log levels back to the out of the box defaults.

MrMMills said...

Don't know if you ever will need something like this. SharePoint Upgrades require that your App Pool ID account have elevated privileges http://technet.microsoft.com/en-us/library/cc263467.aspx

Instead of elevating my existing APID account with enhanced local and SQL permissions, I created at SharePoint_Upgrade account. Problem is we have over 100 sites using 5 Application Pools. I'm trying to find a way to stsadm script the App Pool ID\password acct change for each existing App Pool, (not by site - like your "gl-updateapppoolname" tool) Currently using the stsadm -o updatefarmcredentials comand for the CA Site\Pool, but still need to stsadm script a way to change the other app pools.

Gary Lapointe said...

You can use the gl-updateapppoolaccount - it's per web application but if you combine that with a simple powershell script you should be okay (not sure if you'd even need to run it more than once though - possible SharePoint might see that it's used multiple times and just handle it (the app pool will certainly get updated and thus only one call is needed - question is whether SharePoint will update the config db for each web app)).

sarahsez said...

Hi, Gary--We use your commands daily--thanks very much for sharing them. Also, I really enjoyed your talk at BP San Diego. Question: Is there a way to list all users with Full Control in a site collection? - Sarah

Gary Lapointe said...

Thanks! There's nothing out of the box and I don't have anything but you might take a look on codeplex (not sure if there's anything there but a good chance someone's built something like this - I get asked for it a lot :))

David Petersen said...

Thanks for the commands! I have been working on deploying connected lists via features and somehow i had some phantom lists on my site. I couldn't delete them with the UI or stsadm forcedeletelist. Your gl-deletelist command with the force option did the trick!!

t&t said...

Brilliant tool.
I found a small typo in the ExportListSecurity command, method AddRoleDefinitions

existingRoleDef.Order = int.Parse(roleDefinitionElement.GetAttribute("Description"));

Should be:

existingRoleDef.Order = int.Parse(roleDefinitionElement.GetAttribute("Order"));

Gary Lapointe said...

Thanks for the info - I've got a fix in place which I'll be pushing out shortly.

Anonymous said...

Hi Gary,

A big thank you and a thumbs up! We've really enjoyed using your tool so far and think it's pretty much the best extension to SharePoint! It's really proven its value to us over tha last few days deploying to our new farm.

Cheers,
Gerard, Bastiaan & Sanjay

Bernhard said...

Great ToolSet!
I have a problem and did not found anything in www so far.

I want to rename a List (only the Title, not the URL) with stsadm. Is that possible?

Furthermore if a create a new list with stsadm is it possible to
change versioning-settings and content-approval settings with stsadm or with any CLI?

I Use MOSS2007.

Any hints are very appreciated as i already spent hours of finding a solution...

Kind regards

Bernhard

Gary Lapointe said...

Bernhard - There's no way to do this using stsadm but you could do it easily with PowerShell.

Bernhard said...

Thank you Gary, do you have any idea how as im totally unfamiliar with PowerShell :-(

Sarabjeet said...

The tools looks great. Is there a way to create multiple document libraries in a quick way ? I need to create custom fields in those as well. Lemme know your views

Gary Lapointe said...

Just combine the commands with powershell.

ranjith said...

Wow! Great work..I have a requirement were in I have 1000 text files.I have to migrate those contents of 1000 text file contents to 1000 wiki pages under wiki library..Please guide me if I can use any of your STSADM commands

Gary Lapointe said...

ranjith - none of my commands would do exactly what you want; I'd just do it with PowerShell.

hbkrules69 said...

Can any of your commands create a new site collection role? i.e. one called author that has all the permissions of Full Control except author? This needs to be added to each site collection, not the web app. I am not looking forward to adding this to 50+ site collections :(

hbkrules69 said...

sory all Full Control rights except create subsite

Gary Lapointe said...

Not directly. You could use the gl-importlistsecurity on a temporary list and that would sort of get you what you want but you're probably better off either creating your own command or using powershell.

Papa said...

Great tools. I have added new stsadm based on your project template - the stsadm -o copyfarmappbincontent.
Thanks,

Riwut
http://blog.libinuko.com/2009/09/06/stsadm-o-copyfarmappbincontent-is-available-in-codeplex/

Rick Zhong said...

Hi Gary,
Thanks for this wonder tool! :)
I was being able to use the following command to make a gl-copylistitem from one documentlib to another, but when after checking the target doclib, I found out that only a portion of source doclib(50%) got copied over to the target doclib, and the other 50% simplied just ignored. However when checked the log(import/export), both seemed to be able to export/import all documents from the source!?

Please HELP!

Thank you,
-Rick

C:\>stsadm -o gl-copylistitem -sourceurl "http://intranet/internal/communications/Working%20Documents/Forms/AllItems.aspx" -targeturl "http://intranet
/internal/communications/TESTMigrationDocLib2/Forms/AllItems.aspx" -includeusersecurity -updateversions 2 -versions 4 -nofilecompression

Randall Okwei said...

I tried to install the WSS and MOSS solutions, and got the error that the ID already exists in the store...

Gary Lapointe said...

That means it's already installed - do an upgrade instead.

Pete Bourget said...

Great tools, saving me a lot of time. However, I am copying list from MOSS on a server in Active Directory to WSS on a standalone server in my test environment not in Active Directory. When I import lists (Issue Tracking) the Created By field is now set to my name and the Assigned To is blank on every item. Is this because the user accounts don't exists or do I need to -includesecurity when I export the list?

Gary Lapointe said...

Pete - I've never actually tested this scenario but I would definitely give it a shot with the -includeusersecurity switch.

Gary Lapointe said...

Rick - I've noticed a lot of people having issues with only some items getting imported - honestly I'm not sure what's going on a I've not seen it myself and have no error logs to reference. It's quite possible that this is due to some issue wth SP2 or some CU, not sure though. All I'm doing is calling out the content deployment API so the issue, whatever it is, is with that.

Paul said...

Hi Gary,

Do you have a command to enumerate all list items in an application or site collection?

Thanks!

Gary Lapointe said...

No, but you could do it pretty easily with powershell.

Jose M. Tamez said...

Thanks Gary! Great work and it really came in handy. Client will not store employee pictures in AD and this was the best solution. Keep up the great work!

Joet
www.jtwebnet.org

Anonymous said...

I have a requirement to copy documents from a group of Outlook public folders into Sharepoint 2007 sites. The purpose of this is to no longer use the public folders to store the documents.

There are thousands of documents and I do not want to do this manually using the Outlook copy command.

Also, setting up a sync connection is not acceptable because the documents will eventually be removed from Outlook.

Sending the documents as emails into SharePoint sites is also out as our firewall prevents any mail going into SharePoint at this time.

Do you know of any set of stsadm commands that can be used to do this?
Any tools (other then purchaseing third party tools) that can achieve this requirement?
Can you suggest someone who can answer this question if you can not?

Any help would be appriciated.

Many thanks in advance.

Gary Lapointe said...

Can you navigate to the files using explorer (webdav)? If so then you can simply drag and drop them into your document libraries. I believe Quest has a product to do this but I'm not aware of any free products.

Sharepoint Admin said...

Awesome set of tools! thanks so much for sharing these!

I have a question: Is there a way to 'migrate' the corporate portal from one farm to another? i.e. the portal is at: http://servername/
I have tried the "backup-restore" as well as the "export-import" commands but it does not work.
Thanks!

Digger-O-Dell said...

I seem to be having an issue using a web only available on a port. Weird because the site I exported the list from was on a port.

stsadm -o gl-importlist -url "http://mynewsite:83" -filename VocList.exp

The Web application at http://mynewsite:83 could not be found.

Although I am looking at it. I have tried the full path to the list as well.

http://mynewsite:83/Lists/MyNewList.aspx but get the same result.

pettsen said...

Hi,
This is the BEST tool.
Just what i needed

1000 thanks!

Sunday oke said...

Hi Gary

Thanks so much for your extensions, I’m sure they are such a life saver to so many Sharepoint Developers including myseld.

I would like to add a Sharepoint Group I have created to a list and give the group specific permissions to that group, e.g. I want the SharePoint Group “Students” to have “Contribute” rights to the SharePoint list “Shared Documents”. Because I have quite a number of site collections, I’d like to be able to do it from the command line with stsadm.

Regards
Sunday Oke

Adnan said...

do you have a method available in stsadm to migrate AD Security groups if they have moved from old AD to the new one?
the stsadm -o migrateuser method does not support AD security groups :(

Gary Lapointe said...

Sorry - I don't have anything to migrate AD groups.

Marnus said...

Hi Gary,

I've been using your stsadm extensions for a while now, but haven't said thanks yet. From the bottom of my heart, thank you good sir, you have saved me countless hours of struggles!!

Gary for President!

Marnus

Rohan said...

hi,

I want to create a web application but dont want to create a new content database and need to use the e xisting one.
How to do that?Need your help.

Jatin said...

Hi Gary, Thanks for this. I am stuck on the gl-exportlistfield. For some reason stsadm cannot access any folder on my local drive. What am i missing. I am a local admin on the box as well as have given Network Service account access to the folders. Please help!

Thanks

Jatin

Anonymous said...

Thanks for this set of tools!
Is there a tool to list all the field/attribute values of a single list item, like for a user in my Contact list?

Gary Lapointe said...

Try gl-exportlistitem2.

pvanbeek said...

What stsadm commands from 2007 are not found in the 2010 package? Particularly, after installing the SharePoint Server 2010 package, the command to set the theme is not present. Any others?

Gary Lapointe said...

Look at my post on the 2010 release. You'll see the stsadm commands that have been upgraded. Eventually I'll update this page but writing my book is my current priority so the blog has taken a back seat for a while.

J Tessier said...

Hi Gary, where is the post you reference? Thx, J

Gary Lapointe said...

http://stsadm.blogspot.com/2010/05/announcing-my-sharepoint-2010.html