none
backup/export site collection from an unattached contentdatabase using powershell

    Question

  • Hi

    Using server 2012 R2 and SharePoint 2013 lastest CU. PowerShell 4.

    Microsoft provides a teacup of information on how to access/recover data in an unattached contentdatabase:
    https://technet.microsoft.com/en-us/library/hh269602.aspx#PS

    Get-SPContentDatabase -ConnectAsUnattachedDatabase  -DatabaseName <DatabaseName> -DatabaseServer <DatabaseServer>

    Im trying to backup a site collection that is in this unattached contentdatabase using PowerShell.

    Any tips on how to proceed?

    Brgs

    Bjørn Roalkvam

    Friday, April 28, 2017 1:18 PM

Answers

  • Ofcourse i got it just after!

    $siteUrl = "http://mysitecollectionurl"
    $dbServer = "db01"
    $dbName = "unattachedContentdatabase"
    
    $db = Get-SPContentDatabase -ConnectAsUnattachedDatabase -DatabaseName $dbName -DatabaseServer $dbServer
    
    
    Get-SPSite -ContentDatabase $db -limit all | ? {$_.Url -eq $SiteURL} | Backup-SPSite -Path "E:\Temp\old_site.bak"

    brgs

    Bjørn

    Friday, April 28, 2017 1:31 PM

All replies

  • Ofcourse i got it just after!

    $siteUrl = "http://mysitecollectionurl"
    $dbServer = "db01"
    $dbName = "unattachedContentdatabase"
    
    $db = Get-SPContentDatabase -ConnectAsUnattachedDatabase -DatabaseName $dbName -DatabaseServer $dbServer
    
    
    Get-SPSite -ContentDatabase $db -limit all | ? {$_.Url -eq $SiteURL} | Backup-SPSite -Path "E:\Temp\old_site.bak"

    brgs

    Bjørn

    Friday, April 28, 2017 1:31 PM
  • Hi,

    Thanks for your sharing.

    Thanks,

    Dean Wang


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Monday, May 01, 2017 7:44 AM
    Moderator