Wednesday, April 11, 2012

SPMetal - Turn a SharePoint list into a C# class and LINQ it

My esteemed coworker Derek just told me about SPMetal, a utility from Microsoft that can turn a SharePoint list into a C# class that can be manipulated like a normal LINQ object...

http://msdn.microsoft.com/en-us/library/ee538255.aspx

More details to follow...

Tuesday, April 10, 2012

Change windows 7 key after install

Plucked this gem off the interwebs just now:
"Do you need to change your product key so you can activate Windows Vista or Windows 7 properly? You can use a great command line tool that will help you do this very easily. Just follow these steps:
Click on the Start Button and type in command prompt so that it shows up on your start menu search list. Right click on the Command Prompt shortcut and select Run As Administrator.
At the administrator command prompt, type in "slmgr.vbs -ipk "
To activate windows after changing the key, run "slmgr.vbs -ato"

Credit: http://tweaks.com/windows/39026/change-windows-product-key-after-install/

Monday, March 26, 2012

Office Space: Custom Auditing In SharePoint

Office Space: Custom Auditing In SharePoint: "Custom Auditing In SharePoint"

'via Blog this'

Change User's email in SharePoint site

The Set-SPUser command lets you change

Set-SPUser -Identity 'domain\user' -DisplayName 'John Doe' -Email 'john.doe@nowhere.com' -Web http://myweb/path/to

Reset services on a SharePoint Farm

Came across this today that lets you restart whatever services you want on all the servers in your farm...

IISRESET all servers in farm using PowerShell

--- snip ---
if((Get-PSSnapin -Name Microsoft.Sharepoint.PowerShell -ErrorAction SilentlyContinue) -eq $null)
{
Add-PSSnapin Microsoft.Sharepoint.PowerShell
}
function Reset-Services
{
# Connect to the farm
$Farm = Get-SPFarm
foreach ($Server in $Farm.Servers)
{
$ServerName = $Server.Name
$ServerRole = $Server.Role
if ($Server.Role -ne "Invalid")
{
Write-Host "Restarting IIS Services on $ServerName."
IISReset $ServerName
IISReset $ServerName /Status
}
}
}
Reset-Services
-- snip --
if((Get-PSSnapin -Name Microsoft.Sharepoint.PowerShell -ErrorAction SilentlyContinue) -eq $null)
{
Add-PSSnapin Microsoft.Sharepoint.PowerShell
}
function Reset-Services
{
# Connect to the farm
$Farm = Get-SPFarm
foreach ($Server in $Farm.Servers)
{
$ServerName = $Server.Name
$ServerRole = $Server.Role
if ($Server.Role -ne "Invalid")
{
Write-Host "Restarting IIS Services on $ServerName."
IISReset $ServerName
IISReset $ServerName /Status
Write-Host "Restarting Timer Job on $ServerName."
$Service = Get-WmiObject -Computer $ServerName Win32_Service -Filter "Name='SPTimerV4'"
if ($Service -ne $nll)
{
$Service.InvokeMethod('StopService',$null)
Start-Sleep -s 7
$service.InvokeMethod('StartService',$null)
Start-Sleep -s 7
Write-Host "Timer Job successfully restarted on $ServerName."
}
}
}
}
Reset-Services