Showing posts with label PowerShell. Show all posts
Showing posts with label PowerShell. Show all posts

6/08/2014

New SharePoint PowerShell Course 55095AC

 

PS C:\> Get-PSScripts | Organize-PSScripts | Create-MAXClass

I've written and collected SharePoint scripts for the last several years with the idea of one day turning them into a book or a class. I've finally pulled together a class from the scripts in this blog, from the PowerShell chapter of my SharePoint security book and from examples created for my classes. Turns out there are over 175 examples in the final class.

This class was a lot of fun to right, but it had a major challenge, limiting what I put into it. As there is a lot of good content on the web for SharePoint server administration, I focused this class on the rest of us who need to find stuff and answer those random management questions. You know, those kinds of things that a SharePoint governance auditor might need to do, and the kind of weird questions that SharePoint administrators get every day.

The class has been uploaded to the Microsoft Courseware Marketplace and should be available to training centers in a few weeks as course 55095AC. Check out the MAX Technical Training web site for the dates when I will be delivering the class. The next date is July 24th. At MAX you can attend local classes in Cincinnati or attend as a remote student from anywhere!


SharePoint 2010 and 2013 Auditing and Site Content Administration using PowerShell

Course #:                                      55095AC

Number of Days:                                         1

Format:                               Instructor-Led

Certification Exams:                           None

This one day class is designed for SharePoint 2010 and 2013 server administrators and auditors who need to query just about anything in SharePoint. The class handout is effectively a cheat sheet with over 175 PowerShell scripts plus the general patterns to create your own scripts. These scripts cover:

·        using the SharePoint Management Shell and the ISE

·        general tips for counting, reformatting and exporting results;

·        understand and drilling up and down the SharePoint object model

·        getting lists / inventories of servers, services web applications, sites, webs, lists, libraries, items, fields, content types, users and much more

·        finding lists by template type, content type and types of content

·        finding files by user, content type, file extension, checked out status, size and age

·        finding inactive sites

·        finding and changing SharePoint Designer settings and finding and resetting customized pages

·        inventorying and managing features

·        deleting and recycling files and list items

·        inventorying users and user permissions and finding out “who can access what”

·        creating sites, lists and libraries

·        uploading and downloading files

·        and much more…

Audience

·        SharePoint server administrators.

·        SharePoint auditors.

·        Also valuable for SharePoint developers.

 

At Course Completion

After completing this course, students will be able to:

·        Use PowerShell to query just about anything inside of SharePoint.

·        Understand the core SharePoint object model and object hierarchy as seen from PowerShell.

·        Format PowerShell output in to reports.

·        Manage resources to limit the impact on production servers.

·        Create and delete Site Collections, subsites, lists, libraries and content.

 

Prerequisites

Before attending this course, students must:

·        Very good knowledge of SharePoint and its features.

·        Good experience using PowerShell 2 or later or recent completion of a PowerShell class such as 10961 or 50414.

 


 

Module 1:  SharePoint and PowerShell

This module provides an introduction to the topics covered in the class, introduces SharePoint PowerShell terminology and provides a review of important PowerShell features.

 

Lessons

§  History of PowerShell in SharePoint

§  PowerShell vs. Search

§  PowerShell, SharePoint Management Shell and cmdlets

§  Security and Permissions Needed

§  Getting Started with PowerShell: Counting Items, Custom Columns, Reformatting Numbers, Saving Results to a File

§  Changing and Updating Content: Creating SharePoint Objects, Changing Objects

 

Lab:

§  Using PowerShell with SharePoint

 

 

After completing this module, students will be able to:

§  Get started using PowerShell to inventory and update SharePoint.

 

Module 2: Working with SharePoint CMDLETs and Objects

This module introduces the SharePoint object model and some important terminology.

 

Lessons

§  GUIDs

§  Sites vs. Webs

§  The SharePoint Object Hierarchy

 

Lab:

§  Get a list of all Site Collections and their GUIDs

§  Get a list of all Webs in all Site Collections

§  Given a web’s URL get its parent web and web application

 

After completing this module, students will be able to:

§  Explore sites and webs using PowerShell.

§  Retrieve important properties of common SharePoint objects

 

Module 3: Managing Memory and Limiting Performance Impact

This explores limiting impact on server memory usage and performance.

 

Lessons

§  Memory Management and Disposing Objects

§  Limiting Impact on Production Servers

 

Lab:

§  Exploring PowerShell’s use of system memory.

§  Testing the impact of scripts on server performance

 

After completing this module, students will be able to:

§  Recognize and manage the impact of PowerShell on a SharePoint server.

 

 

Module 4: Working with Content

This module explores SharePoint using PowerShell from the Farm down to individual list items.

 

Lessons

§  Getting Farm Information: version, services, services, features

§  Getting Web Application information

§  Exploring Site Collections: retrieve Site Collections, Site Collection Administrators, quotas

§  Working with the Recycle Bins: finding items, getting file counts and bytes, deleted sites

§  Exploring Webs: web templates, finding webs, finding webs based on template, Quick Launch and Top Link Bar navigation

§  Exploring Lists and Libraries: finding all lists, lists by type, lists by Content Type, columns/fields, document count by web or library

§  Exploring Content Types

§  Finding documents: by a word in the title, file type, content type, size, date age, checked out status, approval status and many more…

§  Deleting content

§  Downloading and uploading files

 

Lab:

§  Explore the farm.

§  Inventory site collections.

§  Create a recycle bin report.

§  Finding all blog sites.

§  Find all picture libraries.

§  Find all PDF files over 5 MB.

§  Delete all videos in a site collection.

 

After completing this module, students will be able to:

§  Explorer, inventory and maintain SharePoint content using PowerShell.

 

Module 5: Users and Security

This module covers the use of PowerShell to explore and document SharePoint permissions.

 

Lessons

§  Users: find a user, get a list of all users, working with Active Directory groups

§  SharePoint groups: Get lists of groups, get the members of a group, find all groups a user belongs to, find the groups associated with a web

§  Expanding users lists that include Active Directory groups

§  Documenting Broken Inheritance / Unique Permissions: webs, lists, libraries, folders, items

§  Working with Role Assignments

 

Lab:

§  Get a list of all users who have access to a Site Collection.

§  Get a list of all groups in a Site Collection.

§  Get a list of all groups a user belongs to.

§  List all users who may have access to a SharePoint securable.

§  Get a list of all securables with broken inheritance.

 

After completing this module, students will be able to:

§  Explore and document users and user permissions.

§  Explore and document SharePoint groups.

§  Explore and document broken inheritance.

 

 

 

Module 6: Managing Sites

This module explorers Site Collection and Web management from PowerShell.

 

Lessons

§  Finding Inactive Webs

§  Creating and Deleting Site Collections

§  Getting Site Collection Data

§  Creating and Deleting Subsites

§  Working With SharePoint Designer Settings

 

Lab:

§  Create a report for inactive sites.

§  Create a site collection and subsites.

§  Delete a site.

§  Delete a site collection.

§  Disable SharePoint Designer in all site collections.

 

 

After completing this module, students will be able to:

§  Manage SharePoint Site Collections and webs from PowerShell.

 

.

5/04/2014

Sometimes you feel so dumb… PowerShell Mistake!

 

I'm trying to search SharePoint using PowerShell and REST web services…

PS C:\> Invoke-WebRequest http://spserver/sites/demo3/_api/search/query?querytext='sharepoint'  -UseDefaultCredentials

I keep getting:

Invoke-WebRequest : The remote server returned an error: (400) Bad Request.

Sad smile

I spent the last hour doing web searches for "400" errors and Invoke-WebRequest and SharePoint and search etc.

Talk about the forest and the trees… The problem was with basic PowerShell strings in parameters. The single quotes got me! Quotes around strings should be required on parameters, but PowerShell lets you be lazy and leave them off… most of the time. Here's the correct solution:

PS C:\> Invoke-WebRequest "http://spserver/sites/demo3/_api/search/query?querytext='sharepoint'"  -UseDefaultCredentials

The only change was the addition of double quotes. Everything now works as expected! A full hour wasted climbing the wrong trees.

Smile

In the forest of ASCII, watch out for the quote trees…

.

4/28/2014

SharePoint 2013: RegistrationId List Template Type IDs Updated!

 

I have updated the "SharePoint: RegistrationId List Template Type IDs" article to include the new 2013 list types. This time, I used a PowerShell script to dump the SPListTemplateType enumeration. Note that there are many template IDs that are not in the SPListTemplateType enumeration and generally can only be found in investigations of the databases and other documentation.

The PowerShell script: (Works in both SP 2010 and 2013)

PS C:\> $SPtt = [Microsoft.SharePoint.SPListTemplateType]
PS C:\> [System.Enum]::GetNames($SPtt) |  select {$_}, {[int][System.Enum]::Parse($SPtt, $_)}

image

.

4/16/2014

Change the SharePoint 2013 Suite Bar Text

 

Hacking around with PowerShell always finds some new property or method that I would never have gone looking for! This time it is a SPWebApplication property that sets the text in the "Suite Bar".

The default text in the suite bar is "SharePoint" for on premises installs and "Office 365" plus an icon for the cloud versions. The actual HTML for the text is "<div class="ms-core-brandingText">SharePoint</div>".

Examples from on premises SharePoint and Office 365:

image

… but… I don't know how to get access to the SPWebApplication object in Office 365 from PowerShell! You can still change it using JavaScript. (See notes at the end of this article.)

 

Using PowerShell

The following PowerShell will list the Suite Bar text for each of your web applications:

PS C:\> Get-SPWebApplication | Select DisplayName, SuiteBarBrandingElementHtml

DisplayName               SuiteBarBrandingElementHtml
-----------               ---------------------------
My Sites - 82             <div class="ms-core-brandingText">SharePoint</div>
SharePoint Intranet - 80  <div class="ms-core-brandingText">SharePoint</div>
SharePoint Testing - 81   <div class="ms-core-brandingText">SharePoint</div>

To change the text, access your web application object (mine will be the 2nd in the list, so [1]), and set the SuiteBarBrandingElementHtml to your new text. You will probably want to include the default CSS class for consistency. Remember to do the .Update, or nothing will be saved!

PS C:\> (Get-SPWebApplication)[1].suitebarbrandingelementhtml = 
"MA<span style='color:#FF2020'>X</span> Technical Training" PS C:\> (Get-SPWebApplication)[1].update()

The above will change the text to:
image

If I include the DIV and class from the default text then is will look like this:
image

 

Can't use PowerShell?

You can use JavaScript or jQuery to change the Suite Bar title text in both on premises SharePoint and Office 365. All you need is some code to find the DIV with the class of ms-core-brandingText and change it's contents. When working with Office 365, be aware that the text is also a hyperlink to https://portal.microsoftonline.com/, so be careful not to break it!

In jQuery it might look like this:

$('.ms-core-brandingText').text('Your New Title Text');

Here's an article about changing the text in Office 365: http://sharepoint-community.net/profiles/blogs/changing-the-office-365-main-link-text

 

Have fun and don't break anything!

.

4/14/2014

Cincinnati PowerShell User Group meeting announcement

 

From Rob Dreyer, the organizer:

Our first meeting in 2014 will be extra special. Throughout 2014, Dr. Ferdinand Rios, the CEO of SAPIEN Technologies, Inc. is touring around the world. Last week, I received word that on Thursday April 17th he will be coming to MAX! I nearly fell out of my seat when I heard.

Please register here: http://www.meetup.com/TechLife-Cincinnati/events/154731982/

See you there!

  • Thursday, April 17, 2014
    6:00 PM to 8:30 PM
     

How to keep track of the PowerShell user group:

Note to spammers!

Spammers, don't waste your time... all posts are moderated. If your comment includes unrelated links, is advertising, or just pure spam, it will never be seen.