码迷,mamicode.com
首页 > 其他好文 > 详细

Powershell配置SharePoint环境(再续)

时间:2014-09-20 10:03:36      阅读:193      评论:0      收藏:0      [点我收藏+]

标签:sharepoint   powershell   


1. 给用户在User Profile Service Application中赋权:


$accountName = "contoso\testuser"

$claimType ="http://schemas.microsoft.com/sharepoint/2009/08/claims/userlogonname"

$claimValue = $accountName

$claim = New-Object Microsoft.SharePoint.Administration.Claims.SPClaim($claimType,$claimValue, "http://www.w3.org/2001/XMLSchema#string",[Microsoft.SharePoint.Administration.Claims.SPOriginalIssuers]::Format("Windows"))

$claim.ToEncodedString()

$permission = [Microsoft.SharePoint.Administration.AccessControl.SPIisWebServiceApplicationRights]"FullControl"

$SPAclAccessRule =[Type]"Microsoft.SharePoint.Administration.AccessControl.SPAclAccessRule``1"

$specificSPAclAccessRule =$SPAclAccessRule.MakeGenericType([Type]"Microsoft.SharePoint.Administration.AccessControl.SPIisWebServiceApplicationRights")

$ctor =$SpecificSPAclAccessRule.GetConstructor(@([Type]"Microsoft.SharePoint.Administration.Claims.SPClaim",[Type]"Microsoft.SharePoint.Administration.AccessControl.SPIisWebServiceApplicationRights"))

$accessRule =$ctor.Invoke(@([Microsoft.SharePoint.Administration.Claims.SPClaim]$claim,$permission))

$ups = Get-SPServiceApplication| ? { $_.TypeName -eq ‘User Profile Service Application‘ }

$accessControl =$ups.GetAccessControl()

$accessControl.AddAccessRule($accessRule)

$ups.SetAccessControl($accessControl)

$ups.Update()


2. 启动SharePoint场中所有的Timer Service:


       $spFarm=Get-SPFarm

       $spfTimerServcicesInstance=$spFarm.TimerService.Instances

       foreach($spfTimerServiceInstance in $spfTimerServcicesInstances)

       {

            Write-Host"Re-starting the instance " $spfTimerServiceInstance.TypeName

           $spfTimerServiceInstance.Stop()

           $spfTimerServiceInstance.Start()

        }


3. 备份SharePoint场中的solution:


New-Item $FolderPath\$FolderName -ItemType Directory -Force 

Set-Location$FolderPath\$FolderName

(Get-SPFarm).Solutions | %{$Solutions =(Get-Location).Path + “\” + $_.Name; $_.SolutionFile.SaveAs($Solutions)}  





Powershell配置SharePoint环境(再续)

标签:sharepoint   powershell   

原文地址:http://blog.csdn.net/gihow/article/details/39429585

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!