This example creates a basic content database profile using the RBS interface. RBS requires SQL Server 2008 Enterprise Edition and the profile creation will error out if trying to activate an RBS profile on any previous edition of SQL Server.
$cid = Get-ContentDbId s "http://sharepoint/site"
Add-Endpoint epn "NAS Endpoint 1" adn "FileSystem" conn "path=\\NAS\FILESTORE" UseCompression UseEncryption EncryptionPassphrase "anypassword"
Add-Profile pn "Content Db Profile" ptype ContentDb sid $cid UseRBS eid "NAS Endpoint 1"
This example iterates all of the site collections in a web application and creates a profile for each one. Each profile uses the same endpoint but specifies a different Start Folder. Using different Start Folder values will keep the content separated by profile even though the same endpoint is being used.
# Add the common endpoint
Add-Endpoint epn "Common Endpoint 1" adn "FileSystem" conn "path=\\NAS\COMMON"
# Get web app - there are many other ways to do this.
$site = New-Object Microsoft.SharePoint.SPSite("http://spsite")
$webapp = $site.WebApplication
# Iterate through all site collections in web app
foreach($sc in $webapp.Sites)
{
$startfolder = $sc.RootWeb.Title
$profilename = $startfolder + " Profile"
Write-Output "Creating profile for: $startfolder"
# Create profile
Add-Profile pn $profilename ptype SiteCollection sid $sc.ID.ToString() eid "Common Endpoint 1" -EndpointStartFolder $startfolder
# Cleanup
$sc.Dispose()
}
# Cleanup
$site.Dispose()
This example creates a profile that will select endpoints asynchronously. This allows the profile to support enhanced filters including file extension/type and multiple additional scope options including web, list and content type. This sample sets up a filter to externalize only Microsoft Word and Excel documents.
$siteid = Get-SiteCollectionId s "http://sharepoint/site"
Add-Endpoint epn "NAS Endpoint 1" adn "FileSystem" conn "path=\\NAS\FILESTORE"
Add-Profile pn "Site Collection 1 Profile" ptype SiteCollection sid $siteid SelectEndpointAsync eid "NAS Endpoint 1" EndpointFileTypeOp 1 EndpointFileTypes "DOCX,DOC,XLS,XLSX"
This example displays all endpoints in the system whose name contains the word Test. This illustrates the use of WHERE filters in PowerShell as well as use of StoragePoint API object properties (EndpointAPI.Name and .Connection in this case).
$Endpoints = Get-AllEndpoints | Where-Object {$_.Name -Like "*Test*"}
ForEach ($ep in $Endpoints) {$ep.Name + " : " + $ep.Connection}
© ALL RIGHTS RESERVED. 이용 약관 개인정보 보호정책 Cookie Preference Center