9/23/2012

SharePoint Saturday Cincinnati 2012–Oct. 27th

 

SharePoint Saturday Cincinnati

Saturday, October 27, 2012

Event details, including speakers and topics have been posted!
Go here for details: http://www.sharepointsaturday.org/cincinnati

Register here:  http://spscincinnati2012.eventbrite.com/

Twitter: #SPSCincinnati

sps-cincinnati-speaker-badge

My topic will be "Exploring and Auditing SharePoint Using PowerShell"

This session shows how to use PowerShell in both SharePoint 2007 and 2010 to find and extract all kinds of information not easily found using built-in features.  In this session you will see how to use PowerShell to:
 
• Find all documents in any site, or the entire farm, that matches a pattern (example: *.avi)
• Find all users who have access to a particular file (or folder, or library or site)
• Find sites with no recent activity
• Find all content a single user has access to
• Find all libraries that use a selected Content Type
• Find all customized (un-ghosted) pages
• Find all pages that use a selected web part
• How to collect the results into reports
• and more…

8/26/2012

Final Reminder! First Ever Cincinnati PowerShell User Group Meeting 8/28!

 

Tuesday, August 28, 2012, 6:00 PM to 8:00 PM (add it to your calendar NOW!)

It's free! Go here and register NOW!
http://www.meetup.com/TechLife-Cincinnati/events/75092962/
(Registration is not required, but will help us plan for the event, order pizza and spread the word.)

Speaker is scheduled, SWAG is being acquired, people are signing up.

Ed Wilson, the Microsoft Scripting Guy and a well-known scripting expert, will be the kick off speaker for the new Cincinnati PowerShell user group. His topic will be "Using Windows PowerShell 3.0 to manage the remote Windows 8 workstation".

Goodies are on the way from Microsoft Press, O'Reilly, APress and others! Free books, discounts, and other stuff, all to be given away as door prizes. (But I know you are coming to hear Ed speak, not to win door prizes!)

Come prepared to network, talk PowerShell and even volunteer to support this new user group!

Spread the word!

Let your coworkers know. Blog and Tweet about it. (#cincypowershell should work)

Ed's Topic "Using Windows PowerShell 3.0 to manage the remote Windows 8 workstation"

There are four different ways to manage a remote Windows 8 workstation. The first is to use WMI remoting, the second is to use the computername cmdlets, the third is to use WinRm and Windows PowerShell native remoting, the last way is to use the CIM cmdlets. Each approach has advantages and disadvantages for the network administrator. In this session, I will examine each approach, and provide a checklist of criteria to aid the enterprise network administrator in choosing the appropriate technology for a variety of real world scenarios. This presentation combines live demo’s and interactive discussion to heighten learning.

About the presenter:

Ed Wilson is the Microsoft Scripting Guy and a well-known scripting expert. He writes the daily Hey Scripting Guy! blog. He has also spoken multiple times at TechEd as well as at the Microsoft internal Tech Ready and Geek Ready conferences. He has also spoken at the first SQL Rally conference in Orlando, as well as at numerous SQL Saturday events. He is a Microsoft-certified trainer who has delivered a popular Windows PowerShell workshop to Microsoft Premier Customers worldwide. He has written 9 books including 6 on Windows scripting that were published by Microsoft Press. He has also contributed to nearly a dozen other books. His Windows PowerShell 2.0 Best Practices book for Microsoft Press is currently a best seller. Ed holds more than 20 industry certifications, including Microsoft Certified Systems Engineer (MCSE), the Microsoft Certified Data Base Administrator (MCDBA) and Certified Information Systems Security Professional (CISSP). Prior to coming to work for Microsoft, he was a senior consultant for a Microsoft Gold Certified Partner where he specialized in Active Directory design and Exchange implementation. In his spare time, he enjoys woodworking, underwater photography, and scuba diving.

.

8/24/2012

SharePoint PowerShell cmdlets Equivalents for SharePoint 2007

 

SharePoint 2007 administrators may feel a bit left out when the see all of the articles showing how to do quick and powerful things with SharePoint 2010 PowerShell cmdlets. In this article I will show how to create common SharePoint objects without using the cmdlets.

This article is not done… I will be adding to it. Let me know if you need any other cmdlet replacements. When I get a chance I'll wrap up and publish my collection of 2007 "cmdlets" so you can generally just use the 2010 scripts.

 

Most of the examples below are in the form of "replace this cmdlet based code fragment with this SharePoint API fragment".

 

Hooking PowerShell to the SharePoint API

For all of the following script samples start your script with this line:

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

This line is only need once at the beginning of your script.

 

Get-SPFarm

Replace:
  $farm = Get-SPFarm

With:
   $farm = [Microsoft.SharePoint.Administration.SPFarm]::Local

Notes:

  • The cmdlet's default property is the name of configuration database. OM's default return is a list of all properties.
  • The output of the above can be piped just like Get-SPFarm.
      [Microsoft.SharePoint.Administration.SPFarm]::Local | select servers
    or
      $farm | select servers

 

Get-SPSite

Returned Data with URL parameter

Replace:
  $site = Get-SPSite http://intranet

With:
  $site = New-Object Microsoft.SharePoint.SPSite("http://intranet")

Notes:

  • The cmdlet's default property is the Url of the site collection. OM's default return is a list of all properties.
  • The output of the New-Object can be piped to another cmdlet just like Get-SPSite. You cannot pipe into New-Object.

 

Target of a Pipe passing a SPWebApplication or a collection of SPWebApplications

Replace:
$webapplication | Get-SPSite

With:
$webapplication | select -ExpandProperty Sites

Examples:
  2010: $webapplication | Get-SPSite | Select url, {$_.rootweb.title}
  2007: $webapplication | select -ExpandProperty Sites | Select url, {$_.rootweb.title}

 

Get-SPWeb

Returned Data with URL parameter

Replace:
  $site = Get-SPWeb http://intranet/sailboat

With:
  $web = (New-Object Microsoft.SharePoint.SPSite("http://intranet/blog")).OpenWeb()
or
  $web = (New-Object Microsoft.SharePoint.SPSite("http://intranet")).allwebs["sailboat"]

Notes:

  • The above is identical to the Get-SPSite replacement with the addition of .OpenWeb().
  • Get-SPWeb typically is used with "-Limit All" to display more than 20 webs. That is not needed with the 2007 equivalent which will always return all webs.

 

Target of a Pipe passing a collection of SPSites

Replace:
  collectionOfSites | Get-SPWeb

With:
  collectionOfSites | select -ExpandProperty AllWebs

Examples:
  2010: $webapplication.Sites | Get-SPWeb | Select title, url
  2007: $webapplication.Sites | select -ExpandProperty AllWebs | Select title,url

 

Get-SPWebApplication

Returned Data using URL parameter

Replace:
  $webApplication = Get-SPWebApplication http://servername

With:
$webApplication = [Microsoft.SharePoint.Administration.SPWebApplication]::Lookup("http://servername")

 

Returned Data without parameter (return all web apps)

Replace:
$webApplications = Get-SPWebApplications

With:
$webApplications = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.WebApplications

 

more to come…

8/22/2012

SharePoint: PowerShell to find all Content Types that use a Site Column

 

Just another little PowerShell script for SharePoint…

The following will report all Content Types in a single Site Collection that uses a particular Site Column.

This is related to this article PowerShell to find SharePoint Content Types.

 

The Script:

$site = Get-SPSite http://sharepoint/sites/training   #your URL here!
$web = $site.RootWeb

# Get the GUID of your Site Column
$guid = $fields["End Time"].id            # your Site Column name here

# Find all content types that use that column type
#  This will display all content types and list details if there match for the column


$ct = $web.AvailableContentTypes 
for ($i=0; $i -lt $ct.Count; $i++) 
{
  for ($j=0; $j -lt $ct[$i].Fields.Count; $j++) 
  {
    if ($ct[$i].Fields[$j].id -eq $guid)
    {
      Write-Host $ct[$i].Name " has column"
    }
  }
}

 

For SharePoint 2007 replace the first line with these two:

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

$site = New-Object Microsoft.SharePoint.SPSite(http://yourserver/sites/yoursite)

 

.

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.