Daniel Root's Blog

Monday, November 21, 2011

VM Snapshots and SharePoint 2010

The question of using snapshots with SharePoint came up at a customer today. They aren’t really recommended because to get it right you’d have to be able to roll every machine – SharePoint and SQL databases – back to the same point in time.    But I started to  wonder if that was really true.  I double checked, and the official guidance confirms:

http://technet.microsoft.com/en-us/library/ff621103.aspx#snapshot

The only useful scenario would probably be a single server environment (ie a dev VM), or possibly a 1 SP 1 SQL environment. If you _do_ do snapshots, Microsoft recommends shutting down the VM first.  Otherwise SharePoint timer jobs could be  in the middle of doing something at 1PM and then “wake up” from a rollback suddenly at 4PM the next day.  You’d be confused too. 

Wednesday, January 26, 2011

Get all User Profiles by Using SharePoint PowerShell

Ever need to get SharePoint User Profiles from powershell?  Here’s a quick script to do just that:

$x= [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$x= [System.Reflection.Assembly]::LoadWithPartialName("microsoft.sharepoint.portal")
$x= [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server")
$x= [System.Reflection.Assembly]::LoadWithPartialName("System.Web")

$s = get-spsite
$context = [Microsoft.Office.Server.ServerContext]::GetContext($s[0])
$profileManager = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)
$profileManager.GetEnumerator()

Just save as get-spuserprofiles.ps1, and then you can do things like this:

$p = get-spuserprofiles.ps1

$p = get-spuserprofiles.ps1 | ?{$_[“WorkEmail”] –eq “email@company.com”}

Tuesday, November 23, 2010

How To: Add a Report to the Project Web Database in SharePoint 2010

This is relatively simple, but I couldn’t find a step-by-step for it, so I thought I’d post it.  SharePoint 2010 has some new default templates based on Access Data Services.  These templates- Project Web Database,  Assets Web Database, and all the other * Web Database templates – all create a SharePoint site that is essentially a handful of lists and a published Access Database containing reports and forms for showing the lists in a nice tabbed view.

One common request may be to tweak the reports that come with the site, or to add a new report altogether.  This isn’t too difficult, but my initial assumption was that all that was necessary was to create the report in Access.  There’s a little more to it than that.  To add a new report, follow these steps:

· Browse to the site

· Open the site in Access (Options ->  Open in Access) from a machine that has Access 2010 installed.

· Once the database is open, click ‘Enable editing’

· Create a new report by clicking Create -> Blank Report and dragging the desired fields, etc.  See online support for Access to learn more about the tool.

· Save the report

· Rt Click Forms -> Report Center and choose ‘Layout’

· Add a command button to the ‘Select a Report’ region.

· Click ‘Property Sheet’

· Give it a caption

· Click the ‘Event’ tab

· Click the elipses next to  ‘OnClick’

· In ‘Add New Action’, choose ‘BrowseTo’

· Choose ObjectType =Report, Object Name = Name of your report

· Set ‘Path to Subform Control’ = Main.NavigationSubform>ReportCenter.sfrReportPage

· Set Data Mode = Read Only

· Save

· Click ‘File’ -> Sync All

Once synced, give it a minute and refresh the page in your browser.  The custom report should appear in the ‘report center’ section in your site. 


Note: If these templates are not working at all in your farm, be sure Access Data Services is enabled and configured correctly.  If the default reports are not working, be sure Reporting Services is configured, including the steps to enable Access Data Services.

Friday, November 19, 2010

How To: Create a Kanban Board in SharePoint 2010 with Zero Code

imageFor those unfamiliar with it, Kanban is a project management technique developed by Toyota and popularized in IT circles by its application in Agile software development methodologies.  In software development, it’s simplest form is a whiteboard with columns for each status, in which post-it notes are affixed for each task.  As tasks migrate through development, the post-it note is moved from column to column.   Several web-based services and downloadable project management applications exist for implementing something similar sans the whiteboard (one of the best being AgileZen).  However, in some cases a lightweight version based on SharePoint might be handy.  SharePoint provides out-of-the-box functionality for creating project task lists, and, with a little pointing-and-clicking, it’s possible to display these out-of-the-box project task lists Kanban-style.  Here’s how:

Create the Project List

The standard Team Site has one of these, called ‘Tasks’, but you may choose to create your own.  To do this, click Site Settings –> More Options –> Project Tasks.  Give the list a name and url, and click OK.  Once you have a task list, to create a few tasks- one for each status.  When you’re done, you should have something like this:

image

Next, create views for each column that will be on the Kanban board.   You may want to give some thought as to what the columns will be, but for this demo, I chose views named ‘Not Started’, ‘In Progress’, and ‘Recently Completed’.  Tasks with a Deferred or Waiting status will be considered ‘In Progress’.  To do this, follow these steps:

  • Click ‘List –> Create View –> Standard View
  • Enter ‘Not Started’ as a view name
  • Uncheck all columns except for title
  • For Sort, choose Priority and then Due Date
  • For Filter, Check ‘Show items only when the following is true’
  • Set ‘Show items when column’ Status is equal to Not Started
  • Repeat for each view, changing the name and filters appropriately
  • For the ‘Recently Completed’ view, sort by Modified instead of ‘Due Date’

Create the Kanban Board

To visualize all of these in columns, create a new page and then add each view in a table.  To do this, follow these steps:

  • Click ‘Site Actions –> New Page’
  • Enter the page name and click OK
  • Click ‘Insert’ and drop down on ‘Table’ to create a 3 column table.

image

  • Click inside the first column and click Insert –> Existing List
  • Choose the task list you created (or the default one) and click ‘Add’
  • Drop down on the web part menu and choose ‘Edit Web Part’
  • Choose the ‘Not Started’ view and click ‘OK’ for the warning.
  • Enter ‘Not Started’ for the Title.
  • Repeat for each column, choosing the appropriate view.
  • For In Progress and Completed, also choose ‘No Toolbar’

In the end, you should have something that looks like this:

image

And there you have it!  A simple Kanban board, built in minutes, with out-of-the-box SharePoint functionality!

If you’re feeling adventurous, you can spice it up a little bit by customizing the page in SharePoint Designer.  I’ll leave that as an exercise for the reader for now, but here are some ideas on how to improve on this:

  • Remove those ‘Title’ column headers
  • Use formatting to highlight items that are deferred, waiting, or past due
  • Use Content Query Web Parts instead to roll up tasks from multiple sites into a single Kanban board.

Thursday, November 11, 2010

One Password To Rule Them All

About a month ago, Elizabeth and I had our email and Facebook accounts hacked.   A little sleuthing traced it to a Russian group who likely were trying to use our accounts to run a scam, and had gotten our accounts either through a hacked router or through GMail’s normal password reset feature.  We’d been using the same few passwords everywhere (a cardinal sin in online security), and finally got bit.  I caught it pretty quickly, and was able to change our passwords before anything bad happened, but the hassle that ensued, changing all of our passwords for all of our online services had both of us about ready to give up the internet and head for the hills.   As tempting as that was, I decided to look into some alternatives to better manage our personal online security.  I had the following requirements:

  • It had to be secure.  Fort Knox secure.  I was mad at these hackers, and didn’t want it to happen again.
  • The Wife Acceptance Factor (WAF) had to be high.  Poor Elizabeth spent hours resetting passwords and was pretty frazzled.  A solution that was not user-friendly was not going to work.
  • I wanted it to work on my PC, Elizabeth’s Mac, our iPhones, and my iPad.  They all needed to sync up like magic.

After evaluating KeePass, and a few others I landed on LastPass.  For $1 a month, it does everything we could want, on every device, and syncs up seamlessly.  It works by storing all of your passwords in one file that is encrypted using the same algorithms as the military.  You have to remember a single password to get to your other passwords, but this single password can be long, easy to remember, and hard to guess.  The decryption only happens on your devices, so you never actually share your passwords with LastPass.   Once logged in to LastPass, you can see your passwords, but you don’t really have to, because it also supports automatically logging in to websites. The idea is that by only having to remember one password and making it easy to use,  you can afford to change your passwords frequently, use more secure passwords, and not use the same one everywhere. 

If all of this sounds complicated, it’s really not.  In the end, LastPass makes passwords and other sensitive data more secure AND easier to use.  If you’re at all worried about the security of your online accounts, go watch their video, then download and install the free version (only pay if you need to sync between multiple devices).  It’ll step you through the process and soon you’ll wonder how you lived without it.

Friday, November 5, 2010

How to Become a SharePoint PowerShell Ninja in 4 Easy Steps

If you’re at all interested in PowerShell, here’s 4 easy steps to becoming a powershell ninja:

  1. Learn .NET.  PowerShell is .NET in the commandline.  The more .NET you know, the more you’ll know PowerShell.  If you’re stuck trying to figure out how some PowerShell thing works, run $mything.GetType() and look it up in MSDN.  In SharePoint for example, $mything = Get-SPWeb http://somesite; $mything.GetType() returns a SPWeb instance, which you can learn all about on MSDN.
  2. Use the ‘intellisense’ in PowerShell.  You can use <tab> to step through members on a variable, like this: $mything. <tab>  OR you can use get-member, like this : $mything | Get-Member
  3. Use ‘gcm *Something*’ alot.  Do you want to know commands related to SharePoint Search? gcm *Search*.  The naming is usually consistent, so you can do things like “gcm Get-SP*”, if you know you want to get some SP thing.
  4. Use get-help <command> alot.  Read up the help.  Sometimes it’s more helpful than others, but usually –examples will at least put you on the right track and teach you about pipes, where, and foreach.

That’s it.  Lather, Rinse, Repeat, and before long, you’ll be slinging scripts instead of poking around in tedious CA or Site Settings pages.

Thursday, October 14, 2010

Grant Search Account Access to all Web Applications via PowerShell

Here’s a handy script I just whipped up.  When administering SharePoint Search, you typically have a ‘crawl account’ that is given access to all SharePoint sites via user policy.  This isn’t a terribly hard thing to do in Central Admin, but it can be a hard thing to remember =)  In CA, you go to each web app –> User Policy –> Add –> All Zones –> Type Username, full read –> OK.  Depending on how many web apps you have, this can be a little tedious. Also, if you’re trying to be sure you can provision your farm from script as much as possible, a little powershell can be handy here. This script does just that:

$accountName = "DOMAIN\CrawlAccount"

$webApps = Get-SPWebApplication
$webApps | %{
$webApp = $_
    $searchPolicy = $webApp.Policies | ?{$_.UserName -eq $accountName}
    if ($searchPolicy -eq $null){
        Write-Host "$($webApp.Url) does not have a $accountName policy, so it will be added."
        $searchPolicy = $webApp.Policies.Add($accountName, $accountName)
        $searchPolicy.PolicyRoleBindings.Add($webApp.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullRead))
        $webApp.Update()
    }else{
        Write-Host "$($webApp.Url) already has a policy for $accountName, so it will be skipped."
    }

}