PowerShell Brian Caauwe – Senior Consultant April 14, 2012 The Administrator’s Best Friend.

Slides:



Advertisements
Similar presentations
Developing for SharePoint with Visual Studio Jason Keicher
Advertisements

Painless PowerShell for SharePoint Admins Rick Taylor.
Randy Williams, MOSS MVP Senior Consultant Synergy Corporate Technologies.
Gary Lapointe SharePoint MVP.  SharePoint MVP  Blog: 
Non-displaying slide…. SharePoint 2010 and 2013 Auditing and Site Content Administration using PowerShell 55095AC.
James Boother Blog: INTRODUCTION TO POWERSHELL.
Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog:
Great people, great experience, great passion Administering SharePoint with Windows PowerShell Go Beyond the Management Shell with SharePoint and Windows.
Fabian Schenker Consultant Microsoft Schweiz ShowerPoint - PowerShell und SharePoint für die Installation und Management von SharePoint 2010 Farmen Thomas.
SharePoint 2010 Administration using PowerShell Brian Caauwe Senior Consultant – SharePoint – MCTS March 20, 2010.
Welcome to the Minnesota SharePoint User Group November 11 th, 2009 Prepare for SharePoint 2010 Wes Preston, Brian Caauwe Meeting.
Welcome to the Minnesota SharePoint User Group November 11 th, 2009 SharePoint 2010 Administration Wes Preston, Brian Caauwe.
JourneyTEAM - – Tales From The Field: 2010 to 2013 Upgrade Horror Stories and How to Avoid Creating a Horror of Your Own.
10 PowerShell Commands Every Admin Should Know David Price.
Becky Bertram SharePoint MVP
Welcome to the Minnesota SharePoint User Group June 10 th, 2009 Search: From WSS to FAST Brian Caauwe, Wes Preston Bob Koviak,
SSRS Integration with SharePoint JACOB CHANG. Jacob Chang MCSE Degree in biology and computer engineering Started as an application developer Worked with.
Sharepoint Portal Server Basics. Introduction Sharepoint server belongs to Microsoft family of servers Integrated suite of server capabilities Hosted.
Welcome to the Minnesota SharePoint User Group. Introductions / Overview Project Tracking / Management / Collaboration via SharePoint Multiple Audiences.
Introduction to SharePoint Development with VS2010 Paul Yuknewicz Lead Program Manager
JourneyTEAM - – Tales From The Field: 2010 to 2013 Upgrade Horror Stories and How to Avoid Creating a Horror of Your Own.
SharePoint and SSRS Brian Caauwe – Senior SharePoint Consultant Megan Caauwe – BI Associate Consultant April 14, 2012 Better Together.
Meeting #122http://sharepointmn.com Welcome to the Minnesota SharePoint User Group February 11 th, 2015 Administering Your SharePoint Environment Brian.
Module 8 Configuring and Securing SharePoint Services and Service Applications.
©2012 Microsoft Corporation. All rights reserved..
Minneapolis Office Developer Interest Group (MODIG) July 22, 2008 Developing against SharePoint Remotely (No Object Model Allowed!) Raymond Mitchell Inetium.
TechEd /22/2017 5:40 AM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
Microsoft ® Official Course Module XA Using Windows PowerShell ®
SharePoint 2010 Development Environment A Guide to Setup SharePoint 2010 Development Environment on Windows 7 Machine.
Module 7: Fundamentals of Administering Windows Server 2008.
Welcome to the Minnesota SharePoint User Group October 8 th, 2008 SharePoint 2007 Administration Brian Caauwe Meeting # 48.
Basic Developer Knowledge That Every SharePoint Admin Must Have Randy Williams, MVP MOSS Synergy Corporate Technologies
Copyright © 2006 Pilothouse Consulting Inc. All rights reserved. Workflow Development Overview Architecture Requirements Types of workflows Stages of workflow.
Microsoft SharePoint Server 2010 for the Microsoft ASP.NET Developer Yaroslav Pentsarskyy
Module 3 Administering and Automating SharePoint.
Section 6: Using Windows PowerShell to Manage Group Policy Introducing Windows PowerShell Windows PowerShell Library for Group Policy Windows PowerShell-Based.
HOW SHAREPOINT WORKS By Gary Newman. Root Folder Virtual Directories SP Farm DNS Iterative Forward DNS query for A host record HTTP request HTML & JS.
What’s new in Kentico CMS 5.0 Michal Neuwirth Product Manager Kentico Software.
Intro To PowerShell Jack Fruh Sharepointjack.com.
Module 7 : Configuration I Jong S. Bok
Copyright © 2006 Pilothouse Consulting Inc. All rights reserved. SharePoint API and Development in ASP.NET Creating “Hello World” application Working with.
Online Conference June 17 th and 18 th SharePoint Online Administration with PowerShell.
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview VITALE, CATURANO & COMPANY LTD SharePoint Developer Series – Web Part.
What’s New in SharePoint 2010 SharePoint 2010 Development Primer New Developer Tools for SharePoint 2010 SharePoint 2010 Integration with PowerShell.
 An alias is an alternative name assigned to a Cmdlet.  Aliases allow users to quickly interact with the shell.  The Cmdlet get-alias is.
Todd Klindt and Shane Young SharePoint911. Who is this Todd guy?
PS SharePoSH:\> SPSite & SPWebs SharePoint + PowerShell User Group November 21, 2012.
Learningcomputer.com SQL Server 2008 – Management Studio.
 It is Microsoft's new task-based command- line shell and scripting language designed especially for system administration.  It helps Information Technology.
Automating SharePoint 2010 administration tasks with Power Shell Toni Frankola SharePoint MVP, Croatia
Application Hosting and Customization Introducing Sandboxed Solutions Executing Code in the Sandbox Sandbox Resource Monitoring.
Module 14: Advanced Topics and Troubleshooting. Microsoft ® Windows ® Small Business Server (SBS) 2008 Management Console (Advanced Mode) Managing Windows.
Programming the Microsoft SharePoint Products and Technologies Object Model Paul Appleby Developer & Platform Group
Ravikanth C.
Powering up your Office 365 cmdlets with CSOM Bjoern H Rapp, Senior Architect Public Cloud, SopraSteria.
SharePoint Online and PowerShell?
The Ultimate SharePoint Admin Tool
Start-SPPowerShell – Introduction to PowerShell for SharePoint Admins and Developers Paul BAker.
PowerShell 101 sharepoint on-premise
How to be a SharePoint Developer
The Administrator’s Best Friend
Building Dynamic Applications with the SharePoint Client Object Model
What is SharePoint and why you should care
Migration to SharePoint 2013
SharePoint Saturday Omaha April 2016
Building your SharePoint Farm with PowerShell
敦群數位科技有限公司(vanGene Digital Inc.) 游家德(Jade Yu.)
PowerShell + SharePoint Online – An Admins Guide to Administration in the O365 Cloud Marrell Sanders – Sr. SharePoint Administrator NACS Branson, MO.
Tech Ed North America /27/ :04 AM Required Slide
PowerShell + SharePoint Online – An Admins Guide to Administration in the O365 Cloud Marrell Sanders – Sr. SharePoint Administrator SharePoint Saturday.
Presentation transcript:

PowerShell Brian Caauwe – Senior Consultant April 14, 2012 The Administrator’s Best Friend

Session Agenda What you need to know Top 10 Cmdlets Top 10 Scripts

Brian Caauwe – SharePoint Consultant & Speaker Blog: – Certifications MCITP: SP Administrator 2010 MCPD: SP Developer 2010 Who am I?

Minnesota SharePoint User Group 2nd Wednesday of the Month 9:00 – 11:30 AM SharePoint resources and links Meeting Schedule Past User Group Presentations This Presentation Next Meeting – 5/9 TBD

Quick Poll SharePoint Version – 2007 – WSS, MOSS – 2010 – SPF, Server, FAST Work Roles – SharePoint Administrator – SharePoint Developer – Business User – Other

What you need to know

You won’t learn by books or sessions Find YOUR practical applications

What you need to know Run “As Administrator” Uses powershell.exe under Windows\system32 Registers Microsoft.SharePoint.PowerShell snap-in via script – C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\ Registration\sharepoint.ps1 Sets Execution Policy to RemoteSigned Management Shell

What you need to know Microsoft.SharePoint namespace Server Architecture – SPFarm – SPWebApplication – SPContentDatabase Site Architecture – SPSite – SPWeb – SPList – SPListItem MSDN Resource – Object Model

What you need to know Call PowerShell from Windows\system32 Register Microsoft.SharePoint.Powershell snap-in -psconsolefile “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL \Registration\psconsole.psc1” Call Script -command “E:\PowerShell\Set-ScriptName.ps1” Logging Scheduled Tasks

What you need to know Disposable Objects $web.Dispose() $site.Dispose() SPAssignment – Garbage Collector – Global Start-SPAssignment –Global Get-SPSite -Limit All | Get-SPWeb | Select Url, WebTemplate, WebTemplateId | Format-Table -AutoSize Stop-SPAssignment -Global – Scoped $w = Get-SPWebApplication $siteScope = Start-SPAssignment foreach ($site in ($siteScope | Get-SPSite -Limit All –WebApplication $)) { $webScope = Start-SPAssignment foreach ($web in ($webScope | Get-SPWeb -Limit All -Site $site)) { ## Do Something } Stop-SPAssignment $webScope } Stop-SPAssignment $siteScope Memory Leakage

What you need to know Crazy setup Run Commands on SharePoint servers – Enable-PSRemoting –force – Enable-WSManCredSSP –role Server –force – Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 1024 Run Commands on local machine – Enable-PSRemoting -force – Enable-WSManCredSSP –role Client –DelegateComputer “*.domain.com or COMPUTERNAME” –force Shared SPModule (\\servername\spmodule) – Zach Rosenfields’s Blog Store Credentials in a variable – $cred = Get-Credential Load Modules – $env:PSModulePath = \\servername\spmodule; + $env:PSModulePath\\servername\spmodule; – Import-Module SPModule.misc – Import-Module SPModule.setup Remote Scripting

What you need to know Other Assemblies – IIS (WebAdministration) – SQL – Exchange User Profile – Microsoft.Office.Server.UserProfiles Managed Metadata – Microsoft.SharePoint.Taxonomy What you don’t get

Top 10 Cmdlets

Tools for the toolbox Some SharePoint, Some NOT – SharePoint requires 2010

Top 10 Cmdlets How to Use – Built in help EVERYWHERE – Start with what you know to find what you don’t Examples – Get-Command *-SPFeature* – Get-Help Backup-SPSite -Examples Get-Command | Get-Help

Top 10 Cmdlets How to use – Main Cmdlets you will use – Limit parameter – SPSite and SPWeb are disposable Example – $w = Get-SPWebApplication – $site = Get-SPSite – $site | Get-SPWeb -Limit All Get-SPWebApplication | Get-SPSite | Get-SPWeb

Top 10 Cmdlets How to use – Maintain services on server – Get current server with environment variable – Start-SPServiceInstance may need other configuration Example – $server = Get-SPServer $env:COMPUTERNAME – $svc = Get-SPServiceInstance -Server $server | ?{$_.TypeName -eq “Excel Calculation Services”} – if ($svc.Status –eq “Disabled”){ Start- SPServiceInstance } Get-SPServer | Get-SPServiceInstance

Top 10 Cmdlets How to use – Maintain properties of service applications – Pipe to query on TypeName Example – $svcApp = Get-SPServiceApplication | ?{$_.TypeName - eq “User Profile Service Application”} – $svcApp.NetBIOSDomainNamesEnabled = $true – $svcApp.Update() Get-SPServiceApplication

Top 10 Cmdlets How to use – Great for troubleshooting – Creates new log file on that server Example – New-SPLogFile New-SPLogFile

Top 10 Cmdlets How to use – Merges last hour of logs across farm – Can consume CorrelationId and other filters Example – Merge-SPLogFile –Path “C:\Debug\error.log” – Correlation 470a4ec2-985d-43be-a14e-176eb1c39672 Merge-SPLogFile

Top 10 Cmdlets How to use – Gets ALL log events (no time filter) – Single server – Pipe to query and use -StartTime parameter Example – $guid = “470a4ec2-985d-43be-a14e-176eb1c39672” – Get-SPLogEvent –StartTime (Get-Date).AddHours(-1) | ?{$_.Correlation –eq $guid} | Format-List Timestamp, Category, Message | Out-File “c:\Debug\debug.log” Get-SPLogEvent

Top 10 Cmdlets How to use – Add farm solution to solution store – Automated deployments Example – Add-SPSolution –LiteralPath “C:\Solutions\spcmis.wsp” – $sol = Get-SPSolution | ?{$_.Name –eq “spcmis.wsp”} – $sol | Install-SPSolution –GACDeployment - AllWebApplications Add-SPSolution | Get-SPSolution | Install-SPSolution

Top 10 Cmdlets How to use – Write to the file – Nice for logging on scheduled tasks – Use -Append parameter Example – $msg = “This is what I want to send to the file” – $path = “logging.log” – $currentTime = Get-Date –UFormat “%H:%M:%S” – $msg = $currentTime + “ :: DEB :: “ + $msg – $msg | Out-File $path -append Out-File

Top 10 Cmdlets How to use – Write-Host used to display status to the screen Use ForegroundColor for color coding – Read-Host used to get user input Example – $url = Read-Host “What is the web application URL” – $w = Get-SPWebApplication $url – Write-Host -ForegroundColor Green $w.Url Write-Host | Read-Host

Top 10 Scripts

My favorites to find information in a crazy world

Top 10 Scripts What it uses – Merge-SPLogFile – Get-SPLogEvent When to use it – When you get a correlation ID How to use it – Choose to query farm or current server Get-ErrorLog.ps1

Top 10 Scripts What it uses – Start-SPAssignment / Stop-SPAssignment – Get-SPWebApplication / Get-SPSite When to use it – Get storage size and quota How to use it – Run as scheduled task or on demand Get-SiteStorageInfo.ps1

Top 10 Scripts What it uses – Start-SPAssignment / Stop-SPAssignment – Get-SPWebApplication / Get-SPSite / Get-SPWeb When to use it – Get web properties (Url, Template, Author, Last Modified) How to use it – Run as scheduled task or on demand Get-WebInfo.ps1

Top 10 Scripts What it uses – Start-SPAssignment / Stop-SPAssignment – Get-SPWebApplication / Get-SPSite / Get-SPWeb – SPList / SPContentType / SPWorkflowAssociation When to use it – Get workflow properties (SPD, Author, Running Instances) How to use it – Run as scheduled task or on demand Get-WorkflowInfo.ps1

Top 10 Scripts What it uses – Start-SPAssignment / Stop-SPAssignment – Get-SPWebApplication / Get-SPSite / Get-SPWeb – SPList When to use it – Get version properties (Item Count, Versioning, Limits) How to use it – Run as scheduled task or on demand Get-VersionInfo.ps1

Top 10 Scripts What it uses – System.Net.CredentialCache / WebClient – Get-SPWebApplication / Get-SPSite – Get-Content When to use it – Keep system connections “hot” How to use it – Run as scheduled task or on demand Reference – Kirk Hofer – Martin Laukkanen Warmup-Farm.ps1

Top 10 Scripts What it uses – Microsoft.Office.Server.UserProfiles – Start-Transcript – Update-SPProfilePhotoStore When to use it – Centrally managed photos to push into SharePoint How to use it – Run as scheduled task or on demand Set-UserProfileImages.ps1

Top 10 Scripts What it uses – Get-SPWeb / SPSite – SPAlert When to use it – Fix up alerts after changing web application url or site collection url How to use it – Invoke-AlertFixup -site “ - oldurl “ Reference – TechNet Invoke-AlertFixup.ps1

Top 10 Scripts What it uses – Get-Item – New-ItemProperty When to use it – Need to check for registry value and create if needed How to use it – Use as part of build scripts other server admin Check-Loopback.ps1

Top 10 Scripts What it uses – Microsoft.Web.Administration When to use it – Used to recover application pool credentials How to use it – Run on demand, requires application pool name Reference – Raymond Mitchell (IWKid) Get-AccountCreds.ps1

DEMO

References Brian’s Blog – Windows PowerShell for SharePoint 2010 – Script References – Invoke-AlertFixup – Raymond Mitchell’s Blog – Kirk Hofer’s Blog – Martin Laukkanen script-2/ script-2/

Q & A