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
| #Checking the Refiners refinable property for Managed Properties | |
| Write-Host "Checking for refinable property for managed property" -ForegroundColor Yellow | |
| $searchServiceApp=Get-SPEnterpriseSearchServiceApplication | |
| $isFullCrawlRequired=$false; | |
| #Custom Audience Managed Property | |
| Write-Host "Checking refinable property for CustomAudience" -ForegroundColor Yellow | |
| $audience= Get-SPEnterpriseSearchMetadataManagedProperty -SearchApplication $searchServiceApp | ? {$_.Name -eq "owstaxidCustomAudience"} | |
| #Metadata Managed Property is always starts with owstaxid* | |
| if($audience.Refinable -eq $false){ | |
| $audience.Refinable =$true |
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
| $webApp = Get-SPWebApplication "My web application url here" | |
| $webApp | Get-SPContentDatabase | ft Name # get the content database number | |
| $arguments = New-Object Microsoft.SharePoint.Administration.SPWebApplication+SPMigrateUserParameters | |
| $arguments.AddDatabaseToMigrate($webApp.ContentDatabases[0]) | |
| $webApp.MigrateUsersToClaims("farm admin account", $false, $arguments) |
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
| param | |
| ( | |
| [string]$name | |
| ) | |
| if($name) | |
| { | |
| Write-Host "Welcome $name from second file" | |
| } | |
| else | |
| { |
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
| clear-Host | |
| $snapin = Get-PSSnapin | Where-Object { $_.Name -eq "Microsoft.SharePoint.Powershell" } | |
| if ($snapin -eq $null) { | |
| Write-Host "Loading SharePoint Powershell Snapin..." | |
| Add-PSSnapin "Microsoft.SharePoint.Powershell" | |
| } | |
| Write-Host "First!!" | |
| $name = $(Read-Host -Prompt "Enter your Name:") |
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
| $resultSourceID=$resultSource.ID | |
| $resultSourceLevel="SPSite" | |
| $webURL =$web.Url + "/searchcentre" | |
| $web=Get-SPWeb $webURL | |
| $pageUrl="$webURL/Pages/results.aspx?k=test" | |
| $page=$web.lists["Pages"].Items | ? {$_.Name -eq "results.aspx"} | |
| $page.File.CheckOut(); | |
| $webpartmanager=$web.GetLimitedWebPartManager($pageUrl, [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared) | |
| $webpart = $webpartmanager.WebParts | ? { $_.Title -eq 'Search Results' } | |
| $dataProvider = ConvertFrom-Json $webpart.DataProviderJSON |
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
| rite-Host "setting up the site collection level result souce for the site" -ForegroundColor yellow | |
| $resultSourceName="MyResultSource" | |
| $resultSourceDescription ="site collection result source" | |
| $query="{searchTerms?} Path:{SiteCollection.Url}" | |
| $ssa = Get-SPEnterpriseSearchServiceApplication "Search Service Application" | |
| $fedman = New-Object Microsoft.Office.Server.Search.Administration.Query.FederationManager($ssa) | |
| $searchOwner = Get-SPEnterpriseSearchOwner -SPWeb $web -Level SPSite | |
| $resultSource = $fedman.GetSourceByName($resultSourceName, $searchOwner) | |
| #Check To See if it exists |
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
| Write-Host "Settings results page for search centre for your site" -ForegroundColor Yellow | |
| $SEARCH_SETTINGS_PROPERTY_NAME = "SRCH_SB_SET_WEB" | |
| $settingsObj = @{} | |
| $settingsObj.Inherit = $false | |
| $settingsObj.ResultsPageAddress = "/searchcentre/pages/results.apsx" | |
| $settingsObj.ShowNavigation = $false | |
| $settingsObjAsJSON = ConvertTo-Json $settingsObj -Compress | |
| if (!$web.AllProperties.ContainsKey($SEARCH_SETTINGS_PROPERTY_NAME)) | |
| { |
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
| $Url = $(Read-Host -Prompt "Enter site url:") | |
| if(-not(Get-PSSnapin | Where-Object {$_.Name -eq "Microsoft.SharePoint.PowerShell"})) { | |
| Add-PSSnapin Microsoft.SharePoint.PowerShell; | |
| } | |
| $site = Get-SPSite $Url | |
| Write-Host "Settings up search centre setup for your site" -ForegroundColor Yellow | |
| $webs=$site.AllWebs | ? {$_.Url -like "*search*"} | |
| $webs | % { Write-Host "Deleting old search centre" -ForegroundColor Yellow ; $_.Delete() } | |
| Enable-SPFeature -Identity "BaseSite" -Url $site.Url | |
| $searchSiteUrl= $site.Url+"/searchcentre" |
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
| function Connect-QueryStringFilterWP-To-BCSListWP($pageUrl,$fileName,$providerWP,$consumerArrayValue,$providerArrayValue,$consumerConnectionId) | |
| { | |
| $webPartGallery = $web.Lists["Web Part Gallery"] | |
| $webpartmanager=$web.GetLimitedWebPartManager($pageUrl, [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared) | |
| Write-Host "Searching Consumer webpart $fileName in web part gallery" -ForegroundColor Yellow | |
| if($webPartGallery -eq $null) | |
| { | |
| Write-Host("Unable to retrieve Webpartgallery"); | |
| } | |
| $webPartConsumer = $webpartmanager.WebParts | Where {$_.Title -eq $fileName} |
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
| $Url = $(Read-Host -Prompt "Enter site url:") | |
| $web = Get-SPWeb $Url | |
| $web.AllowUnsafeUpdates=$true | |
| function Add-WebPartToPage($pageUrl, $webpartzone,$index,$fileName) | |
| { | |
| $webPartGallery = $web.Lists["Web Part Gallery"] | |
| Write-Host "Searching webpart $fileName in web part gallery" -ForegroundColor Yellow | |
| if($webPartGallery -eq $null) |
NewerOlder