SharePoint 2010: SharePoint Server’ın PowerShell İle Yönetimi Nasıl Yapılır – Detaylı Örnekler

SharePoint 2010: SharePoint Server’ın PowerShell İle Yönetimi Nasıl Yapılır – Detaylı Örnekler

2010 ile ön plana çıkan bir başka özellik commend-lets leri ile yönetilebilir olması. Bu makalemde sizlere nasıl 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.)


Resim-1

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)


Resim-2

Yeni Bir Web Application:


Resim-3

 

# 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:


Resim-4

 

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 İç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 Hakkı 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)
 }
 }

Görüldüğü gibi SharePoint Server’I sadece PowerShell cmd-letsleri ile yönetmemiz mümkün.

Ama bu SharePointcular arasında çok tartışılan bir konu.. Ben pek PowerShell kullanmıyorum ama cazip gelmiyor değil.. SharePoint’un bize sunmadığını PowerShell cmd-letsleri sunuyor..

Other Languages


Wiki: How to create webb app in Powershel ( en-US )
Leave a Comment
  • Please add 8 and 1 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 3. Comment: content

  • Gokan Ozcifci edited Revision 2. Comment: Other Languages

  • Gokan Ozcifci edited Original. Comment: Tag: Translated into Turkish

Page 1 of 1 (3 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 Original. Comment: Tag: Translated into Turkish

  • Could you link back to the English article with the "Other Languages" section in both articles? Thanks!

  • Gokan Ozcifci edited Revision 1. Comment: Other Languages

  • Gokan Ozcifci edited Revision 2. Comment: Other Languages

  • Gokan Ozcifci edited Revision 3. Comment: content

Page 1 of 1 (5 items)