POWERSHELL (& SHAREPOINT) This ain t your momma s command line!



Similar documents
Microsoft. Jump Start. M3: Managing Windows Server 2012 by Using Windows PowerShell 3.0

WolfTech Active Directory: PowerShell

SUNGARD SUMMIT 2007 sungardsummit.com 1. Microsoft PowerShell. Presented by: Jeff Modzel. March 22, 2007 Course ID 453. A Community of Learning

Using Windows PowerShell to Manage SharePoint 2010

Microsoft Windows PowerShell v2 For Administrators

PowerShell for Exchange Admins

Windows PowerShell Fundamentals

Forefront Management Shell PowerShell Management of Forefront Server Products

Acknowledgments Finding Your Way Around Windows PowerShell p. 1 Getting Started with Windows PowerShell p. 3 Installing Windows PowerShell p.

ActiveRoles Management Shell for Active Directory

Automating Microsoft

Powershell Management for Defender

Hands-On Lab. Lab 01: Getting Started with SharePoint Lab version: Last updated: 2/23/2011

BACKGROUND AND CAPABILITIES

Lab Answer Key for Module 1: Installing and Configuring Windows Server Table of Contents Lab 1: Configuring Windows Server

PowerShell for Dummies

Jeffrey Snover Distinguished Engineer & Lead Architect Jason Helmick Senior Technologist, Concentrated Technology

Note: The scripts in this article should work for XenApp 6 and XenApp 5 for Windows Server 2008 and XenApp 5 for Windows Server 2003.

GeBro-BACKUP. Die Online-Datensicherung. MANUAL SHAREPOINT

5/13/2009. Dejan Foro Speaker

DottsConnected SHAREPOINT 2010 ADMIN TRAINING. Exercise 1: Create Dedicated Service Accounts in Active Directory

SPHOL205: Introduction to Backup & Restore in SharePoint Hands-On Lab. Lab Manual

Things I wish I d known when I started using PowerShell

HDEV16: SharePoint 2010 PowerShell for Developers. Gary Lapointe, MVP Falchion Consulting, LLC

Project Server 2010 Migration

Exploring PowerShell. Using Windows PowerShell

Automating. Administration. Microsoft SharePoint with Windows. PowerShell 2.0. Gary Lapointe Shannon Bray. Wiley Publishing, Inc.

Click Studios. Passwordstate. Password Discovery, Reset and Validation. Requirements

"Charting the Course to Your Success!" MOC B Configuring and Administering Microsoft SharePoint Course Summary

WHITE PAPER POWERSHELL FOR DUMMIES HOW TO KEEP TRACK OF

Windows Server 2008 R2: Server Management and PowerShell V2

DocAve 6 SDK and Management Shell

You Should Be Using PowerShell Aaron Kaiser Senior Technology Support Specialist Parkway School District

Using Management Shell Reports and Tracking User Access in the NetVanta UC Server

CloudPortal Services Manager Version 11.0 CU2 Deployment Guide

Nintex Workflow 2010 Installation Guide. Installation Guide Nintex USA LLC, All rights reserved. Errors and omissions excepted.

Windows PowerShell. 3.0 Step by Step. Ed Wilson

This module explains the Microsoft Dynamics NAV architecture and its core components.

SharePoint 2010

Avatier Identity Management Suite

Windows PowerShell Cookbook

Step by Step Guide for Migrate SharePoint s SQL Server to another SQL Server December 2013

Course: 10174B: Configuring and Administering Microsoft SharePoint 2010

DEPLOYMENT GUIDE DEPLOYING F5 AUTOMATED NETWORK PROVISIONING FOR VMWARE INFRASTRUCTURE

POWERSHELL FOR NEWBIES Getting started with PowerShell 4.0. Jeffery Hicks

Secure Messaging Server Console... 2

Configuring and Integrating PowerShell

ActiveRoles Management Shell for Active Directory

Course 10174B: Configuring and Administering Microsoft SharePoint 2010

Symantec Mobile Management 7.2 SP3 MR1 Release Notes

Lync Server Patching Guide

PROJECT in a box version 2.4 Server. Install guide

How to Scale out SharePoint Server 2007 from a single server farm to a 3 server farm with Microsoft Network Load Balancing on the Web servers.

Good Morning Wireless! SSID: MSFTOPEN No Username or Password Required

Specops Command. Installation Guide

Mod 2: User Management

SharePoint 2016 [PREVIEW] Site Template ID List

ITMC 2079 MCTS Configuring and Administering Microsoft SharePoint 2010

Metalogix Replicator. Quick Start Guide. Publication Date: May 14, 2015

Installation Manual v2.0.0

Configuring and Administering Microsoft SharePoint 2010

CATALOG OF CLASSES IT and Technical Courses

10174: Configuring and Managing Microsoft SharePoint 2010

126 SW 148 th Street Suite C-100, #105 Seattle, WA Tel: Fax:

Installing T-HUB on multiple computers

Getting Started w/azure & PowerShell. March 23, 2014

Wireshark Developer and User Conference

Introduction to PowerShell Integration

Print Manager Plus 2010 How to Migrate your Database to a New SQL or Print Server

NetIQ AppManager for Microsoft SharePoint Server. Management Guide

EMC SourceOne for Microsoft SharePoint Storage Management Version 7.1

PROJECTIONS SUITE. Database Setup Utility (and Prerequisites) Installation and General Instructions. v0.9 draft prepared by David Weinstein

How to deploy SurveilStar PC/Internet Monitoring Software

Buffalo Technology: Migrating your data to Windows Storage Server 2012 R2

Intel vpro Technology Module for Microsoft* Windows PowerShell*

LT Auditor Windows Assessment SP1 Installation & Configuration Guide

Microsoft Enterprise Search for IT Professionals Course 10802A; 3 Days, Instructor-led

Backing Up TestTrack Native Project Databases

The Trusted Technology Partner in Business Innovation PASSION DISCIPLINE INNOVATION TEAMING INTEGRITY

Dell One Identity Quick Connect for Cloud Services 3.6.1

Configuring and Administrating Microsoft SharePoint 2010 (10174) HK913S

Service Applications. Bye-Bye SSP Hello Service Applications. Presented By: Elijah Van Eenwyk

Michael Noel. Colin Spence. SharePoint UNLEASHED. 800 East 96th Street, Indianapolis, Indiana USA

Microsoft Interactief Centrum voor gerichte Training en Studie Edisonweg 14c, 1821 BN Alkmaar T:

Dell One Identity Cloud Access Manager How to Configure Microsoft Office 365

Administration Guide. . All right reserved. For more information about Specops Gpupdate and other Specops products, visit

Dell UPS Local Node Manager USER'S GUIDE EXTENSION FOR MICROSOFT VIRTUAL ARCHITECTURES Dellups.com

Table of Contents Radiant Systems, Inc. All rights reserved. iii

Transcription:

POWERSHELL (& SHAREPOINT) This ain t your momma s command line!

JAMYE FEW SENIOR CONSULTANT 12+ years as IT Professional ( IT PRO duck DEV ) A little IT PRO, little more DEV and a lot of ducking. Certifiable in SharePoint and.net development @S7JFew http://summit7systems.com/blogs/

Summit 7 systems is a premier provider of consulting and implementation services specializing on the Microsoft SharePoint Platform and FAST Enterprise Search.» Summit 7 Systems was chosen by KMWorld Magazine as one of the top 100 Companies that Matter in Knowledge Management along with companies such as Microsoft, Oracle and IBM.» Summit 7 Systems was named to the 2011 and 2012 CRN Next-Gen 250 List as a company bringing innovative processes, methodologies and models to the solution provider industry.» Top 1% of Microsoft Partners Worldwide» Summit 7 Systems was named #6 on the 2012 CRN Fast Growth 100 based on our 2009 2011 growth of over 930% per year.» ~ 50% of Technical Staff hold US Government SECRET Clearances.» Service Disabled Veteran Owned Small Business (SDVOSB).

SOFTWARE PLATFORMS FAST Enterprise Search SharePoint 2007 SharePoint 2010 SharePoint 2013 Office Platform Sitecore SOLUTION AREAS SharePoint Platform Solutions Enterprise Search Enterprise Content Management Internet / Web Content Management Extranet Solutions Intranet Solutions Business Process Management Enterprise Project Management Exchange Server SERVICES SharePoint QuickStart Information Architecture and Governance Development Upgrade and Migration Branding and Design (User Experience) Web Content Management Design and Deployment SharePoint Search Custom Workflow or Web Part Development InfoPath Forms and Workflows Performance Baselines and Best Practices Optimization Mapping Business Process to Software Platforms Cloud Services Design and Provisioning Remote Support Contracts Compliance Quickstart

FOR MORE FROM SUMMIT 7 SYSTEMS facebook.com/summit7systems @summit7systems summit 7 systems summit7systems summit7systems.com/blogs

POWERSHELL (& SHAREPOINT) This ain t your momma s command line!

POWERSHELL (& SHAREPOINT) Hey, look here, this ain t your momma s command line, Jack! (-Si Robertson)

AGENDA What is PowerShell? STSADM?...LOL What are the benefits of PowerShell? What commands will get me started? Variables and Operators A bunch of other stuff Questions

POWER (RANGER) (TURTLE) SHELL? NOT THIS

POWERSHELL THIS

OK, WHAT IS POWERSHELL EXACTLY? Microsoft's task automation framework Command Line Shell Scripting Language Built on and integrated with the.net Framework (Pretty much C# syntax with a few caveats) DOS on steroids

WHERE IS POWERSHELL? Built into Windows Server 2008 R2 and Windows 7 Older OS Windows Management Framework Start > Accessories > Windows PowerShell SharePoint 2010 Management Shell Shortcut to a profile that loads the SP2010 Provider Snapin

STSADM? Still there and still works backwards compatibility Allows for portability of existing STSADM batch files and scripts Don t use this as a crutch! You should do everything in PowerShell. PowerShell has full access to the SharePoint API from the command line STSADM to Windows PowerShell Mapping: http://technet.microsoft.com/en-us/library/ff621081.aspx

BENEFITS OF POWERSHELL Interact with.net objects directly Remoting interface Reduction in the need of some 3rd party solutions Perform administrative functions in bulk, reducing time and effort. Performance benefits for batch operations and scheduling Some SharePoint functions require the use of PowerShell: Adding Custom Solutions(2010+) Resetting the Farm Passphrase (2010+) Configuring the State Service Application (2010+) Configuring the Publishing Feature s Super User Accounts(2010+) Pretty much all Search configuration in 2013

POWERSHELL ISE Windows PowerShell Integrated Scripting Environment (ISE) Can run commands, write, test, and debug scripts Uses color-coding Only available with PS 2.0 and above Better Option (FREE): PowerGUI http://powergui.org

POWERSHELL ESSENTIALS Get-Help Set-ExecutionPolicy Get-Command (Alias=GCM) Get-Member (piped command, Alias=GM) $object GET-MEMBER (will display the object s Methods & Properties) Add-PSSnapIn [Aliases] are helpful

EXECUTION POLICY SETTINGS Restricted - No scripts can be run. Windows PowerShell can be used only in interactive mode. AllSigned - Only scripts signed by a trusted publisher can be run. RemoteSigned - Downloaded scripts must be signed by a trusted publisher before they can be run. Unrestricted - No restrictions; all Windows PowerShell scripts can be run. What I use in DEV: Set-ExecutionPolicy RemoteSigned

SEE THE PATTERN? PowerShell CmdLets are Verb / Noun pairs. Set-Something Get-Something Enable-Something Tons of built in Commands Spelled CMDLETS Pronounced Command-lets

ADD-PSSNAPIN PowerShell is a blank slate (to SharePoint and FAST) Use Add-PSSnapin to add functionality (SharePoint Admin Shell) Add-PSSnapin Microsoft.SharePoint.PowerShell Add-PSSnapin Microsoft.FASTSearch.PowerShell Exchange, Active Directory, SQL, etc.

DEMO

VARIABLES Begin with $ $integer = 100 $string = Hello World! $web = Get-SPWeb http://portal.com $WEB = $web = $Web (Not Case Sensitive!)

OPERATORS $integer = 100 $integer = 100+1 Write-Host $integer 101 $integer = $integer * 2 Write-Host Integer = $integer Integer = 202 Get-Help about_operators

SPECIAL VARIABLES Reserved values: $TRUE, $FALSE, $NULL $_ Current object in the Pipeline $Args Array of parameters passed to script $PsCmdLet Current CMDLET or function that is running $Pwd Current Working Directory (not Password) Get-Help about_automatic_variables for more info

COMPARISON OPERATORS Operator Name Example Result -eq Equal 3 -eq 3 True -ne Not Equal 3 -ne 3 False -lt Less Than 3 -lt 3 False -le Less Than or Equal To 3 -le 3 True -gt Greater Than 3 -gt 3 False -ge Greater Than or Equal To 3 -ge 3 True

COMPARISON OPERATORS (CONT.) Operator Example Result -like PowerShell -like *shell True -notlike Uses Wildcard -match 9 -match [0-9] True -notmatch Uses Regular Expression -contains abc, def -contains def True -notcontains Contains an element (Think array [not STRING.CONTAINS])

DEMO

LOOPING For For Each Do While Do Until

FOREACH-OBJECT Easy Enumeration in Command Line Something foreach-object { code } cls $web = Get-SPWeb http://portal.contoso.com $web.webs ForEach-Object {$_.Title}

FORMATTING Sort-Object Get-EventLog system -Newest 5 Sort-Object EventId Format-Table Format-List

SCRIPTS Allow complex command combinations Consistently repeat frequent and/or complex tasks Can be parameterized.ps1 files even though we are 2.0 $HOST.Version gets current PS version

COMMENTS We needed another comment format # for single lines #This is a comment This is not <# #> for multiple lines <# Multiple Line Comments#>

INPUT/OUTPUT Read-Host (waits for user input) $var = Read-Host Prompt Text Write-Host Writes this text to the console Write-Host $var nonewline Write-Host (3,9,27,81) separator, To write to file: >> <filename> Output-File <filename> Tee <filename>

DEMO

WHAT TO REMEMBER Set-Execution Policy Get-Help (Get-Help About) Get-Command (Alias GCM) Get-Member Add-PSSnapIn Aliases

ALWAYS HELPFUL Google MSDN TechNet PowerGUI

FOR MORE FROM SUMMIT 7 SYSTEMS facebook.com/summit7systems @summit7systems summit 7 systems summit7systems summit7systems.com/blogs

POWERSHELL (& SHAREPOINT) This ain t your momma s command line!