Friday, March 31, 2017

Check for expired certificates using PowerShell (on multiple servers) SharePoint

$threshold = 30   #Number of days to look for expiring certificates

$deadline = (Get-Date).AddDays($threshold)   #Set deadline date

Invoke-Command -ComputerName BTGMVDCSPAPP01,BTGMVDCSPWEB01 { Dir Cert:\LocalMachine\My } | foreach {

If ($_.NotAfter -le $deadline) { $_ | Select Issuer, Subject, NotAfter, @{Label="Expires In (Days)";Expression={($_.NotAfter - (Get-Date)).Days}} }

}

Monday, November 28, 2016

People picker is showing wrong profile information

People picker that is showing wrong information about the user, some fields information is showing correct and some of them are wrong.

I updated those wrong fields information by using this below script. This below script worked for me.

WE  FIX USING POWERSHELL

First get the User ID of the person who is having the issue:

$user = Get-SPUser -Identity 'domain\username' -Web http://sharepointserver
$user.id

Then you need to navigate to the Users details in the User Information List using their user ID you just found.  This code will list all the fields for that user appearing in the User Information List

$web = Get-SPWeb http://SharePointServer
$list = $web.Lists["User Information List"]
$item = $list.GetItemById($user.id)
$list.fields | % {Write-Host "$($_.InternalName) = $($item[$_.InternalName])"}

Now you should have found the field causing the issue, so you can update it like this:

$item["FieldName"] = "  "
$item.SystemUpdate()

Note: This is a manual way of searching for the right fields to update, you will need to do this for every Web Application.





Friday, November 25, 2016

SharePoint People Picker Showing deleted AD users

The problem here is “People Picker showing deleted AD users”.

 This happens because the people picker retrieves data from multiple sources:

- User Information List (UIL)
 - Active Directory

User profile service application sync information from Active directory and updates SharePoint User Information List but it doesn't delete user from it.

we have to remove users from hidden user information list,  for Quick fix 

In SharePoint 2010:

http://your-sharepoint-site/_layouts/people.aspx?MembershipGroupID=0

In SharePoint 2013:

<URL>/_layouts/people.aspx?MembershipGroupId=0
or
<URL>/_layouts/15/people.aspx?MembershipGroupId=0

You can now select the user and click on “Actions –> Delete Users from Site Collection

PowerShell Script to fix SharePoint People Picker Showing Deleted Users:

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Define the Array with List of Users
$Users =@('Domain\abc', 'Domain\xyz')

#Get all Site Collections
$SiteColl = Get-SPWebApplication "Web application url" | Get-SPSite -Limit All

#Iterate through all Site Collections
foreach($site in $SiteColl)
{
 #Iterate through the users to Remove
 foreach($user in $Users)
 {
   #Check if User Exists in Site
   if ($Site.RootWeb.SiteUsers | Where {$_.LoginName -eq $User})
   {
      $Site.RootWeb.SiteUsers.Remove($User)  #You can also use: Remove-SPUser cmdlet
   Write-Host "$($user) has been Removed from $($Site.RootWeb.URL)"
   }
  }
  
}

Monday, November 21, 2016

we increase the maximum size of a list templates in SharePoint 2010

When we try to save document library as template we get an error If the document library is big. It will give an error like below,

'The list is too large to save as a template. The size of a template cannot exceed 52428800 bytes.'. 

By default the size limit is 50 MB in SharePoint 2010 and SharePoint 2103

We can increase the list template size by running this below stsadm command in PowerShell.

stsadm -o setproperty -propertyname max-template-document-size -propertyvalue 100000000

This is for  increasing limit to 100 MB.









Friday, November 18, 2016

The data types of the following form fields do not match the SharePoint list

When you have a custom InfoPath form applied to a SharePoint 2010 list, when you try to edit or create an item in the list.It may throw error like below,

Error Message: The data types of the following form fields do not match the SharePoint list: ListFieldName

This issue causes because of If you have tried to modify the form recently, due to missing or extra field  in your SharePoint list.

 Resolution is simple here:

 If you go into your  SharePoint List Settings, and then to Form Settings and then select the Radio button one that shows Use the default SharePoint form. This would resolves the issue.



Wednesday, November 16, 2016

Enable and disable the Dashboard with SharePoint 2010 Developer

SharePoint 2010 Developer Dashboard

Developer dashboard can be used to check the performance and trace information, it can be used to debug and troubleshoot issues with page rendering time.  The dashboard is turned off by default, but can be enabled using stsadm.

 When the dashboard is turned on you will find information about the controls, queries and execution time that occur as part of the page rendering process; this information appears at the bottom of the page.

Run these below commands on PowerShell to set it to On/Off

To set it to On:
stsadm -o setproperty -propertyname developer-dashboard -propertyvalue On

To set it to Off:
stsadm -o setproperty -propertyname developer-dashboard -propertyvalue Off


Tuesday, October 18, 2016

You cannot access a WebDAV Web folder from a Windows-based client computer



Unable to browse large document library in explorer view


When Users are  trying to open SharePoint document library with many files(If document library contains more than 10,000 items) using explorer view they may get the following error message:

  \\server\webfolder\folder is not accessible. You might not have permission to
use this network resource.
Contact the administrator of this server to find
out if you have access permissions.

A device attached to the system is not functioning.


Solution:

To work around this problem, you need to modify the windows registry on the client computer.

Click Start, click Run, type regedit, and then click OK.
Locate and then click the following registry subkey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters\
Value:
FileAttributesLimitInBytes
Data Type: DWORD
Default Value: 1,000,000
decimal (1 MB)

Change the default value to a larger number, e.g. 100000000 for 100mb.

Exit Registry Editor

Restart WebClient service,

net stop webclient
net start webclient