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 protected]”}