SharePoint 2010: Powershell ile SharePoint'u nasil kullanabilirim (tr-TR)

SharePoint 2010: Powershell ile SharePoint'u nasil kullanabilirim (tr-TR)

SharePoint 2010 ile ön plana çıkan bir başka özellik PowerShell commend-lets leri ile yönetilebilir olması. Bu makalemde sizlere nasıl SharePoint Server 2010’ü User interface olmadan kullanılacağını göstereceğim.

Powershell ekranına erişmek için Windows 7 veya SharePoint ‘un özel PowerShell’de başlatmak için

Tüm programlar > Donatılar > Windows Powershell’e tıklamanız yeterli olacaktır. Eğer bu uzun geldiyse Run’a Powershell.exe yazmanız yeterli olacaktır. Karşınıza aşağıda görüntülenen mavi ekran gelecektir. (Komut satırından çalıştırılması durumunda siyah ekran gelir bu kafanızı karıştırmasın.)

clip_image001

SharePoint Modüllerini load etmeniz için sadece Add-SPShellAdmin giriniz.

Yeni bir Document library

PowerShell’e bu cmd-lets’leri giriniz

$spWeb=Get-SPWeb-Identityhttp://SUNUCUM
$listTemplate=[Microsoft.SharePoint.SPListTemplateType]::DocumentLibrary
$spWeb.Lists.Add(“GokanDocuments”,“Information by Gokan”,$listTemplate)

clip_image003

Yeni bir web application:

clip_image004

# SharePoint cmdlets
Add-PsSnapin Microsoft.SharePoint.PowerShell
# Templatler
# —- —– ——– ——
# GLOBAL#0 Global template 1033 False
# STS#0 Team Site 1033 False
# STS#1 Blank Site 1033 False
# STS#2 Document Workspace 1033 False
# MPS#0 Basic Meeting Workspace 1033 False
# MPS#1 Blank Meeting Workspace 1033 False
# MPS#2 Decision Meeting Work 1033 False
# MPS#3 Social Meeting Works 1033 False
# MPS#4 Multipage Meeting Work 1033 False
# CA#0 Central Admin Site 1033 False
# WIKI#0 Wiki Site 1033 False
# BLOG#0 Blog 1033 False
# SGS#0 Group Work Site 1033 False # Languages
#
# —- —–
# German 1031
# English 1033
# French 1036
# Spanish 1034
 
# variables seciyoruz
$SiteCollectionName = “Homepage”
$SiteCollectionURL = “TechNet.gokmania.com”
$SiteCollectionTemplate = “STS#0″
$SiteCollectionLanguage = 1033
$SiteCollectionOwner = “gokmania\spfarm”
 
# Ve Site Collectionumuz olusuyor
New-SPSite -URL $SiteCollectionURL -OwnerAlias $SiteCollectionOwner -Language
 
$SiteCollectionLanguage -Template $SiteCollectionTemplate -Name $SiteCollectionName

Yeni bir Site Collection:

clip_image005

cmdlets
Add-PsSnapin Microsoft.SharePoint.PowerShell
# Templatler
# —- —– ——– ——
# GLOBAL#0 Global template 1033 False
# STS#0 Team Site 1033 False
# STS#1 Blank Site 1033 False
# STS#2 Document Workspace 1033 False
# MPS#0 Basic Meeting Workspace 1033 False
# MPS#1 Blank Meeting Workspace 1033 False
# MPS#2 Decision Meeting Work 1033 False
# MPS#3 Social Meeting Works 1033 False
# MPS#4 Multipage Meeting Work 1033 False
# CA#0 Central Admin Site 1033 False
# WIKI#0 Wiki Site 1033 False
# BLOG#0 Blog 1033 False
# SGS#0 Group Work Site 1033 False # Languages
#
# —- —–
# German 1031
# English 1033
# French 1036
# Spanish 1034
 
# variables seciyoruz
$SiteCollectionName = “Homepage”
$SiteCollectionURL = “TechNet.gokmania.com”
$SiteCollectionTemplate = “STS#0″
$SiteCollectionLanguage = 1033
$SiteCollectionOwner = “gokmania\spfarm”
 
# Ve Site Collectionumuz olusuyor
New-SPSite -URL $SiteCollectionURL -OwnerAlias $SiteCollectionOwner -Language
 
$SiteCollectionLanguage -Template $SiteCollectionTemplate -Name $SiteCollectionName

SQL Server’den veri alabilmek için:

$SqlConnection = New-Object System.Data.SqlClient.SqlConnection
$SqlConnection.ConnectionString = “Server=SERVER;Database=DATABASENAME;Integrated Security=True”
$SqlConnection.Open()
$SqlCmd = New-Object System.Data.SqlClient.SqlCommand
$SqlCmd.CommandText = “select * from tblMARQUET”
$SqlCmd.Connection = $SqlConnection
$dbname = $SqlCmd.ExecuteScalar()
$SqlConnection.Close()
Write-output “Database is ” $dbname

Bir kullanıcıya READER hakki vermek

$site = Get-SPSite -Identity “http://mysite/”
$user = Get-SPUser -Identity “mydomain\myuser” -Web $site.RootWeb
$assignment = New-Object Microsoft.SharePoint.SPRoleAssignment($user)
$role = $site.RootWeb.RoleDefinitions[[Microsoft.SharePoint.SPRoleType]::Reader]
$assignment.RoleDefinitionBindings.Add($role);
 
foreach ($web in $site.AllWebs) {
if ($web.HasUniquePerm) {
$web.RoleAssignments.Add($assignment)
}
}

Leave a Comment
  • Please add 3 and 6 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Sort by: Published Date | Most Recent | Most Useful
Comments
  • Gokan Ozcifci edited Revision 1. Comment: Add Tags: Translated into Turkish

Page 1 of 1 (1 items)
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • Gokan Ozcifci edited Revision 1. Comment: Add Tags: Translated into Turkish

Page 1 of 1 (1 items)