sharepoint snapin check
if((Get-PSSnapin | Where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null) { Add-PSSnapin Microsoft.SharePoint.PowerShell }