Automating SharePoint with PowerShell

At SharePoint Saturday Boston, I gave a talk on Automating SharePoint with PowerShell.  Here is the description:

PowerShell is a powerful scripting environment and language for developers and administrators.  SharePoint 2010 has built in PowerShell administration commandlets, but you can use this powerful scripting language with any version of SharePoint.  Using PowerShell, Talbott will demonstrate how you can build and deploy SharePoint sites for development, testing, proof of concepts, and production.  Using an agile methodology, you will learn how to leverage PowerShell scripts for your planning and development process.

The slides are available on the SharePoint Saturday Boston site.

For those of you who were interested in the code samples, here you go:


2 thoughts on “Automating SharePoint with PowerShell

  1. I tuned into your webex today, and have to say it was pretty good. I was wondering if there is anyplace that these are saved for later viewing? I am trying to re-create some of the steps you did in the begining using the DIR and GET-Member to return values of files etc.

    I must be doing it a little bit wrong though because I cant seem to get it to work correctly.

    Originally you did DIR | get-member to list all of the attributes/properties of the files. But I cant seem to figure out how you
    1. Returned that data output to the screen
    2. Picked a specific property and then got the attributes of that. Im talking about the part where you selected the Date option and the showed the created, modified, and then used the subtract formula on them.

    I guess Im looking for the syntax you used because trying to recall it from memory isnt working for me.


  2. Hi Joe,

    I glad you enjoyed the Webinar today. All of the sessions in the SharePoint Saturday Webinar Series are recorded and viewable at:

    It usually takes a few days to get them uploaded after the live event, so check in there on Wednesday and it should be up.

    Try this:

    $a = DIR
    (that puts the directoy list, or more accurately the array, into the $a variable)

    $a[2] | get-member
    (that sends the third [0=first, 1=second, 2=third] item in the list to the get-member command to list all of its properties. Note: if you only have 2 items when you type DIR then this will produce an error since there is no third item)

    (that will display the date and time this item was created)

    $a[2].CreationTime | gm
    (gm is an alias for get-member, so this will display all the properties and methods in the CreationTime object)

    $b = Get-Date
    (puts the current date and time into the $b variable)

    (this will display the difference between the current date and time and the date and time the 3rd item was created)

    Happy Scripting!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s