Platform is Sharepoint 2010 Enterprise Server Service Pack 1 on Windows Server 2008 R2; Powershell 2.0:
I was able to use dialogs in Central Admin Granular Backup to backup a doc library from a subsite but despite lots of trial and error and searching for tips, I cannot get theExport-SPWeb syntax right to get this working in Powershell. Here's a snippet of what worked via Central Admin:
Here what I was able to scrape out of the dialog output during the above successful backup:
Status Operation initializing.
Requested By CBMIWEB\sharepointadmin
Site Collection URL http://blacktip/sites/cbmi
Server Relative URL /sites/cbmi/HR/HR Documents
Filename c:\SharepointBackups\sites-cbmi-hr-employee-infocenter.cmp
Log file generated: c:\SharepointBackups\sites-cbmi-hr-employee-infocenter.cmp.export.log
One thing that may be affecting my Powershell problems is that the library is exposed as"Employee InfoCenter" but this "translates" into something called "HR Documents".
With Powershell I have tried many variations of syntax. Here are the two that I believe are "closest" to being correct but please note each form gives a different error:
This syntax gives some sort of unknown error or general SPException:
Export-SPWeb :
At C:\Scripts\exportListOfSubsite.ps1:2 char:13
+ export-SPWeb <<<< http://blacktip/sites/cbmi -ItemUrl "/sites/cbmi/HR/HR Documents" -Path c:\SharepointBackups\sites-cbmi-hr-library-employee-infocenter.cmp
+ CategoryInfo : InvalidData: (Microsoft.Share...CmdletExportWeb:SPCmdletExportWeb) [Export-SPWeb], SPException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletExportWeb
This next syntax gives me an error I have seem many times before in my attempts; I have chased all around with Bing and Google and tried different things:
Export-SPWeb : The URL provided is invalid. Only valid URLs that are site collections or sites are allowed to be exported using stsadm.exe.
At C:\Scripts\exportListOfSubsite.ps1:3 char:13
+ export-SPWeb <<<< http://blacktip/sites/cbmi -ItemUrl "/sites/cbmi/HR/Employee InfoCenter" -Path c:\SharepointBackups\sites-cbmi-hr-library-employee-infocenter.cmp
+ CategoryInfo : InvalidData: (Microsoft.Share...CmdletExportWeb:SPCmdletExportWeb) [Export-SPWeb], SPException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletExportWeb
Please note that I have been able to get other document libraries of other site collections backed up with various changes to the-ItemUrl parameter. I wish there were a way to look at the log file generated when Central Admin works and somehow copy a command out of the log file that could be lifted into Powershell. Thanks in advance for advice on this.
John