[void] [System.Reflection.Assembly]::Load("Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | out-null [void] [System.Reflection.Assembly]::Load("Microsoft.Office.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | out-null [void] [System.Reflection.Assembly]::Load("Microsoft.Office.Server.Search, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | out-null $SITEURL = "http://win-vb36k92oi63" $spsite = new-object Microsoft.SharePoint.SPSite ( $SITEURL ) $serverContext = [Microsoft.Office.Server.ServerContext]::Default $context = [Microsoft.Office.Server.Search.Administration.SearchContext]::GetContext($serverContext) $sspcontent = new-object Microsoft.Office.Server.Search.Administration.Content($context) $sspContentSources = $sspcontent.ContentSources [int]$count $count=0 foreach ($cs in $sspContentSources) { if ($cs.CrawlStatus -eq [Microsoft.Office.Server.Search.Administration.CrawlStatus]::Paused) { $count++ } } if ($count -gt 0) { $spweb = $spsite.OpenWeb() $splist = $spweb.Lists["NewList"]; $items=$splist.get_items() | where { $_.Title -like '*' } if ($splist.ItemCount -gt 0) { $items | % { $_.Delete() } } $newItem = $splist.Items.Add() $newItem["Title"] = "NewItemsssssssssss" $newItem["Status"] = "NewStatussssssssssssssss" $newItem.Update() $spweb.Dispose() $spsite.Dispose() }