1. 显示场中所有可用的网站集
- Get-SPSite
Get-SPSite
2. 显示某一Web应用程序下可用的网站集
- Get-SPSite –WebApplication "SharePoint – 80"
Get-SPSite –WebApplication "SharePoint – 80"
3. 显示某一内容数据库中可用的网站集
- Get-SPSite –ContentDatabase "WSS_CONTENT1"
Get-SPSite –ContentDatabase "WSS_CONTENT1"
4. 获取指定的网站集
- $webApp = Get-SPSite -Identity <a href="http://sp2010">http://sp2010</a>
$webApp = Get-SPSite -Identity http://sp2010/
5. 移除一个网站集
使用变量:
- $siteCol = Get-SPSite -Identity "http://sp2010/sites/sitecol"
- Remove-SPSite $siteCol
$siteCol = Get-SPSite -Identity "http://sp2010/sites/sitecol"
Remove-SPSite $siteCol
直接移除:
- Remove-SPSite –Identity <a href="http://sp2010/sites/sitecol">http://sp2010/sites/sitecol</a>
Remove-SPSite –Identity http://sp2010/sites/sitecol
6. 创建网站集
- New-SPSite –url http://sp2010/sites/sitecol -name Home
- -owneralias SP\SiteAdmin -template STS#0
New-SPSite –url http://sp2010/sites/sitecol -name Home
-owneralias SP\SiteAdmin -template STS#0
7. 设置网站集的锁定状态
- Set-SPSite –Identity http://sp2010/sites/sitecol -LockState NoAdditions
Set-SPSite –Identity http://sp2010/sites/sitecol -LockState NoAdditions
8. 设置网站集的存储限制
- Set-SPSite –Identity http://sp2010/sites/sitecol -MaxSize 1024
- -WarningSize 768
Set-SPSite –Identity http://sp2010/sites/sitecol -MaxSize 1024
-WarningSize 768
9. 在网站集下创建一个网站
- New-SPWeb –url http://sp2010/sites/sitecol/newsubsite
- -name "New Sub Site" -template STS#0 –AddToTopNav –UniquePermissions
- -UseParentTopNav
New-SPWeb –url http://sp2010/sites/sitecol/newsubsite
-name "New Sub Site" -template STS#0 –AddToTopNav –UniquePermissions
-UseParentTopNav
10. 显示某一个网站集下的所有子网站
- Get-SPWeb –Identity <a href="http://sp2010/sites/sitecol/*">http://sp2010/sites/sitecol/*</a>
Get-SPWeb –Identity http://sp2010/sites/sitecol/*
或
- Get-SPWeb –Site <a href="http://sp2010/sites/sitecol">http://sp2010/sites/sitecol</a>
Get-SPWeb –Site http://sp2010/sites/sitecol
11. 获取指定的网站
- $web = Get-SPWeb -Identity <a href="http://sp2010/sites/sitecol/subsite">http://sp2010/sites/sitecol/subsite</a>
$web = Get-SPWeb -Identity http://sp2010/sites/sitecol/subsite
12. 从网站集中移除一个网站
使用变量:
- $web = Get-SPWeb -Identity "http://sp2010/sites/sitecol/subsite"
- Remove-SPWeb $web
$web = Get-SPWeb -Identity "http://sp2010/sites/sitecol/subsite"
Remove-SPWeb $web
直接移除:
- Remove-SPWeb –Identity <a href="http://sp2010/sites/sitecol/subsite">http://sp2010/sites/sitecol/subsite</a>
Remove-SPWeb –Identity http://sp2010/sites/sitecol/subsite
13. 修改网站的URL
- Set-SPWeb –Identity "http://sp2010/sites/sitecol/newsubsite"
- –RelativeURL teamsites
Set-SPWeb –Identity "http://sp2010/sites/sitecol/newsubsite"
–RelativeURL teamsites
14. 移动网站集到另一个内容数据库
- Move-SPSite –Identity "http://sp2010/sites/sitecol"
- –DestinationDatabase "WSS_CONTENT_TEAMSITES"
Move-SPSite –Identity "http://sp2010/sites/sitecol"
–DestinationDatabase "WSS_CONTENT_TEAMSITES"
15. 将所有网站集从一个内容数据库移动到另一个内容数据库
- Get-SPSite –ContentDatabase "WSS_CONTENT_MAIN" | Move-SPSite
- –DestinationDatabase "WSS_CONTENT_TEAMSITES"