Configuring Alternate Access Mapping in SharePoint 2010 using Windows PowerShell
2011-06-01 16:00
585 查看
Problem
In a previous tip on Configuring Alternate Access Mapping in SharePoint 2010, we've seen how to configure alternate access mapping for a SharePoint 2010 site using the Central Administration page. How do we do this task using Windows PowerShell instead?Solution
Windows PowerShell is an extensible command-line shell and associated scripting language built on top of the .NET Framework v2.0. Being the standard scripting environment for almost all of the current Microsoft server products, it is essential for the SharePoint administrator to learn a few things about Windows PowerShell. And with the latest version of SharePoint comes the specific PowerShell cmdlets for managing and administering site collections, web applications, user permissions and anything that has something to do with SharePoint. While they were written with the SQL Server DBA in mind, the concepts to get started with Windows PowerShell are the same.To manage SharePoint using Windows PowerShell, you can launch the SharePoint 2010 Management Shell from the Start menu. Make sure that you run the management shell as administrator to perform administrative tasks.
You can learn more about the SharePoint-specific cmdlets by using the Get-Help cmdlet and passing it a wildcard with the value *-SP*. This is because the SharePoint-specific cmdlets have the SP prefix in the verb portion of the cmdlet.
There are more than 500 SharePoint-specific cmdlets so don't get overwhelmed. For configuring alternate access mappings, we will be using the following SharePoint-specific cmdlets
Get-SPAlternateURL
New-SPAlternateURL
The Get-SPAlternateURL cmdlet is used to retrieve all alternate URLs for a specific SharePoint web application. To know more about this specific cmdlet and it's usage, you can also use the Get-Help cmdlet.
Get-Help Get-SPAlternateURL -examples
From the previous tip, let's retrieve the list of all alternate URLs for the default SharePoint site that I have created - http://sharepoint1
Get-SPAlternateURL -WebApplication http://sharepoint1[/code]
Note that the SharePoint website does not have any other alternate URLs by default. To create an alternate access mapping for this SharePoint site so that internal users can use the corporateportal.testdomain.com URL to access the site, we will use the New-SPAlternateURL cmdlet. This cmdlet creates a new public or internal URL for the specified web application zone or resource. Again, to know more about this cmdlet and it's usage, we'll use the Get-Help cmdletGet-Help New-SPAlternateURL -examples
Let's use the format in the example to create the alternate access mapping. When prompted for a WebApplication parameter value, enter the URL for the web application that you want to apply an alternate URL for. In this example, I passed the parameter value http://sharepoint1New-SPAlternateURL http://corporateportal.testdomain.com -Zone "Intranet"
To review if your changes have taken effect, you can re-run the Get-SPAlternateURL cmdlet. Notice that you now have a new alternate URL to access the http://sharepoint siteGet-SPAlternateURL -WebApplication http://sharepoint1[/code]
You can confirm this by checking the Alternate Access Mappings page in SharePoint Central Administration.
其他参考资料:
Refer to the Windows PowerShell for SharePoint Server 2010 on TechNet to learn more about the SharePoint-specific cmdlets
相关文章推荐
- Configuring Alternate Access Mapping in SharePoint 2010
- Error message when you try to modify or to delete an alternate access mapping in Windows SharePoint Services 3.0: "An update conflict has occurred, and you must re-try this action"
- Force stop and then start a full crawl on all content sources in a SharePoint 2010 farm using PowerShell(转)
- Configuring Anonymous Access in SharePoint 2010
- Managing SharePoint 2010 Farm Solutions with Windows PowerShell
- What every SharePoint administrator needs to know about Alternate Access Mappings (Part 2 of 3)
- Configuring Auditing in SharePoint 2010
- What every SharePoint administrator needs to know about Alternate Access Mappings (Part 3 of 3)
- Limited access In Sharepoint 2010
- Configuring My Site in SharePoint 2010
- Adding Custom Actions to the List Item Menu in SharePoint 2010 Using SharePoint Designer 2010[Sharepoint中添加自定义菜单]
- What every SharePoint administrator needs to know about Alternate Access Mappings (Part 1 of 3)
- [Override]Using Developer Dashboard in SharePoint 2010
- Using taxonomyfields in SharePoint 2010 By bhoeijmakers
- Disabling Mobile Web Page Access in SharePoint Server 2010 and SharePoint Foundation 2010
- Adding and Deploying Solutions with PowerShell in SharePoint 2010
- Using Linq in Sharepoint 2010
- Deploy custom Css,Js files in SharePoint 2010 using visual studio 2010
- SharePoint 2010 最佳实践学习总结------第2章 SharePoint Windows PowerShell指南
- Using resource files in SharePoint 2010