31,19 €
PowerShell is tightly integrated with SharePoint 2010, demonstrating an important alliance between the fastest growing collaboration and web publishing platform, and the latest task automation framework. The advantages of PowerShell and SharePoint integration help administrators and infrastructure specialists achieve everyday enterprise tasks more efficiently, and this book will ensure you get the most out of SharePoint configuration and management. When it comes to custom SharePoint 2010 solution configuration, creating robust PowerShell scripts is the best option for saving time and providing a point of reference as to the changes made in the server environment. This practical expert cookbook translates the most commonly found scenarios into a series of immediately usable recipes, allowing you to get up and running straight away with writing powerful PowerShell scripts for SharePoint. “Microsoft SharePoint 2010 and Windows PowerShell 2.0: Expert Cookbook” focuses on a range of distinct areas of SharePoint administration, with expert recipes targeting unique business examples.You will learn exactly how solutions were achieved for managing SharePoint list settings with PowerShell, PowerShell configuration of SharePoint FAST Search, and more. You will also learn how to tailor the recipe to your own business needs.With this advanced cookbook in hand, you will be fully equipped with the source code as a starting point for creating your scripts in order to take advantage of the integration between SharePoint and PowerShell.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 289
Veröffentlichungsjahr: 2011
Copyright © 2011 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: November 2011
Production Reference: 1071111
Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK.
ISBN 978-1-84968-410-1
www.packtpub.com
Cover Image by John Green (<[email protected]>)
Author
Yaroslav Pentsarskyy
Reviewers
Muhammad A. Piracha
Ravikanth C
Acquisition Editor
Stephanie Moss
Development Editor
Maitreya Bhakal
Technical Editor
Manasi Poonthottam
Project Coordinator
Kushal Bhardwaj
Proofreader
Joel T. Johnson
Indexer
Monica Ajmera Mehta
Production Coordinator
Melwyn D'sa
Cover Work
Melwyn D'sa
Yaroslav Pentsarskyy has been involved in SharePoint solution architecture and implementation since 2003. He has been a Microsoft MVP since 2009 and keeps in close contact with the SharePoint product team. Yaroslav frequently presents at technical events worldwide as well as online. You can always find a fresh bit of SharePoint information on his blog: http://www.sharemuch.com. To learn everything Yaroslav knows about SharePoint, check out his two new books Top 60 Custom Solutions built on SharePoint 2010 and SharePoint 2010 branding in practice.
Muhammad A. Piracha is a senior Software Engineer at Bamboo Solutions Corporation, which is based in Reston, Virginia. Bamboo Solutions is a leading provider of software solutions for the Microsoft SharePoint platform. Muhammad has over 15 years of experience in building document management software applications using various Microsoft products. He has experience in a variety of capacities, including architecting, designing, and developing software for SharePoint technologies since its release in 2003. When he is not on a computer writing code, he enjoys spending time with his family and outdoor activities.
Ravikanth C has more than 10 years of experience in the IT industry. In the beginning of his career, he worked at Wipro Infotech managing Windows, Solaris servers, and Cisco network equipment. He currently works at Dell Inc. as a lead engineer in the SharePoint solutions group. As a part of his work, he has authored several whitepapers on MOSS 2007 and SharePoint 2010 that provide guidance around infrastructure elements of a SharePoint deployment. His work also involves performance testing and sizing of SharePoint workloads on Dell servers and storage. Ravikanth is passionate about automation and outside of work he writes regularly on his blog, http://www.ravichaganti.com/blog, about topics related to Windows PowerShell, Microsoft SharePoint, and Windows Server virtualization.
In 2010, Ravikanth received Microsoft's Most Valuable Professional (MVP) award in Windows PowerShell. You can also hear him speak regularly at BITPro (http://bitpro.in) user group meetings and other in-person events at Bangalore, India.
You might want to visit www.PacktPub.com for support files and downloads related to your book.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at<[email protected]> for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
http://PacktLib.PacktPub.com
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books.
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.
Get notified! Find out when new books are published by following @PacktEnterprise on Twitter, or the Packt Enterprise Facebook page.
PowerShell is tightly integrated with SharePoint 2010, demonstrating an important alliance between the fastest growing collaboration and web publishing platform, and the latest task automation framework. The advantages of PowerShell and SharePoint integration help administrators and infrastructure specialists achieve everyday enterprise tasks more efficiently, and this book will ensure you get the most out of SharePoint configuration and management.
When it comes to custom SharePoint 2010 solution configuration, creating robust PowerShell scripts is the best option for saving time and providing a point of reference to when changes are made in the server environment. This practical expert cookbook translates the most commonly found scenarios into a series of immediately usable recipes, allowing you to get up and running straight away with writing powerful PowerShell scripts for SharePoint.
Microsoft SharePoint 2010 and Windows PowerShell 2.0: Expert Cookbook focuses on a range of distinct areas of SharePoint administration, with expert recipes targeting unique business examples.
You will learn exactly how solutions were achieved for managing SharePoint list settings with PowerShell, PowerShell configuration of SharePoint FAST Search, and more. You will also learn how to tailor the recipe to your own business needs.
With this advanced cookbook in hand, you will be fully equipped with the source code as a starting point for creating your scripts in order to take advantage of the integration between SharePoint and PowerShell.
Chapter 1, PowerShell Scripting Methods and Creating Custom Commands: Go further with PowerShell to create your own PowerShell commands (CmdLets) and snap-ins and share them with your team.
Chapter 2, Enterprise Content Deployment and Provisioning using PowerShell: Automate your SharePoint 2010 custom solution deployment by using a robust PowerShell script.
Chapter 3, Performing Advanced List and Content Operations in SharePoint using PowerShell: Master the management of SharePoint lists and list settings with PowerShell.
Chapter 4, Managing External Data in SharePoint and Business Connectivity Services using PowerShell: Get to the bottom of administering Business Connectivity Services (BCS) in SharePoint.
Chapter 5, Managing SharePoint 2010 Metadata and Social Features using PowerShell: Learn all about performing the most common configurations around SharePoint taxonomy features and user profile services.
Chapter 6, Managing SharePoint Search and FAST Search with PowerShell: Configure SharePoint FAST Search using PowerShell including audience targeting and improving search results.
Chapter 7, Managing SharePoint Site Content in Bulk using PowerShell: Configure content on SharePoint pages including bulk provisioning and configuration publishing pages, content types and web parts.
Chapter 8, Managing Documents and Records in SharePoint with PowerShell: Get the most out of document and records management in SharePoint 2010 by automating configuration.
Chapter 9, Administrating Web Application and Server Administration in SharePoint with PowerShell: Simplify SharePoint server management by using PowerShell for tasks like web application settings, configuration and monitoring, sandbox features, and more.
To complete the tasks in this book, you will need a system with SharePoint 2010 Server Standard installed. Some areas of the book will require FAST Search to be installed and configured. We recommend downloading and installing 2010 Information Worker Demonstration and Evaluation Virtual Machine (RTM) Virtual Machine environment if you do not have a compatible system set up. The most current link to download the virtual environment can be retrieved by searching for the 2010 Information Worker Demonstration and Evaluation Virtual Machine (RTM). By downloading the preceding environment, you will ensure all of the configurations and setups have been performed and your system is ready for using PowerShell with SharePoint.
If you are a SharePoint administrator or IT Pro who wants to extend your knowledge of PowerShell automation, this book is a must have. You should have a solid grasp of working with SharePoint and PowerShell.
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>, and mention the book title via the subject of your message.
If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail <[email protected]>.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]> with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
You can contact us at <[email protected]> if you are having a problem with any aspect of the book, and we will do our best to address it.
In this chapter, we will cover:
PowerShell as a scripting language will execute actions on your target environment. Scripting is not a new concept and PowerShell is definitely not a new language. However, PowerShell and SharePoint 2010 integrate very well. This integration allows administrators and developers to access not just a limited set of commands, but also to connect to SharePoint objects and libraries to take advantage of additional capabilities of SharePoint as a platform. To ensure that we are on the same page while reading this book and trying out various recipes, we'll start by setting up your environment and verifying the setup by running a test script. After all, SharePoint relies on components, most of which we're going to be directly interacting with, and having a consistently configured environment will help in reducing any potential integration issues.
Although we can author our PowerShell scripts in Notepad and execute them in a PowerShell command-line environment, you can experience more advantages from authoring and debugging your scripts by using rich authoring environments, such as PowerGUI or PowerShell ISE. In this chapter, we'll see exactly what the benefits of using those environments are.
Whether you are creating a PowerShell script in a professional scripting environment or calling an existing script from a command line, you'll quickly notice that a default set of commands is definitely not enough to manage and work with your SharePoint system. When you have the need to author scripts accessing various other aspects of SharePoint functionality, you will need to use the additional libraries available to facilitate custom or out-of-the-box functionality required. This is a very common scenario for developers when building custom solutions for a variety of platforms. PowerShell, as a scripting language, really takes advantage of this concept allowing you to call functions from SharePoint and third-party libraries. In this chapter, we'll take a look at exactly how you can access advanced SharePoint 2010 functionality using external libraries.
As you become more familiar with authoring PowerShell scripts, you will realize that you can create a collection of reusable functionality which can be shared with others. That's when you can take advantage of sealing your custom functionality in a portable and sharable way. We'll take a look at how you can package your custom scripts as custom PowerShell CmdLets, as well as how to create a custom PowerShell Snap-In.
In this recipe, we'll ensure your development environment is configured properly.
To complete the recipes in this book, it's assumed you're running a system with SharePoint 2010 Server Standard installed. If not, it is recommended you download and install the 2010 Information Worker Demonstration and Evaluation Virtual Machine (RTM) Virtual Machine environment, if you do not have a compatible system set up. For the most current link to download this virtual environment, search Microsoft Download Center with the keyword 2010 IW demo RTM.
By downloading the preceding environment, you will ensure all of the configurations and setups have been performed and your system is ready for using PowerShell with SharePoint. Whether you're using your own or a downloaded Virtual Machine, let's ensure PowerShell is enabled in your environment.
Let's see how you can get your virtual environment configured and run your first script using the following steps:
Ensure this policy is reverted back on your production environments to avoid the risk of malicious script execution.
On Windows 2008 Server, PowerShell script execution policy is set to restrict script execution by default. As an administrator, you can choose to allow script execution by calling the Set-ExecutionPolicy Unrestricted command.
For more information on options available for script execution policy and how it affects your environment, search TechNet with the keyword Set-ExecutionPolicy.
Once script execution is not restricted, we run a PowerShell command enumerating all of the SharePoint sites with the http://intranet.contoso.com URL. This assumes you have an existing site collection with such a URL. If you're using the downloadable environment from above, the site collection will be already set up for you. If you're running a site collection with a different URL, feel free to replace the value in this example.
In this example, we assumed you were running a Virtual Machine downloaded from the Microsoft download site with all of the pre-set options. In this case, you may see that the execution policy has already been set to unrestricted. In this case, you don't need to set the value again.
