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