Showing posts with label PowerShell. Show all posts
Showing posts with label PowerShell. Show all posts

Friday, October 20, 2017

Set Modern Page as a Home Page in SharePoint Online

To Set Modern Page as a Home Page in SharePoint Online you can use the following Code from SharePoint Online PowerShell:

$siteUrl = "Your Site Url"
$password="Your Username"
$username="Your Password"
$WelcomePageUrl ="Welcome Page Url" #SitePages/WelcomePage.aspx

#Add Reference dlls
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
Import-Module Sharegate




#Set Connectivity Information
write-host "Connecting to SharePoint "$siteUrl
$pwd =  convertto-securestring $password -asplaintext -force
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl) 
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $pwd)
$ctx.Credentials = $credentials

#Set Welcome Page
    $web = $ctx.Web
    $rootFolder = $web.RootFolder; 
    $rootFolder.WelcomePage = $WelcomePageUrl;
    $rootFolder.Update();
    $ctx.ExecuteQuery();

Saturday, December 22, 2012

Command does not work

Sometimes when you copy command from Site and try to run from PowerShell or Command Line.
Command Give error or doesn't give expected result, Although it is correct like command below:
stsadm -o backup -url sitecollectionurl -filename -backupfilepath
Although command appear correct there is some characters incorrect like '-',' '. To eliminate this problem you need to rewrote unascii character (dash, space) and rewrote again. Space here has ascii value is 140 instead of 32

Wednesday, February 8, 2012

Creating a FAST Search Scope

When you try to create scope in Fast Search Search 2010. This will not work only way to create scope in SharePoint Search using PowerShell. Command Below is sample of command for creating scope:

New-SPEnterpriseSearchQueryScope -SearchApplication "FAST Query Application" -Name "NewScope" -Description "This is my new scope" -DisplayInAdminUI 1 -ExtendedSearchFilter 'path:starts-with("http://myserver/mysitecoll")'

The ExtendedSearchFilter parameter specifies a FAST Query Language (FQL) expression that will filter the content for that scope.

There is 2 good blogs talk about Fast Search scope:
http://blogs.msdn.com/b/jorgeni/archive/2010/02/26/search-scopes-in-fast-search-for-sharepoint-part-1.aspx

http://blogs.msdn.com/b/jorgeni/archive/2010/03/11/search-scopes-in-fast-search-for-sharepoint-part-2.aspx