sharepoint scripts

stsadm:

#get size of the whole web app:
stsadm.exe -o enumsites -url <url> >> d:\temp\ContentStat.txt

 

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN


%CommonProgramFiles%\Microsoft Shared\Web Server Extensions\12\BIN\


full crawl
Stsadm -o spsearch -action fullcrawlstart

stsadm -o preupgradecheck

stsadm -o enumallwebs -databasename <db>  > orphan.txt

stsadm -o backup -url <url> -filename <filename>

stsadm -o restore -url <url> -filename <filename>

 


stsadm -o backup -url -filename d:\temp\msc1.bak

stsadm -o restore -url http:// -filename d:\temp\msc1.bak

 

 

stsadm -o enumallwebs -databasename WSS_Content>> orphantmp.txt

stsadm -o enumallwebs -databasename WSS_Content_ >> orphantmp.txt

 

 

===============================================================================================================================================
Powershell:
===============================================================================================================================================

(Get-SPSite -Limit all).Count

Get-SPSite -Limit All |ForEach-Object {$size=0}{ $size+=$_.Usage.Storage/1GB}{$size}


#get days since last update for the whole farm
Get-SPSite -limit all | select url, @{label="DateSinceLastModified";Expression={((get-date) - $_.LastContentModifiedDate).days }}| Sort-Object -Descending -Property "DateSinceLastModified" | ConvertTo-Html -title "Site Collections sort by LastModified" | Set-Content d:\temp\LastModified.html


#get size of the whole farm:
Get-SPSite -limit all | select url, @{label="Size_in_MB";Expression={$_.usage.storage/1MB}} | Sort-Object -Descending -Property "Size_in_MB" | ConvertTo-Html -title "Site Collections sort by size" | Set-Content d:\temp\size.html

 

Get-SPDatabase | Sort-Object disksizerequired -desc | Format-Table Name, @{Label ="Size in MB"; Expression = {$_.disksizerequired/1024/1024}} | out-file d:\temp\dbsize.txt

 

 

backup-SPSite -Identity http:// -Path d:\temp\gltc.bak


Restore-SPSite -Identity http://t -Path d:\temp\****bak -databasename WSS_Content

Remove-SPSite –Identity http:// -GradualDelete -Confirm:$False

 

  
  
check status  
  
Web App  Get-SPWebApplication http:// | Get-SPSite -Limit All |ForEach-Object { $_.GetVisualReport() } | format-table -property Sitepath,UIVersion|out-file d:\temp\test.txt
  
  
  
Site  Get-SPSite 'http://k' | Foreach-Object{$_.GetVisualReport() } |  out-file d:\temp\test.txt
  
 
 
Visual Upgrade, force upgrade  
  
web App  $webapp = Get-SPWebApplication httpc
   foreach ($s in $webapp.sites)
   {$s.VisualUpgradeWebs() }
  
site  Get-SPSite 'httpH' | Foreach-Object{$_.VisualUpgradeWebs() }
  
web  $web = Get-spweb  httpH
  $web.VisualUpgradeWebs()
  
  
  
fall back  
  
site  Get-SPSite 'http' | Get-SPWeb -Limit All | Foreach{$_.UIVersionConfigurationEnabled=1;$_.UIVersion=3;$_.Update();}
  
web  $Web=Get-SPWeb http://MO
  $Web.UIVersion=3
  $Web.UIVersionConfigurationEnabled=$true
  $Web.update()

 

 

Move-SPSite http://teahr -DestinationDatabase WSS_Content_IN3

 

Export-SPWeb -Identity http://m -Path <Path and File Name> [-ItemUrl <URL of Site, List, or Library>] [-IncludeUserSecurity] [-IncludeVersions] [-NoFileCompression] [-GradualDelete] [-Verbose]

Import-SPWeb [-Identity] <SPWebPipeBind> -Path <String> [-ActivateSolutions <SwitchParameter>] [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-Force <SwitchParameter>] [-HaltOnError <SwitchParameter>] [-HaltOnWarning <SwitchParameter>] [-IncludeUserCustomAction <None | All>] [-IncludeUserSecurity <SwitchParameter>] [-NoFileCompression <SwitchParameter>] [-NoLogFile <SwitchParameter>] [-UpdateVersions <Append | Overwrite | Ignore>] [-WhatIf [<SwitchParameter>]]

 

 

New-SPWeb http -Template "KB#0"


Mount-SPContentDatabase -Name WSS_Content_HK_Res -WebApplication http://c


Get-SPSite http://somesite | Get-SPWeb –Limit ALL |%{ Get-SPFeature –Web $_ } | Select DisplayName,ID -Unique

Get-SPFeature –Limit ALL | Where-Object {$_.Scope –eq "SITE"}

 

 

Get-SPWebApplicationHttpThrottlingMonitor "http"

 


Backup-SPFarm -Directory "\\h" -BackupMethod Full -Item “Farm\Shared Services\Shared Services Applications\Search Service Application” -Verbose

Backup-SPFarm -Directory "\\y" -BackupMethod Full -Item “Farm\Shared Services\Shared Services Proxies\Search Service Application” -Verbose


Restore-SPFarm -Directory "\\" -Item “Farm\Shared Services\Shared Services Applications\Search Service Application” -RestoreMethod Overwrite -Verbose


Restore-SPFarm -Directory "\" -Item “Farm\Shared Services\Shared Services Applications\Search Service Application” -RestoreMethod Overwrite

Get-SPBackupHistory -Directory "\\" -ShowBackup

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值