Last active
August 22, 2017 07:21
-
-
Save mutuadavid93/057f24d42e1e516923f329f26f2270d4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NB: The SiteCollection is Created automatically. If you try to make the collection first | |
an Exception will be thrown; "The Site Collection Already Exists". | |
NB: You don't need the -HostHeaderWebApplication parameter if the site being restored, share | |
the same name as the web application. | |
### Backup | |
Backup-SPSite http://s-hqs-spdev/sites/branding/ -Path C:\COLLECTIONS\Branding.bak –UseSqlSnapshot | |
### Restore with a named contentDatabase | |
Restore-SPSite -Identity http://s-hqs-spstagsvr/sites/branding -Path "C:\COLLECTIONS\Branding.bak" -ContentDatabase MyDB -Verbose | |
### Restore To a Named WebApplication | |
Restore-SPSite -Identity http://s-hqs-spdev/sites/stb -Path "C:\COLLECTIONS\Branding.bak" -HostHeaderWebApplication http://s-hqs-spdev/ -Force -Verbose | |
### | |
Restore-SPSite -Identity "http://s-hqs-spdev/sites/ourbrand" -Path "C:\COLLECTIONS\Branding.bak" -Force -Verbose | |
### List all site collections in a webApplication into a txt file | |
Add-PSSnapin "Microsoft.SharePoint.PowerShell" | |
Get-SPWebApplication http://s-hqs-spdev | Get-SPSite | Select ID, Url | Out-File -FilePath "C:\spSites.txt" | |
## Get All Sub-Sites of a Site Collection. | |
$siteColl = Get-SPSite http://yoursite/collection | |
$sitecoll.Allwebs > c:\SubSites.txt | |
## Create a Site Colection (Based on the Developer Site Template) | |
$template = Get-SPWebTemplate "DEV#0"; | |
$siteColl = "<WebApplication Url>/sites/mystcoll"; | |
New-SPSite -Url $siteColl -OwnerAlias "domain\user" -Template $template -Verbose | |
### Export Deploy a .wsp file to another Server | |
NB: Just cd into the dir where you have all your .wsp files and execute the commands a s batch in | |
Elevated SharePoint Management Shell. | |
$dir = "C:\COLLECTIONS\Deployment"; | |
$list = Get-ChildItem $dir | where {$_.extension -eq ".wsp"}; | |
foreach($my_file in Get-ChildItem $list){Add-SPSolution -LiteralPath $my_file.FullName}; | |
foreach($my_file in Get-ChildItem $list){Install-SPSolution -Identity $my_file.Name -webapplication "http://s-hqs-spstagsvr/" -CompatibilityLevel {14,15} -GACDeployment -Confirm:$false}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice! Ty!