CSS to style SharePoint list headers

<style type=”text/css”> .ms-vh2 {
FONT-WEIGHT: bold;
TEXT-ALIGN: center;
BACKGROUND-COLOR: #000099
}

TR.ms-viewheadertr > TH.ms-vh2 {
BORDER-TOP: white 1px solid;
BORDER-RIGHT: white 1px solid;
BORDER-BOTTOM: white 1px solid;
BORDER-LEFT: white 1px solid
}

.ms-vh2 A {
COLOR: white !important
}

.ms-vh2:hover A {
COLOR: #000099 !important
}

.ms-vh2 A:hover {
COLOR: #000099 !important
}

.ms-vh-div {
COLOR: white !important
}

.ms-vh-div:hover {
COLOR: #000099 !important
}

</style> [OR]

<style type=”text/css”>
.ms-vh2 {
FONT-WEIGHT: bold;
TEXT-ALIGN: center;
BACKGROUND-COLOR: #08397a
}

.ms-vh {
FONT-WEIGHT: bold;
TEXT-ALIGN: center;
BACKGROUND-COLOR: #08397a;
Color: white !important
}

TR.ms-viewheadertr > TH.ms-vh2 {
BORDER-TOP: white 1px solid;
BORDER-RIGHT: white 1px solid;
BORDER-BOTTOM: white 1px solid;
BORDER-LEFT: white 1px solid
}

TR.ms-viewheadertr > TH.ms-vh {
BORDER-TOP: white 1px solid;
BORDER-RIGHT: white 1px solid;
BORDER-BOTTOM: white 1px solid;
BORDER-LEFT: white 1px solid;
}

TR.ms-viewheadertr > TH.ms-vh:hover {
background-color: #08397a !important;
}

TR.ms-viewheadertr > TH.ms-vh2:hover {
background-color: #08397a !important;
}

.ms-vh2 A {
COLOR: white !important
}

.ms-vh2:hover A {
COLOR: white!important
}

.ms-vh2 A:hover {
COLOR: white!important
}

.ms-vh A {
COLOR: white !important
}

.ms-vh:hover A {
COLOR: white!important
}

.ms-vh A:hover {
COLOR: white!important
}

.ms-vh-div {
COLOR: white !important
}

/*.ms-vh-div:hover {
COLOR: #08397a !important
}*/

</style>

Send an email using PowerShell

function sendMail{

Write-Host “Sending Email”

#SMTP server name
$smtpServer = “something.something.com” #–Enter your SMTP server name

#Creating a Mail object
$msg = new-object Net.Mail.MailMessage

#Creating SMTP server object
$smtp = new-object Net.Mail.SmtpClient($smtpServer)

#Email structure
$msg.From = “admin@SharePoint.com”

$msg.To.Add(“John.Doe@contoso.com”)
$msg.subject = “Email Test”
$msg.body = Get-Content C:\Emailbody.txt

#Sending email
$smtp.Send($msg)

}

#Calling function
sendMail

Migrating user permissions from Old domain to New domain

To migrate users in from Old doamin [old\abc] to New domain [new\abc] in a bulk, use the below STSADM command.

$Data = Import-Csv “C:\Migration.csv”
Set-Location “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN”
foreach($Item in $Data)
{
    .\stsadm.exe -o migrateuser -oldlogin $Item.Old -newlogin $Item.New -ignoresidhistory
}

Note: You need to save the list of user accounts int he below format, in a CSV file before running the above script.

OLD\abc,New\abc

Tip: You can divide the list into multiple files and run the script on all WFEs opening multiple script windows to save time

To create a site collection in a specific content database with specific template using PowerShell

$url = “http://contoso/sites/teamsite&#8221;

$ContentDatabase = “WSS_Content_Contoso_1”
$WebsiteName = “Contoso Shipping”
$WebsiteDesc = “Contoso Shipping Site”
$Template = ” ” #–Paste the site template ID here
$PrimaryLogin = “Domain\UserName”
$PrimaryDisplay = “SharePoint Admin”

New-SPSite -Url $url –ContentDatabase $ContentDatabase -Name $WebsiteName –Description $WebsiteDesc  -Template $Template -OwnerAlias $PrimaryLogin

To get a list of all web templates using PowerShell

function Get-SPWebTemplateWithId
{
$templates = Get-SPWebTemplate | Sort-Object “Name”
$templates | ForEach-Object {
$templateValues = @{
“Title” = $_.Title
“Name” = $_.Name
“ID” = $_.ID
“Custom” = $_.Custom
“LocaleId” = $_.LocaleId
}
New-Object PSObject -Property $templateValues | Select @(“Name”,”Title”,”LocaleId”,”Custom”,”ID”)
}
}

Get-SPWebTemplateWithId | Ft -autosize |Out-string -width 4096 >>C:\template.txt