Archive for March, 2009

List site users and their roles for all sites, using PowerShell

Last week, I had a specific task to find out who has Full control access to sites in our SharePoint environment. Fabrice Romelard has an excellent Powershell script to use to find out what permissions a specific user has within your environment:

(link: http://sharepointpsscripts.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=21699, fourth script).

The problem for me was, I didn’t know the logins of the users who had full control access. So I took Fabrice’s script and modified it to fit my needs (see code below).

This PS script will iterate through all of the site collections in your environment and output a list of users and their respective permissions (Reader, Contributor, Full Control, etc.).

—————————————————>8

[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”) > $null

function CheckPermissions([string]$webURL)
{

$site = new-object Microsoft.SharePoint.SPSite($webURL)
$myweb = $site.OpenWeb()
$mywebUsers = $myweb.Users

foreach($mywebUser in $mywebUsers)
{

$myPermissions = $myweb.Permissions

foreach($myPermission in $myPermissions)
{

if($mywebUser.ID -eq $myPermission.Member.ID)
{

foreach ($role in $mywebUser.Roles)
{

if ($role.Type -ne [Microsoft.SharePoint.SPRoleType]::None)
{

write-host $webURL , “; “, $mywebUser.LoginName , “; ” , $role.Type.ToString()

}

}
}
}
}

}

function StartProcess()
{
$oContentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService;

[Microsoft.SharePoint.Administration.SPWebApplicationCollection]$waColl = $oContentService.WebApplications;

$waColl1 = $waColl | where-object {$_.IsAdministrationWebApplication -eq $FALSE}

foreach ($wa in $waColl1)
{

$sites = $wa.Sites

foreach ($obj in $sites)
{

CheckPermissions $obj.Url

}

}

}

StartProcess

—————————————————–>8

Advertisements

How to delete all items in a list (using Powershell)

This week, I needed to find a way to efficiently delete all items in a SharePoint list, with the least amount of customization and development effort. I found some code on the Internet (such as here). You can also use SP Designer, or download a custom webpart called SPPurgeList (see here).

Well, I wanted to do it via Powershell (for a number of reasons). Here’s the code that I came up with (and which works on my farm).

This Powershell script iterates through and deletes all items in the specified list.

# script starts here…

[System.Reflection.Assembly]::Load(“Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”) | out-null

$oContentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService;

[Microsoft.SharePoint.Administration.SPWebApplicationCollection]$waColl = $oContentService.WebApplications;

$siteUrl = “ENTER YOUR SITE URL HERE”

$webName = “ENTER YOUR SUBWEB HERE”

$spSite = new-object Microsoft.SharePoint.SPSite($siteurl)

$spWeb = $spSite.OpenWeb($webName)

$spList = $spWeb.Lists[“ENTER YOUR LIST NAME HERE”]

foreach ($item in $spList.items)
{

$deaditem=$splist.GetItemById($item.ID)
$deaditem.Delete()

}

# Finished!

TechFuse 2009 rocked!

I had an awesome time at the TechFuse conference on Tuesday. Met a lot of interesting folks, including other SP IT Pros, sat in on some interesting presentations (Ryan’s Oliveira’s BDC Deep Dive was the best). Definitely recommended for next year.

Gary Lapointe’s STSADM extensions site

It’s definitely worth checking out Gary LaPointe’s site: http://stsadm.blogspot.com. He has a downloadable set of extensions for STSADM that make WSS and MOSS deployment, administration, and maintenance a lot easier. As of today, there are 139 new commands for STSADM that Gary has created, including such commands as movesites and synchquotas, which could be very useful.

Why Knowledge Management matters…

I believe that we are standing at the edge of the next big thing in enterprise management – using technological tools to capture, preserve, and maintain the intellectual capital of organizations. I believe that corporations will begin realize that they are investing large sums of money in their employees, but they’re not capturing, preserving, and leveraging the output of these workers. Doing so was very difficult in the past, but it’s doable with today’s tools and platforms such as SharePoint.

I look at it this way… Let’s assume we have a generic mid-level employee who is paid $50K per year. She starts on January 1st, works 50 weeks, and quits on December 31st. At the end of her tenure, this worker has accumulated a year’s worth of knowledge, skills, and experiences about the organization. The company has invested $50K into this individual plus training costs, benefits, etc. After the worker leaves, what does the company have to show for their investment? Maybe some documentation, maybe some training and some skill transfer to another employee, done in a disorganized fashion and varying from manager to manager. And that’s it?? This is an outrageous waste of money and resources. From the first time I saw it even to this day, I can hardly believe it’s happening. Do you find it outrageous too?

If you and I purchased a machine or a product that only lasted a year and which did work for us and also collected information and knowledge about our company, and we paid $50K to use it for only one year – we would want to see some information in the end, wouldn’t we? We would DEMAND to see some reports and graphs and statistics. But not so with employees – we let them work, accumulate knowledge and skills, and then we let them leave… And what about an employee who stays for 5 years and then leaves? Or a higher level employee who makes $100K per year? Or how about a 5-year employee who makes $100K per year? What’s the price tag on that?

We need to have systems and platforms in place that capture, organize, and preserve the intellectual capital produced by today’s knowledge workers. These systems need to be transparent and intertwined with the organization’s business processes and LOB systems. You can’t expect a knowledge worker to go into a separate system and consistently record their knowledge – it just won’t happen. You’ll get output from workers who have a lot of free time on their hands and are probably not the best sources of knowledge. KM needs to happen behind the scenes, in such a way that people don’t even realize they’re doing KM.
I believe that Microsoft SharePoint and other similar technologies offer a platform that will enable organizations to do effective knowledge management. And we’re going to see major changes in how organizations manage the knowledge of their workers…

Single Sign-On configuration

Excellent post on Robert Bogue’s blog about setting up SSO:

http://thorprojects.com/blog/archive/2008/08/02/moss-single-sign-on-setup-step-by-step.aspx

Check out Susan Hanley’s site…

I came across Susan Hanley’s site today. She’s a KM guru with expertise in portal solutions and content management. It turns out, I am reading a book that she contributed to, “Essential SharePoint 2007”. (I didn’t realize this until I saw the book’s cover on her site.) Check out her site for lots of good info on things like 10 My Site Best Practices and Sample SharePoint Style Guide. My favorite is Sample Stakeholder Interview Guide – we need more docs like that one!

Her blog is located here. I’m definitely adding it to my Links.


RSS Information Week Headlines

  • An error has occurred; the feed is probably down. Try again later.

RSS SharePoint Team Blog

  • An error has occurred; the feed is probably down. Try again later.

RSS InfoPath Team Blog

  • An error has occurred; the feed is probably down. Try again later.

RSS Joel Oleson Blog

  • An error has occurred; the feed is probably down. Try again later.

RSS Susan Hanley’s KM Blog

  • An error has occurred; the feed is probably down. Try again later.

Blog Stats

  • 356,734 hits