Powershell configure the SharePoint Environment (continued) and sharepoint Configuration

Source: Internet
Author: User

Powershell configure the SharePoint Environment (continued) and sharepoint Configuration


1. Assign permissions to users in 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. Start all Timer services in the SharePoint field:


$ SpFarm = Get-SPFarm

$ SpfTimerServcicesInstance = $ spFarm. TimerService. Instances

Foreach ($ spfTimerServiceInstance in $ spfTimerServcicesInstances)

{

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

$ SpfTimerServiceInstance. Stop ()

$ SpfTimerServiceInstance. Start ()

}


3. Back up solution in the SharePoint farm:


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

Set-Location $ FolderPath \ $ FolderName

(Get-SPFarm ). solutions | % {$ Solutions = (Get-Location ). path + "\" + $ _. name; $ _. solutionFile. saveAs ($ Solutions )}






What does SharePointps1 do? in C #, you can call powershell to manage sharepoint2010.

Powershell is a new generation of Microsoft scripts. It can be understood as an alternative to CMD. All new Microsoft software versions, including Hyper-v, Exchange, and 2008R2 AD, can be managed through Powershell, of course, Sharepoint works.
In addition, Powershell actually comes from C #. Many classes are directly changed by C #, or even C.
Therefore, your goals can be achieved.

PS1 is the suffix of A powershell script. You can double-click it or run powershell *. PS1 in CMD to run the script.
However, because of permission control, you must first execute the following command to use the script. Otherwise, an error is reported.
Set-ExecutionPolicy unrestricted

The following is a sample code for C # To call a Powershell script. It is found online.

/*

* C # sample code for calling PowerShell

*

* System. Management. Automantion. dll must be referenced.

*/

Using System;

Using System. Collections. Generic;

Using System. Collections. ObjectModel;

Using System. Management. Automation;

Using System. Management. Automation. Runspaces;

Using System. Text;

Namespace ConsoleApplication

{

Class Program

{

Static void Main (string [] args)

{

String result = RunScript ("get-process ");

Console. Write (result );

Console. Read ();

}

/// <Summary>

/// Run the script information and return the Script output

/// </Summary>

/// <Param name = "scriptText"> script to be run </param>

/// <Returns> output of the script </returns>

Private static string RunScript (string scriptText)

{

// Create Powershell runspace

Runspace runspace = RunspaceFactory. CreateRunspace ();

// Open it

Runspace. Open ();

// Create a pipeline and feed it the script text

Pipeline pipeline = runspac... the remaining full text>

An error occurred while running the sharepoint product and Technical Configuration Wizard today.

Sharepoint 3.0 is wss 3.0.
Wss3.0 does not need to install javaspooint 2007 sp1. there should be a WSS SP1.
If you want to install sharepoint
Remove wss. Install sharepoint 2007 again.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.