Showing posts with label Powershell. Show all posts
Showing posts with label Powershell. Show all posts

Saturday, June 27, 2015

Bulit-in feature in Sharepoint for monitoring Sharepoint disk space usage


Types of SharePoint Log Events
  • Unified Logging System (ULS) 
  • Trace Logs 
  • Windows Event Logs 
  • Logging Database 
  • Health Analyzer 
  • Timer Jobs 


Unified Logging System (ULS) 

Eye for sharepoint and each event Report generating

We can see three ways:

  • SharePoint trace logs
  • Windows Event Log
  • SharePoint logging database

     Trace logs

    C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15
    The naming format for the trace log files is machinename-YYYYMMDD-HHMM.log, in 24-hour time.
     By default, a new log file is created every 30 minutes.
     You can change the interval by using Windows PowerShell with the Set-SPDiagosticConfig command. 
    The following powershell code snippet configures SharePoint to create a new trace log every 60 minutes.
    Set-SPDiagnosticConfig Set-SPDiagnosticConfig -LogCutInterval 60
    Get-SPDiagnosticConfig outputGet-Help set-SPDiagnosticConfig -ExamplesSet-SPDiagnosticConfig -LogLocation e:\Logs


    SharePoint LogLevel:
    Get-Command -Noun SPLogLevel

    Using SPLogEvent and SPLogFile:

    Get-SPLogEvent | Select -First 5
    Get-SPLogEvent | Select -Last 5
    Get-SPLogEvent | Select -First 20 -Last 10


    In Central Administration, click Monitoring on the left, and then select Configure Diagnostic Logging under the Reporting section
  • users reset logging Reset to default setting
Moving trace logs

Logging Database
  1. Search Queries
  2. Timer Jobs
  3. Feature Usage
  4. Content Import Usage
  5. Server Farm Health Data
  6. SQL blocked queries
  7. Site Inventory
  8. Search Query statistics
  9. Page Requests
  10. Site Inventory Usage
  11. Rating Usage
  12. Content Export Usage
  13. NT Events
  14. SQL high CPU/IO queries
  15. Search Crawl
  16. Query click-through

Powershell
get-command -noun spusage*
Set-SPUsageApplication -DatabaseServer <Database server name>
-DatabaseName <Database name> [-DatabaseUsername <User name>]

[-DatabasePassword <Password>] [-Verbose]
Health AnalyzerIn Central Administration, you click Monitoring and then select Health Analyzer.
Timer JobsGet-Command -noun SPTimerJob

Monday, June 22, 2015

What is Form Based Authentication?Why ?FBA Limitations?

Form Based Authentication (FBA) provides your own authentication method using a web form. More and more companies are using FBA as a way of extending a site for non-Active Directory (AD) users.

SharePoint standard installation uses as default AD to query the Domain Controller and to check user credentials through Windows Authentication. FBA uses a custom database created separate from AD to store user credentials. Authentication using FBA is executed by a SQL DB query. When FBA is used to extend SharePoint sites, external users (non AD users) have access to SharePoint.

Why would you allow access to external users? 

A practical reason for extending a SharePoint site through FBA is collaboration on documents with your clients or vendors.

FBA Limitations
Users who authenticate with FBA do not have the same level of functionality available as users who authenticate with a Windows Authentication method. Basically the client integration features would not work:

– Links that start client applications are not visible
– Documents are opened directly in the browser with no client applications support
– Users cannot edit documents on the site using the client applications. However, users can download and edit the document locally, and then upload the document back to the serve

Monday, June 15, 2015

Script to clear User Information List


while restoring site back ups, all users from orgin server would be there in destination server which requires some effort for removing. A simple SharePoint PowerShell script to clear the user information list, which in turn removes all users from all groups but not from lists
 $url = “http://sitecollection”
$web = get-spweb $url
 $list = $web.Lists["User Information List"]
 $listItems = $list.Items
 $listItemsTotal = $listItems.Count
 for ($x=$listItemsTotal-1;$x -ge 0; $x–-)
 {
 Write-Host(“DELETED: ” + $listItems[$x].name)
 remove-spuser $listItems[$x]["Account"] -web $url -confirm:$false
 }
 $web.dispose()

Thursday, June 11, 2015

Minimum requirements Development, Database Sever,Application Server or Web Server in SharePoint 2016

Below are few System Requirements for SharePoint 2016:
Scenario  Deployment type:
=====================
Processor
RAM
Hard disk
Database server running a single SQL instance
====================================
 Development  64-bit,
 4 cores
 12-16 GB
 80GB
 Database server running a single SQL instance
===============================
 QA/Production  64-bit,
4 cores
16-24 GB
  80GB  
Web server or application server in a three-tier farm
===================================
Development  64-bit,
 4 cores
 12-16 GB
 80GB
Web server or application server in a three-tier farm
====================================
 QA/Production  64-bit,
 4 cores
 16-24 GB
 80GB   

Tuesday, June 9, 2015

Hardware and Software requirements SharePoint 2016 Server?

One more important thing is there will be no SharePoint 2016 Foundation, there will be only SharePoint 2016 Server.


Overall few things are same like SharePoint 2016 requires 64 bit processor with 4 cores. And also RAM 12 to 16 GB.

Below are few System Requirements for SharePoint 2016:

Scenario
Deployment type
Processor
RAM
Hard disk
Database server running a single SQL instance
Development
64-bit, 4 cores
12-16 GB
80GB
Database server running a single SQL instance
QA/Production
64-bit, 4 cores
16-24 GB
80GB
Web server or application server in a three-tier farm
Development
64-bit, 4 cores
12-16 GB
80GB
Web server or application server in a three-tier farm
QA/Production
64-bit, 4 cores
16-24 GB
80GB

Prerequisites for SharePoint 2016:
Below are the prerequisites required to install SharePoint 2016. Like SharePoint 2013, SharePoint 2016 has a Prerequisite Installer (prerequisiteinstaller.exe) which will install the required components.

- Application Server Role, Web Server (IIS) Role.
- Microsoft SQL Server 2012 Native Client
- Microsoft ODBC Driver 11 for SQL Server
- Microsoft Sync Framework Runtime v1.0 SP1 (x64)
- Windows Server AppFabric 1.1
- Cumulative Update Package 1 for Microsoft AppFabric 1.1 for Windows Server (KB2671763)
- Microsoft Identity Extensions
- Microsoft Information Protection and Control Client 
- Microsoft WCF Data Services 5.0
- Microsoft WCF Data Services 5.6
- Microsoft .NET Framework 4.5.2
- Update for Microsoft .NET Framework to disable RC4 in Transport Layer Security (KB2898850)
- Visual C++ Redistributable Package for Visual Studio 2013

Operating System Requirement:
SharePoint Server 2016 will be supported on Windows Server 2012 R2 and Windows Server Technical Preview.

.Net Framework:
Windows Server 2012 R2: SharePoint 2016 requires .NET Framework 4.5.2
Windows Server Technical Preview "Threshold": SharePoint 16 requires .NET Framework 4.6 Preview, which comes with Windows Server Technical Preview "Threshold".

Database Requirements:
SharePoint Server 2016 requires SQL Server 2014 or SQL Server 2016.

Deployment Scenarios:
Below are the deployment Scenarios which are supported or not supported in SharePoint 2016:

Workgroup: Unsupported
Domain Controller: Developer Installation
Client OS: Unsupported
Dynamic Memory: Unsupported
Windows Web Server: Unsupported
--Copied From Google 

Removing start.aspx error or MDS Feature?

the URL with _layouts/15/start.aspx because the new feature Minimal Download Strategy is activated on your site. 


Currently in my Sharepoint Site, when I want to go to the main page sharepoint/SitePages/Home.aspx, it actually ends up going to sharepoint/_layouts/15/start.aspx#/SitePages/Home.aspx.


this Feature Improve Navigation, Fast Rendering on Client Browser, and Reduce page Loading time Because is not going to fetch Duplicate Data from Sever.


 Site Settings  Ã   Site Actions à   Manage Site Featuresà   
Deactivate Minimal Download Strategy Feature.

Wednesday, May 27, 2015

Custom css in List Items


How to activate the V2VPublishedLinks in SharePoint 2013?


Enable-SPFeature –identity V2VPublishedLinks -URL http://YourWebApp


Install-SPFeature V2VPublishedLinks

How to resolver SharePoint 2013 Literal content (' ') is not allowed within a 'System.Web.UI.UpdatePanelTriggerCollection'

The Literal content (' ') is actually an html non-breaking space that gets added when editing the page in SharePoint Designer for the first time


        

      

Remove the $nbsp; and save the page again to clear the error.

Thursday, May 21, 2015

How to check Browser Compatibility Check for Internet Explorer Versions from 5.5 to 11

IETester is a free (both for personal and professional usage) WebBrowser that allows you to have the rendering and javascript engines of IE11, IE10, IE9, IE8, IE7 IE 6 and IE5.5 on Windows 8 desktop, Windows 7, Vista and XP, as well as the installed IE in the same process. More details

Difference between the Event Receivers , Workflows and Timer Job in SharePoint 2013?

Event Recievers Workflow Timer Job
Can execute either before or after the operation Always executes after the operation We ll Add
Can cancel the operation Cannot cancel the operation as the item will have already been created We ll Add
Cannot be launched manually by the user Can be started manually by the user We ll Add
Not designed for user interaction Specifically designed for user interaction We ll Add
Can execute in response to many different actions, including deletes Can only execute in response to one of four events – Manual, an item being created, an item being edited, and an item being submitted for approval We ll Add
Must be created in Visual Studio Can be created with Visual Studio, Visio or SharePoint Designe We ll Add
Syncronous Events and Asyncronous EventsWorkflows are always async
Event handlers execute from a Particular WFE, So when some thing goes wrong in that WFE, It may end-up But Workflow Jobs are robust and can resume even after Reboots.
Usually Event handlers runs for short period Workflows can be longer even for years!
Event handlers execute from a Particular WFE, So when some thing goes wrong in that WFE, It may end-up But Workflow Jobs are robust and can resume even after Reboots.
There is no User Interface/user Interaction in Event Receivers Workflows can have user interactions such as getting user input in Initiation forms.
SharePoint Event receivers are triggered by events like New Item Adding-Added, Updating-Updated, Deleting-Deleted, etc Workflows triggered only on Creation/Change/deletion.
Event handler doesn't do such. Workflows leaves "Workflow History" logs which we can refer for debugging
Event receivers are better for large volume Workflows are better for small amount of data.

Wednesday, May 20, 2015

How to enable Save as template site in Site action Categories Site collection level using Powershell

$web = Get-SPWeb "http://spserver/sites/Raghu/"
$web.AllProperties["SaveSiteAsTemplateEnabled"] = "true"
$web.Update()

Monday, May 18, 2015

Different between Application page and Site pages In SharePoint 2013?

Site pages should always be Unghosted and Application pages should always be Ghosted
Application PagesSite Pages
  • normal asp.Net pages stored on file system
  • SharePoint Designer tool cannot be used with application pages
  • Application pages cannot be used within sandboxed solutions
  • cannot be customized and modified by end user, instead a developer is required
  • have to deploy your master page within the virtual directory or _layouts folder.
  • they are much faster Normally application pages are not web part pages
  • can only contain server controls or user controls and cannot be personalized by users
  • Easiest way to deploy your existing ASP.Net web site within SharePoint is to deploy its pages as Application Pages within SharePoint
  • Normal content pages stored in db.
  • then actual page is parsed at runtime and delivered to end-users
  • Site pages can be edited by using SharePoint Designer tool
  • Site pages are used within Sandboxed solutions.
  • A site page can be customized and modified by end user
  • One of the biggest catch of the SharePoint is the page layouts, where you can modify page once for a specific content type and then you can create multiple pages using the same page layout with different contents
  • they are at user-level not at web-application or farm level and can be customized per site level
  • If you want to add any inline code to master page, first you need to add following configuration within web.config: To add code behind to SharePoint master pages or page layouts.

Difference between Edit ,Contribute and Read SharePoint 2013 permission levels?


Edit:- Add, edit, and delete lists; view, add, update, and delete list items and documents.

- Contribute:- View, add, update, and delete list items and documents.

-Read:- Add, edit, and delete items in existing lists and document libraries. By default, this permission level is assigned to the Members group.

Thursday, April 30, 2015

Removing the BreakRoleInheritance permission list or library using Powershell


Add-PSSnapin "Microsoft.SharePoint.PowerShell"
#testname
$list = (Get-SPWeb "http://spserver/2015/").Lists["testname"]
$list.BreakRoleInheritance($true,$true)
$list.Update()

Wednesday, April 15, 2015

How to get size of all site collections using powershell Script

Get-SPSite | select url, @{label="Size in MB";Expression={$_.usage.storage/1MB}} | Sort-Object -Descending -Property "Total Size in MB" | Format-Table –AutoSize

How to set custom access denied pages in SharePoint 2013?

PowerShell Script:

We created and applied the custom Access Denied page in the web applications
1. Create the “custompages” folder in Layouts folder and WEB FRONT END server:
“c:\Program files\Common Files\Microsoft Shared\Web Server Extensions\
15\TEMPLATE\LAYOUTS\ custompages \Accessdeniederror.html”
2. Run PowerShell Command :
Set-SPCustomLayoutsPage –Identity "AccessDenied" –RelativePath
"/_layouts/15/custompages/Accessdeniederror.html" -WebApplication "http://raghuserver/"
3. Check Custom Layouts Pages Applied:
Get-SPCustomLayoutsPage –WebApplication “http://raghuserver/”
4. Run iisreset.exe.

How to send e-mail through PowerShell SharePoint Enivironment?

$email = "test@test.com"
$subject = "Test subject"
$body = "Test body"
$site = New-Object Microsoft.SharePoint.SPSite "http://sharepoint"
$web = $site.OpenWeb()
[Microsoft.SharePoint.Utilities.SPUtility]::SendEmail($web,0,0,$email,$subject,$body)






Saturday, April 11, 2015

How to create web application under each sites create Common group using PowerShell?

Powershell:
Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue
#$groupName="Emp-Directory"
#$permLevel="Edit"
function AddGroupToSite($url, $groupName, $permLevel)
{
$web = Get-SPWeb -Identity $url

$web.RootWeb.SiteGroups.Add($groupName, $web.Owner, $web.Owner, "Custom Group")
$ownerGroup = $web.SiteGroups["Finance_ACL_New_Delet"]
$ownerGroup.AllowMembersEditMembership = $true
$ownerGroup.Update()
write-host $newGroup -foregroundcolor green
$web.Update()

$web.Dispose()
}
function GenerateAllSitecollectionsInWebapplication ($url)
{
write-host "Sitecollection List Extraction started...." -foregroundcolor red
try
{
$Site=Get-SPSite $url
$spWebApp = $Site.WebApplication
$TotalList = @()
write-host "Below is the list of all sitecollections for webapplication" + $spWebApp + "..." -foregroundcolor red
foreach($allsites in $spWebApp.Sites)
{
$list = $allsites.url
write-host $list -foregroundcolor blue
AddGroupToSite -url $list -groupName "Emp-Directory" -permLevel "Edit"

}
}
catch
{
write-host "Unable to Extract Sitecollection List..." -foregroundcolor red
break
}
}
GenerateAllSitecollectionsInWebapplication -Url "http://raghuspsserver/"


How to get all site Collection, Sub-site, sub-site under the site in web Application using Powershell Script

Powershell:

Step 1 :Open the Powershell command prompt
Step 2 : Copy paste this script.
Get-SPSite -WebApplication "http://trig-o-1117:1111/" -Limit All |
Select -ExpandProperty AllWebs |
ft url, Title, Created -auto > c:\mysite.txt