Berrydunn.com | GAIN CONTROL USING POWERSHELL TO IMPROVE SHAREPOINT MANAGEMENT SharePoint Saturday...
If you can't read please download the document
Berrydunn.com | GAIN CONTROL USING POWERSHELL TO IMPROVE SHAREPOINT MANAGEMENT SharePoint Saturday Boston June 13, 2015 Mitch Darrow, Senior Consultant
berrydunn.com | GAIN CONTROL USING POWERSHELL TO IMPROVE
SHAREPOINT MANAGEMENT SharePoint Saturday Boston June 13, 2015
Mitch Darrow, Senior Consultant
Slide 2
2 Public accounting and management/IT consulting firm Founded
in 1974, the firm now has over 250 personnel and 36 principals $50
million in annual revenue For the last four years, BerryDunn was
designated as an INSIDE Public Accounting (IPA) Top 100 Firm, and
was also named as a Fastest-Growing firm. Named Best CPA Firm for
Women by the American Society of Women Accountants and the American
Womans Society of Certified Public Accountants. BerryDunn Overview
Legend Office Locations Satellite Office Locations
Slide 3
3 INDEPENDENCE AND OBJECTIVITY We do not sell or develop
hardware or software. We do not partner with software developers or
solution providers. Independence allows our team to provide
objective IT consulting services and to offer recommendations that
represent only the clients best interests.
Slide 4
4 MITCH DARROW SENIOR CONSULTANT GOVERNMENT CONSULTING GROUP
Over 25 years of IT experience in global manufacturing companies.
Specializing in: Windows Architecture Security Best Practices
Databases SharePoint Exchange Programming ( C#, PowerShell)
Representative clients Colorado DHS Washington State Auditors
Office West Virginia Bureau of Medical Services
Slide 5
5 MITCH DARROW About me Husband and father of three Live in the
Portland, Maine area Avid Kayaker, hopefully soon to be a Maine
guide Bike commuter Volunteer IT Geek
Slide 6
6 GAP YEAR ADVOCATE All three of my kids have had an adventure
before starting University. Ask me about it after the presentation,
if you are interested!
Slide 7
7 WHAT ARE THE CHALLENGES? Important information is everywhere
Central Administration Site Collection Sites SQL Management Studio
How do we get the information into the hands of those who need it?
Helpdesk IT On Call Managers Business Users
Slide 8
POWERSHELL CAN HELP! Read information from almost anywhere in
SharePoint Read information from SQL Server Read data from Active
Directory Write all this data into a SharePoint Site Create Ops
dashboard Management dashboard All using the same toolkit! 8
Slide 9
SOME PREREQUISITES User context running the script needs
permissions: Add-SPShellAdmin Adds user to: SharePoint_Shell_Access
Role WSS_ADMIN_WPG group on the local computer Add-SPShellAdmin
-UserName CONTOSO\User1 -database
4251d855-3c15-4501-8dd1-98f960359fa6 Additional information:
https://technet.microsoft.com/en-us/library/ff607596.aspx 9
Slide 10
BEFORE WE BEGIN Please dont develop and/or test in Production!
If you dont understand what a script is doing, you probably
shouldnt be running it! PowerShell allows you to structure logic in
dramatically different ways. All are correct, but they are not all
equal. Dont assume that one structure is better than another. If
performance is important, measure it with measure-command{}. Error
handling (Try/Catch) is always a best practice. I acknowledge this
is absent from my sample code. 10
Slide 11
THE BASICS: Add the snap in to PowerShell Add-PSSnapIn
Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
Create an array of all the web application objects: $webApps =
Get-SPWebApplication http://intranet.contoso.com foreach($webApp in
$webApps) { } 11
Slide 12
THE BASICS CONTINUED: Looping through all the site collections
in the web application: foreach($site in $webApp.Sites){ } Looping
through all of the sites in each site collection: foreach($web in
$site.AllWebs) { } 12
Slide 13
SO, WHAT KINDS OF INFORMATION CAN WE COLLECT? Inventory the
names and URLs of all sites in the farm Inventory Crawl information
for the farm Last status & Duration Number of items crawled Get
all Role Assignments and Permission levels Expand SharePoint groups
Expand AD groups 13
Slide 14
SO, WHAT KINDS OF INFORMATION CAN WE COLLECT? Get content
database associated with site collection database growth settings
database sizes backup mode full/differential/log backup statuses
Inventory list versioning settings Site size Site last updated
14
Slide 15
USERS AND PERMISSIONS OVERVIEW SharePoint Site Permissions can
be messy Role Assignments can be SharePoint Groups AD Groups User
Objects SharePoint Groups can contain users or AD groups AD groups
can contain users and other groups 15
Slide 16
USERS AND PERMISSIONS Check if the site has unique permissions
of inherits: if($web.HasUniqueRoleAssignments -eq $false) { } If
permissions are unique: foreach($assignment in
$web.RoleAssignments){ } Check if the member string is empty or
not: if(-not [string]::IsNullOrEmpty($assignment.Member.Xml)) { }
Check if the xml starts with a group tag:
if($assignment.Member.XML.StartsWith('