Joel's SharePoint Architect Blog

SharePoint 2013 Training, Architecture, Administration and Development

Subscribe Subscribe  View Joel Jeffery's profile on LinkedIn
joelblogs.co.uk | joelj.co.uk | joeljeffery.co.uk | jfdiphoenix.co.uk

The purpose of STSADM’s “copyappbincontent” command is:

stsadm –o copyappbincontent

Copies Web application–specific files, such as page resource (*.resx) files from their respective locations in the 12CONFIG folder to the correct location in each Web application on the computer.

According to TechNet, there is no equivalent PowerShell cmd-let http://technet.microsoft.com/en-us/library/ff621081.aspxt:

No PowerShell Equivalent to stsadm -o copyappbincontent

However, there is a PowerShell cmd-let called Install-SPApplicationContent:

Install-SPApplicationContent

Copies shared application data to existing Web application folders.

Now that sounds pretty similar.

I’ve tried this out – making a custom layouts.sitemap.xml file, and invoking Install-SPApplicationContent. It copies/merges the sitemap into the correct place under inetpubwwwrootwssVirtualDirectories*_app_bin.

So, how dissimilar are they? I’ve heard it said that the PowerShell version won’t apply your changes to the whole farm, only the current server. But surely, that’s what stsadm does too?

Let’s use the rather fantastic open-source ILSpy replacement for Reflector to reflect over the code,

STSADM’s copyappbincontent decompiled

// Microsoft.SharePoint.StsAdmin.SPCopyAppBinContent
public override void Run(StringDictionary keyValues)
{
    SPServiceInstance sPServiceInstance = SPWebServiceInstance.LocalContent;
    if (sPServiceInstance != null && sPServiceInstance.Status == SPObjectStatus.Online)
    {
        SPWebService contentService = SPWebService.ContentService;
        contentService.ApplyApplicationContentToLocalServer();
    }
    sPServiceInstance = SPWebServiceInstance.LocalAdministration;
    if (sPServiceInstance != null && sPServiceInstance.Status == SPObjectStatus.Online)
    {
        SPWebService administrationService = SPWebService.AdministrationService;
        administrationService.ApplyApplicationContentToLocalServer();
    }
}

Microsoft.SharePoint.PowerShell’s Install-SPApplicationContent decompiled

if (sPWebServiceInstance.Status == SPObjectStatus.Online)
{
  SPWebService administrationService = SPWebService.AdministrationService;
  ServiceHelper.TryToControlService("W3SVC", false, out flag, out flag2);
  administrationService.ApplyApplicationContentToLocalServer();
}
if (null != SPWebServiceInstance.LocalContent)
{
  if (SPWebServiceInstance.LocalContent.Status == SPObjectStatus.Online)
  {
    ServiceHelper.TryToControlService("W3SVC", false, out flag3, out flag4);
    SPWebService contentService = SPWebService.ContentService;
    contentService.ApplyApplicationContentToLocalServer();
  }
}

Conclusion

So, there you have it. Like two completely dissimilar things… in a pod.

To be clear: you need to invoke either of these methods on each server in your farm to deploy content from the 14 hive to the IIS virtual directories.

Or have I missed something?

Technorati Tags: PowerShell, SharePoint, SharePoint 2010, SharePoint Administration, SharePoint Development

 

You can leave a response, or trackback from your own site.

One Response to “STSADM copyappbincontent vs. Install-SPApplicationContent”

  1. sayyads says:

    hi, i am doing bsc.hv training 2010vs,visual studio2010 hv in my computer,this is usefull for me if i want to train for shairpoint.i already finished my webapplication visual studio,2008,ajax enabled,wcf pls advice me so i decided to train for shair point. but the plain is for MCS complete inshallah.so i want to do this for best in future.best regards.sayyads shagufta nadeem.

Leave a Reply