0

We are in the process of rolling out an extranet for some of our partners using WSS 3.0 as the platform. We already use it internally for a variety of things, and we are using the following powershell script to backup the server:

param(
    $url="http://localhost",
    $backupFolder="c:\"
)
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

$site= new-Object Microsoft.SharePoint.SPSite($url)
$names=$site.WebApplication.Sites.Names
foreach ($name in $names)
{
    $n2 = ""
    if ($name.Length -eq 0) 
        { $n2="ROOT" }
    else
        { $n2 = $name }
    $tmp=$n2.Replace("/", "_") + ".sbk"
    $saveas = ""
    if ($backupFolder.Length -eq 0) 
        { $saveas = $tmp }
    else
        { $saveas = join-path -path $backupFolder -childPath $tmp }
        $site.WebApplication.Sites.Backup($name, $saveas, "true")
        write-host "$n2 backed up to $saveas."
}

This script works perfectly on the current installation running as our domain backup user.

On the new box, it fails when ran as the backup user--claiming "The web application located at http://extranet/" could not be found. That url does, in fact, work so I'm fairly certain it isn't anything that dumb and rather is some permissions issue. Especially because, when executed from my security context, the script works perfectly.

I have tried making the backup user a farm owner, as well as added him to the various site collection admin groups on the extranet. The one major difference between the extranet and the intranet server is that the extranet has an alternative access mapping (for https://xnet.example.com) and also uses forms authentication for that mapping. Anyhow, what permissions (or other voodoo) do I need to setup to get this script to work properly?

2
  • Any particular reason your not using stsadmin to do this? Sep 17, 2009 at 19:34
  • Maintenence--the powershell enumerates the site collections for me and grabs everything. Elsewise someone has to remember to go update the backup script when they add a site. I'd also bet that internally, STS admin is making a call to SPSite.WebApplication.Backup so it really is a matter of how to get there. Sep 17, 2009 at 19:49

1 Answer 1

-1

im a bit fuzzy on this, as its been a while and i dont have the server in question in front of me, but i think i had a similar problem.

we had a sharepoint services site that absolutely would not back up at all no matter what i did - until i created a share with write access for the guest user (i think).

this is really a terrible answer, and ill update it later with more detail.

UPDATE: mine is also implemented using stsadmin, per a commenter above. i did not enumerate any specific sites or hosts other than the machine that is hosting sharepoint itself.

3
  • Any updates--still can't seem to get this going. Oct 7, 2009 at 23:05
  • This is not a good answer. I hope you edit your answer to be more accurate and concise.
    – jftuga
    Mar 28, 2011 at 19:51
  • i tried to delete it, but its the accepted answer so i can only vote to have it deleted.
    – Devnull
    Mar 28, 2011 at 19:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .