Microsoft SharePoint 2010 and Windows PowerShell 2.0: Expert Cookbook - Yaroslav Pentsarskyy - E-Book

Microsoft SharePoint 2010 and Windows PowerShell 2.0: Expert Cookbook E-Book

Yaroslav Pentsarskyy

0,0
31,19 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

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:

EPUB
MOBI

Seitenzahl: 289

Veröffentlichungsjahr: 2011

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Microsoft SharePoint 2010 and Windows PowerShell 2.0: Expert Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why Subscribe?
Free Access for Packt account holders
Instant Updates on New Packt Books
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Errata
Piracy
Questions
1. PowerShell Scripting Methods and Creating Custom Commands
Introduction
Setting up your Virtual Machine and running a test script
Getting ready
How to do it...
How it works...
There's more..
Authoring, debugging, and executing script accessing farm settings with PowerGUI and PowerShell ISE
Getting ready
How to do it...
How it works...
There's more
Script authoring with PowerGUI
Accessing advanced SharePoint 2010 functionality with external libraries
Getting ready
How to do it...
How it works...
There's more
Accessing other SharePoint libraries and related functions
Creating a custom PowerShell command (CmdLet)
Getting ready
How to do it...
How it works...
See also
Creating a custom PowerShell Snap-In
Getting ready
How to do it...
How it works...
There's more
Uninstalling a Snap-In from your system
Visual Studio CmdLet and Snap-In item templates
2. Enterprise Content Deployment and Provisioning Using PowerShell
Introduction
Provisioning site hierarchy during solution deployment
Getting ready
How to do it...
How it works...
See also
Installing features on the site and managing existing site features
Getting ready
How to do it...
How it works...
Creating permission levels and security groups that use them
Getting ready
How to do it...
How it works...
Managing site templates and their availability on sites
Getting ready
How to do it...
How it works...
Associating features to existing site templates
Getting ready
How to do it...
How it works...
There's more
Managing SharePoint workflow association using PowerShell
Getting ready
How to do it...
How it works...
There's more
Configuring site themes and user interface artifacts
Getting ready
How to do it...
How it works...
There's More
Assigning a new masterpage to the SharePoint site
See also
3. Performing Advanced List and Content Operations in SharePoint using PowerShell
Introduction
Creating lists of custom structures
Getting ready
How to do it...
How it works...
See also
Setting SharePoint list item validation with PowerShell
Getting ready
How to do it...
How it works...
There's more...
Setting list item security
Getting ready
How to do it...
How it works...
There's more
Setting list relationships
Getting ready
How to do it...
How it works...
There's more...
Customizing list views
Getting ready
How to do it...
How it works...
Managing the use of content types in lists
Getting ready
How to do it...
How it works...
4. Managing External Data in SharePoint and Business Connectivity Services using PowerShell
Introduction
Importing a custom BCS model to SharePoint
Getting ready
How to do it...
How it works...
See also
Exporting SharePoint BCS model and schema
Getting ready
How to do it...
How it works...
Creating instances of external lists with PowerShell
Getting ready
How to do it...
How it works...
There's more
Managing permissions on an external list
Getting ready
How to do it...
How it works...
Throttling items returned with external lists
Getting ready
How to do it...
How it works...
5. Managing SharePoint 2010 Metadata and Social Features Using PowerShell
Introduction
Creating new user profiles
Getting ready
How to do it...
How it works...
Adding and configuring new profile properties
Getting ready
How to do it...
How it works...
See also
Bulk provisioning data into user profile properties
Getting ready
How to do it...
How it works...
See also
Creating, importing, and exporting managed metadata taxonomy terms
Getting ready
How to do it...
How it works...
Enabling social ratings on lists and libraries
Getting ready
How to do it...
How it works...
Bulk tagging content and deleting tags in SharePoint
Getting ready
How to do it...
How it works...
See also
6. Managing SharePoint Search and FAST Search with PowerShell
Introduction
Configuring search query suggestions in your search center
Getting ready
How to do it...
How it works...
Configuring search best bets
Getting ready
How to do it...
How it works...
Configuring visual best bets
Getting ready
How to do it...
How it works...
See also
Configuring search audience targeting
Getting ready
How to do it...
How it works...
See also
Configuring search web parts automatically with PowerShell
Getting ready
How to do it...
How it works...
7. Managing SharePoint Site Content in Bulk using PowerShell
Introduction
Creating basic and complex content types
Getting ready
How to do it...
How it works...
See also
Creating and configuring document sets
Getting ready
How to do it...
How it works...
See also
Creating and editing publishing pages with PowerShell
Getting ready
How to do it...
How it works...
Provisioning web parts in bulk on to SharePoint pages
Getting ready
How to do it...
How it works...
See also
Configuring web parts in bulk with PowerShell
Getting ready
How to do it...
How it works...
See also
Provisioning list rollups using Powershell
Getting ready
How to do it...
How it works...
See also
8. Managing Documents and Records in SharePoint with PowerShell
Introduction
Provisioning documents and records center with PowerShell
Getting ready
How to do it...
How it works...
See also
Configuring record routing
Getting ready
How to do it...
How it works...
More info
See also
Configuring a common record expiration policy
Getting ready
How to do it...
How it works...
See also
Creating a custom expiration policy for the record
Getting ready
How to do it...
How it works...
See also
Configuring content hub for content types used in records center
Getting ready
How to do it...
How it works...
See also
9. Administrating Web Application and Server Administration in SharePoint with PowerShell
Introduction
Configuring web application settings
Getting ready
How to do it...
How it works...
See also
Parsing SharePoint logs using PowerShell
Getting ready
How to do it...
How it works...
Managing web application throttling settings
Getting ready
How to do it...
How it works...
See also
Configuring sandbox solution policies
Getting ready
How to do it...
How it works...
See also
Managing sandbox solutions in SharePoint site collections
Getting ready
How to do it...
How it works...
There's more
See also
Index

Microsoft SharePoint 2010 and Windows PowerShell 2.0: Expert Cookbook

Microsoft SharePoint 2010 and Windows PowerShell 2.0: Expert Cookbook

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]>)

Credits

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

About the Author

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.

About the Reviewers

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.

www.PacktPub.com

Support files, eBooks, discount offers, and more

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.

Why Subscribe?

Fully searchable across every book published by PacktCopy and paste, print and bookmark contentOn demand and accessible via web browser

Free Access for Packt account holders

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.

Instant Updates on New Packt Books

Get notified! Find out when new books are published by following @PacktEnterprise on Twitter, or the Packt Enterprise Facebook page.

Preface

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.

What this book covers

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.

What you need for this book

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.

Who this book is for

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.

Reader feedback

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.

Customer support

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.

Errata

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

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.

Questions

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.

Chapter 1. PowerShell Scripting Methods and Creating Custom Commands

In this chapter, we will cover:

Setting up your Virtual Machine and running a test scriptAuthoring, debugging, and executing script accessing farm settings with PowerGUI and PowerShell ISEAccessing advanced SharePoint 2010 functionality with external librariesCreating a custom PowerShell command (CmdLet)Creating a custom PowerShell Snap-In

Introduction

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.

Setting up your Virtual Machine and running a test script

In this recipe, we'll ensure your development environment is configured properly.

Getting ready

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.

How to do it...

Let's see how you can get your virtual environment configured and run your first script using the following steps:

On the target Virtual Machine, ensure you are logged in with an administrator's role.Click Start | All Programs | Microsoft SharePoint 2010 Products | SharePoint 2010 Management Shell.Input Get-ExecutionPolicy and press Enter on your keyboard. PowerShell may return a value of Restricted.Input Set-ExecutionPolicy Unrestricted and hit Enter.

Tip

Ensure this policy is reverted back on your production environments to avoid the risk of malicious script execution.

Input the following command in the window:
Get-SPSite | Where-Object {$_.Url -eq "http://intranet.contoso.com"}
You should see a result that looks similar to the following screenshot:

How it works...

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.

Note

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.

There's more..

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.