Вопрос

In the code below i only want to get following 3 specific subsites using Get-SPWeb Object. which filter command is most appropriate to target only these 3 sites

1. http://myCo.root.site/sites/News/press_releases 
2. http://myCo.root.site/sites/news-and-media 
3. http://myCo.root.site/br/events_training

    $WepApp = "http://myCo.root.site/"
    $Global:site = Get-SPSite $WepApp

    Function FindSubsites
    {
        $Global:site | Get-SPWeb where -$_.Name -eq  | ForEach-Object { // which filter command i use here
        // do something here
     }
    }
Это было полезно?

Решение

$WepApp = "http://myCo.root.site/"
$site = Get-SPSite $WepApp
$array = @("Title of the First Site", "Title of the Second Site")
$filteredWebs = $site | Get-SPWeb | ? {$array -contains $_.Title}

Or you can have URLs in the array and filter by by $_.Url.

Другие советы

You're really, really close...

$WebApp = Get-SPWebApplication "<your webapp address here>"
$site = Get-SPSite $WebApp
$site.AllWebs | Where-Object { $_.Title -contains $yourstringfilterwhateveritis }

This is a very common issue which comes up when we upgrade SharePoint or add Package . One need to add the SPDataAccess role to the respective users so that user can manipulate the content database. Please find step of procedure to resolve the issue.

  • In Object Explorer, expand the Security node, and then double-click on the search service account (eg, spSearch). The Login Properties dialog appears.
  • In the Select a page navigation panel, select User Mapping.
  • In the Users mapped to this login panel, select the farm configuration database (eg, farm_Config).
  • Enable the SPDataAccess role
  • Click OK.
Лицензировано под: CC-BY-SA с атрибуция
Не связан с sharepoint.stackexchange
scroll top