Thursday 31 December 2015

Blob Cache in SharePoint 2013

Hey Hi,

Its been so much time, that i did not put a new useful blog on my site related to SharePoint.
So Today, we gonna talk about, what is Blob Cache? How to Enable it?  etc...

Lets Talk About it...

1.What is Blob Cache?

Disk-based Caching for Binary Large Objects
Disk-based caching controls caching for binary large objects (BLOBs) such as image, sound, and video files, as well as code fragments. Disk-based caching is extremely fast and eliminates the need for database round trips. BLOBs are retrieved from the database once and stored on the Web client. Further requests are served from the cache and trimmed based on security.

2.Enabling and modifying disk-based caching for SharePoint sites.

Disk-based caching is disabled by default. To enable and customize the disk-based cache, you must modify the following statement in the web.config file for the SharePoint Web application.
By default, it looks like this:
<BlobCache location="C:\blobCache" path="\.(gif|jpg|png|css|js)$" maxSize="10" enabled="false" />
In order to improve the performance of your site, the BlobCache should be enabled.
<BlobCache location="C:\blobCache" path="\.(gif|jpg|png|css|js)$" maxSize="10" enabled="true" />
Example:
<BlobCache location="C:\blobCache" path="\.(gif|jpg|png|css|js)$" maxSize="10" max-age="86400" enabled="false"/>
In the preceding example:
• location is the directory where the cached files will be stored
• path specifies in the form of a regular expression which files are cached based on the file extension
• maxSize is the maximum allowable size of the disk-based cache in gigabytes
• max-age specifies the maximum amount of time in seconds that the client browser caches BLOBs downloaded to the client computer. If the downloaded items have not expired since the last download, the same items are not re-requested when the page is requested. The max-age attribute is set by default to 86400 seconds (that is, 24 hours), but it can be set to a time period of 0 or greater.
• enabled is a Boolean that disables or enables the cache.

3. Flushing the Disk-based Cache:

We can flush the current site collection object cache. To do this, browse to the following location on the web site,
Site collection administration -> site collection object cache -> disk based cache reset.
If we have multiple WFEs in the farm, each WFE will maintain its own copy of Disk-based Cache. SharePoint does not have a Web user interface (UI) to flush the disk-based cache on all the servers in a farm and neither is there an option to select a specific WFE.

4.The option provided in the Administration page for flushing the cache is only to the flush the cache on the web front end to which you are currently browsing. 


if you would like to flush the complete binary large object (BLOB) caches associated with a specific Web Application on different Web front-end computers in a farm, then you can use the STSADM command to do so.
STSADM -o setproperty -propertyname blobcacheflushcount -propertyvalue 11 -url http://mywebapp:port

5.Internals of the blob cache functionality within SharePoint:

After enabling blob cache in web.config, do an IISRESET and browse to the /settings.aspx first, instead of home page (Collaboration portal site).
When we browse to the settings.aspx, it will create the following files change.bin, dump.bin and flushcount.bin (all the files will be 1KB in size).
Browse to the home page now, it will create a folder PUBLISHINGIMAGES, all the images rendered from the database will be stored here and the above bin files will also get updated (we can see the difference in file size).
Every time when a new image file is rendered from the database, the image folder gets a copy of the image. The bin files (index) will get updated with an additional entry for the new file.
Every request from client will check the index file first. It will only check the cache index and not the image folder directly for the image. If the index file does not have an entry for the image, then the request is served from the database. During this time, a copy of the image will be stored in the images folder and the index file also gets updated, so that the next request will not go to the database.

6.What happens I manually delete just the image file in the cache folder or the image file in the cache folder gets corrupted?

We will not see the image on the client page; we get a broken image ‘X’.

7.How are these cache files stored?

Filename.extension.cache is the file naming format.

8.What can I do if the cached file gets corrupted?

Recommendation: We can reset the index file. Site settings -> Site collection object cache -> Check the box for “Force this server to reset its disk based cache”. It will completely delete all the images and reset the bin files back to 1KB, so that next request will go to database and the complete index will get rebuilt.
Workaround: If you do not want to reset the complete index. Find out the missing image and copy just that file to the cache folder, name it as “filename.extension.cache”
Refresh the page now; it should pick up the image.

9.How is the Index file maintained?

Every time when the web.config initializes, the index file is loaded from the blobcache folder to memory. All new entries will keep getting updated in index file when in memory.
IISRESET /stop will flush the updated index file from memory to disc within the blobcache folder.
IISRESET /start will load the index file from blobcache folder to memory.
As long as the application pool is alive the index file will be getting updated in memory itself.

10.Can an Index file get corrupt?

Index file corruption is possible only when IIS crash or the index file is overwritten with wrong information. When IIS tries to load the index file from blobcache to memory and identifies that it is a corrupted file (not a valid file), it will get completely rebuilt (flush) as fresh file (1KB), all the old entries and images will be lost.

11.In a farm environment, is there any way of having all the WFEs' blob caches synchronized among each other?

No, this cannot be done because SharePoint maintains the index and the cache files individually on each server.

12.In a single WFE environment using web gardening, how does blob caching function? Is there any sync that happens among the working processes?

Web gardening is not supported.

13.What would be the best way of using blob cache in a farm environment (best practices)?


If the requirement is to “centralize” static cached files, then 3rd party content distribution network (CDN) solutions like Akamai need to be used.
What are the limitations of SharePoint and blob caching in a farm environment?
a. Blob caching does not work with Web Gardening.
b. Blob caching does not synchronize data across WFEs – so we might be seeing different versions of the files for a short duration across different WFE servers.
Ported from http://blogs.msdn.com/b/selvagan/archive/2008/12/11/blobcache-moss.aspx

Sunday 1 November 2015

List column validation for special character in SharePoint (for any list eg Survey list, Discussion board list etc..)

Dear Pal,

A very useful article for validating the column for special characters. 

Step 1: Open Column Settings for which column you want to add the validations:
List Settings > Change Column > Column Validation (below Column Settings) 
Step 2: Add the following code at the Column Validation:
=AND(IF(ISERROR(FIND(",",[ColumnName])),TRUE),IF(ISERROR(FIND("&",[ColumnName])),TRUE),IF(ISERROR(FIND("!",[ColumnName])),TRUE),IF(ISERROR(FIND("@",[ColumnName])),TRUE),IF(ISERROR(FIND("~",[ColumnName])),TRUE),IF(ISERROR(FIND("#",[ColumnName])),TRUE),IF(ISERROR(FIND("$",[ColumnName])),TRUE),IF(ISERROR(FIND("%",[ColumnName])),TRUE),IF(ISERROR(FIND("*",[ColumnName])),TRUE),IF(ISERROR(FIND("(",[ColumnName])),TRUE),IF(ISERROR(FIND(")",[ColumnName])),TRUE),IF(ISERROR(FIND("-",[ColumnName])),TRUE),IF(ISERROR(FIND("+",[ColumnName])),TRUE),IF(ISERROR(FIND(":",[ColumnName])),TRUE),IF(ISERROR(FIND(";",[ColumnName])),TRUE),IF(ISERROR(FIND("[",[ColumnName])),TRUE),IF(ISERROR(FIND("]",[ColumnName])),TRUE),IF(ISERROR(FIND(".",[ColumnName])),TRUE),IF(ISERROR(FIND("/",[ColumnName])),TRUE),IF(ISERROR(FIND("\",[ColumnName])),TRUE))


Step 3: Type the User Message

for eg: Invalid character or Special Character not allowed. 

Cheers, Enjoy !!

Friday 30 October 2015

Common Date/Time formulas for Sharepoint – Calculated Fields using Calculated column

Calculate Date -  depends on the week and weekends:

=IF(WEEKDAY(Created)<4,Created+3,IF(WEEKDAY(Created)=4,Created+5,Created+4))

Example :-

If suppose you have submitted the form on 22nd May(Tuesday) then task completion date will be 25th May (Friday).
If  form is submitted on 24th May (Thursday) then the task completion date will be 28th May(Monday).
Same as if form submitted on 25th May (Friday) then the task completion date will be 29th May(Tuesday).


Get Week of the year

=DATE(YEAR([Start Time]),MONTH([Start Time]),DAY([Start Time]))+0.5-WEEKDAY(DATE(YEAR([Start Time]),MONTH([Start Time]),DAY([Start Time])),2)+1

First day of the week for a given date:

=[Start Date]-WEEKDAY([Start Date])+1

Last day of the week for a given date:

=[End Date]+7-WEEKDAY([End Date])

First day of the month for a given date:

=DATEVALUE(“1/”&MONTH([Start Date])&”/”&YEAR([Start Date]))

Last day of the month for a given year (does not handle Feb 29). Result is in date format:

=DATEVALUE (CHOOSE(MONTH([End Date]),31,28,31,30,31,30,31,31,30,31,30,31) &”/” & MONTH([End Date])&”/”&YEAR([End Date]))
Day Name of the week : e.g Monday, Mon
=TEXT(WEEKDAY([Start Date]), “dddd”)
=TEXT(WEEKDAY([Start Date]), “ddd”)

The name of the month for a given date – numbered for sorting – e.g. 01. January:

=CHOOSE(MONTH([Date Created]),”01. January”, “02. February”, “03. March”, “04. April”, “05. May” , “06. June” , “07. July” , “08. August” , “09. September” , “10. October” , “11. November” , “12. December”)

Get Hours difference between two Date-Time :

=IF(NOT(ISBLANK([End Time])),([End Time]-[Start Time])*24,0)

Date Difference in days – Hours – Min format : e.g 4days 5hours 10min :

=YEAR(Today)-YEAR(Created)-IF(OR(MONTH(Today)<MONTH(Created),AND(MONTH(Today)=MONTH(Created),
DAY(Today)<DAY(Created))),1,0)&” years, “&MONTH(Today)-MONTH(Created)+IF(AND(MONTH(Today)
< =MONTH(Created),DAY(Today)<DAY(Created)),11,IF(AND(MONTH(Today)<MONTH(Created),DAY(Today)
> =DAY(Created)),12,IF(AND(MONTH(Today)>MONTH(Created),DAY(Today)<DAY(Created)),-1)))&” months,
“&Today-DATE(YEAR(Today),MONTH(Today)-IF(DAY(Today)<DAY(Created),1,0),DAY(Created))&” days”

You can get Get more formulas from :-

http://office.microsoft.com/en-us/sharepointtechnology/HA011609471033.aspx

OR

http://msdn.microsoft.com/en-us/library/bb862071.aspx
 

Tuesday 13 October 2015

Move your Site Collection from One Content Database to another Content Database

Hi Friends,

It’s a question that comes up in every deployment of SharePoint: Should I have many site collections or one site collection with many sub sites?  My definitive answer: “It depends”.  

Under some circumstances, you might want to move one or more site collections to a different content database. For example, a site collection can outgrow the content database on which it resides on, and you would have to move the site collection to a larger content database. On the flip side, if site collections are too small in size you may want to combine several site collections onto one content database. 

Prerequisites:

User Account
  • The user account running the below process needs access to s server running Windows PowerShell 2.0 and a member of the following groups
  • The db_owner fixed database role and the SharePoint_Shell_Access role in the SQL Server source content database, administration content database, destination content database, and configuration database.
  • The WSS_ADMIN_WPG group on the local computer.
For this process to work, the following must be true
  • The destination content database must already exist.
  • The source content database and destination content database must be located on the same instance of SQL Server.
  • The source content database and destination content database must be attached to the same Web application.
The Steps
  • Add a content databae to a web application by using Windows PowerShell – This is obviously optional if you may want to copy the site collection to an existing content database
  • Move your site collection to another content database
To add a content database to a web application by using windows PowerShell
  • Start SharePoint 2010 Management Shell
  • Type in the following command
New-SPContentDatabase -Name <ContentDbName> -WebApplication <WebApplicationName>
  • Replace <ContentDbName> with the name of the content database to create
  • Replace<WebApplicationName> with the name of the Web application to which the new database is attached.
To move your site collection to another database:
  • At the Windows PowerShell command prompt, type the following command:
Move-SPSite <http://ServerName/Sites/SiteName> -DestinationDatabase <DestinationContentDb>
  • Replace<http://ServerName/Sites/SiteName> with the name of the site collection.
  • Replace <DestinationContentDb> with the name of the destination content database.
To move multiple site collections fron one content database into another:
  • At the Windows PowerShell command prompt, type the following command:
Get-SPSite -ContentDatabase <SourceContentDb> | Move-SPSite -DestinationDatabase <DestinationContentDb>
  • Replace <SourceContentDb> with the name of the original content database.
  • Replace <DestinationContentDb> with the name of the destination content database.

Saturday 19 September 2015

Social Icon for Bloggers

Asalamalekum,

Hope you guys are very well..

Today, I will be blogging apart from SharePoint Topic and to add Social Icon widgets to your blogs.

This is how its gonna look like
SOCIAL ICONS WHICH YOU CAN DISPLAY ON YOUR BLOGS









 











Just go to your blog account under Layout --> Add Gadget --> Select HTML/JavaScript
and add the below code

<style>
#sidebar-subscribe-box{width:270px;border:0px solid #aaa;border-radius:0px;padding:0px 0}
 .sidebar-subscribe-box-wrapper{repeat scroll 0 0 #f7f7f7;color:#ffff;font-size:14px;line-height:20px;padding:1px 5px 5px;text-align:center;text-transform:uppercase}
 .sidebar-subscribe-box-form{clear:both;display:block;margin:5px 0}form.sidebar-subscribe-box-form{clear:both;display:block;margin:5px 0 0;width:auto}
 .sidebar-subscribe-box-email-field{-moz-border-radius:4px;-webkit-border-radius:4px;background:#fff url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWXFO1K8jEFWeEjnSvYWf2K_BMrPSffWJ2hQ94IBegJldIYQfL0aoHqwfzQmXzwrPzmrDnauzvUiRaHo_oYxRwPSh1uU6lgwJQiFnxJ6Ci3Ayx_3mrL3Wmc0Zx-JNaddbhsuPNsJXTLo/s1600/icons.png) no-repeat 0 -27px;border:1px solid #ccc;border-radius:4px;color:#444;margin:0 0 15px;padding:10px 40px;width:50%}
 .sidebar-subscribe-box-email-button{background:#09f;border:1px solid #007fff;box-shadow:0 1px 0 rgba(255,255,255,0.3) inset, 0 1px 0 transparent;color:#fff;cursor:pointer;font-family:verdana;font-weight:700;padding:10px;text-shadow:1px 1px 0 rgba(0,0,0,.4);text-transform:uppercase;width:100%}
 .sidebar-subscribe-box-email-button:hover,.sidebar-subscribe-box-email-button:focus{background:#1ca4ff}
 .sidebar-subscribe-box-email-button:active{-moz-box-shadow:0 1px 4px rgba(0,0,0,0.5) inset;-webkit-box-shadow:0 1px 4px rgba(0,0,0,0.5) inset;box-shadow:0 1px 4px rgba(0,0,0,0.5) inset;outline:0}iframe,object,embed,.yt-border iframe,.yt-border object,.yt-border embed,table{width:100%}embed{border-radius:3px;-moz-box-shadow:0 2px 4px rgba(0,0,0,0.2);-webkit-box-shadow:0 2px 4px rgba(0,0,0,0.2);background:#FFF;border:1px solid #ddd;box-shadow:0 2px 4px rgba(0,0,0,0.2);margin:0;padding:4px 4px 4px}
 #footer-section{border-top:1px solid #aaa;box-shadow:inset 0 4px 6px -3px #aaa;font-family:cambria;font-size:14px;height:100px;margin:10px -30px 5px;padding:0 30px;text-align:center;width:100%}
a.social-icons{margin-right: 5px;height:45px;width:45px;}
a.social-icons:hover { opacity: .7; filter:alpha(opacity=70);}
</style>

<div id="sidebar-subscribe-box">
<div class="sidebar-subscribe-box-wrapper">
    <br/>
<a class="social-icons" href="https://facebook.com/SabinaTechDiary"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgX2DruC8BXOFGo1U1fNFtXp_ZRm3mN0jsCagSz_AR2oIyPauCZ7OTrfsweuBl1uG0gbY36vzOTnOHOQMN0z_CeoO_suoMMP2CuZVmrxRhbd5Gkt27hi7AG2iOoqiijBIJHRmINCQ6CHcu/s1600/SabinaTechDiary-facebook.png" /></a>
<a class="social-icons" href="https://twitter.com/SabinaTechDiary"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiluZqb7r4OxBO-I115T6eD-wRM4J1PlXfeCIUshDBeJgTKTGf5GV3Wy2WZ7jR7cotURXd03iflWPLhC3-S3JlelKdD7LZb5yW4dMVsZ_vtP3WwTIq4qX76guI_XZaA65bsljXRd-7DWTtI/s1600/SabinaTechDiary-twitter.png" /></a>
<a class="social-icons" href="https://plus.google.com/+sabinaAnsariLife/posts"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6o5avXd9Wo0wIpuqe21jiOlKt5oZlNGzm0gDqrQMpf9yDISgHknZWtCtSzZ1sezMspehHseWSNQs2qZ_-y2174eh_jB7Fb3BdNa-nXgkZNDOQ8Q7DXChSLpcEmfItY15y-ei-VXevgJ9l/s1600/Bloggertrix-Googleplus.png" /></a>
<a class="social-icons" href="http://www.feedburner.com/bloggertrix"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmcbFNZQDffeuP72lqgIXoyse5HZWL-A3yWVbXwWXgKzjlh4aG3B7gOUCuHdtBrqfxj2y8SJE1CJdZPnpb2vps9EQk6ubtNqR31fEcrNAP4P6Be-T5oq3_SV8qcB5yC5NKoLwdduBvTqda/s1600/Bloggertrix-Rss.png" /></a>
</div></div>


Thats it for this post..

Enjoy!!

Allahafiz.. 

Friday 28 August 2015

User Permission Report for SharePoint 2013 (single user acces on list, library, site)

Hi Frnds,

I am a back with a very useful blog that you might be struglling in SharePoint Enviromenet.
Yes I have been talking about the user access report on all the site, list, library for a particular webapplication.

Manually going in each site, list and library may takes a lot of time. why cant we quickly take help of the most powerfull tool (Powershell)

With the below code, you can generate a csv file which you can use it for getting report for a single user.

You will require:

SharePoint Powershell
Admin Right (Run the powershell as a administrator)


Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
  
Function GetUserAccessReport($WebAppURL, $SearchUser)
{
    #Output Report location
    $OutputReport = "C:\Report\SabinaPermission.csv"
    #Please delete the file, If already exist!
    if (Test-Path $OutputReport)
     {
        Remove-Item $OutputReport
     }
Write-host "I am scanning Farm Administrator Group..."
#Write CSV- TAB Separated File) Header
"URL `t Site/List `t Title `t PermissionType `t Permissions" | out-file $OutputReport
  
  ####Check Whether the Search Users is a Farm Administrator ###
  #Get the SharePoint Central Administration site
  $AdminWebApp= Get-SPwebapplication -includecentraladministration | where {$_.IsAdministrationWebApplication}
    $AdminSite = Get-SPweb($AdminWebApp.Url)
    $AdminGroupName = $AdminSite.AssociatedOwnerGroup
    $FarmAdminGroup = $AdminSite.SiteGroups[$AdminGroupName]
  
 #enumerate in farm adminidtrators groups
    foreach ($user in $FarmAdminGroup.users)
    {
     if($user.LoginName -eq $SearchUser)
     {
       "$($AdminWebApp.URL) `t Farm `t $($AdminSite.Title)`t Farm Administrator `t Farm Administrator" | Out-File $OutputReport -Append
     }    
    }
  
Write-host "I am Scanning Web Application Policies..."
 ### Check Web Application Policies ###
  $WebApp= Get-SPWebApplication $WebAppURL
  
  foreach ($Policy in $WebApp.Policies)
  {
      #Check if the search users is member of the group
     if($Policy.UserName -eq $SearchUser)
       {
       #Write-Host $Policy.UserName
        $PolicyRoles=@()
       foreach($Role in $Policy.PolicyRoleBindings)
       {
        $PolicyRoles+= $Role.Name +";"
       }
       #Write-Host "Permissions: " $PolicyRoles
      "$($AdminWebApp.URL) `t Web Application `t $($AdminSite.Title)`t  Web Application Policy `t $($PolicyRoles)" | Out-File $OutputReport -Append
   }
  }
 Write-host "I am Scanning Site Collections..."
 #Get All Site Collections of the WebApp
 $SiteCollections = Get-SPSite -WebApplication $WebAppURL -Limit All
     
  #Loop through all site collections
   foreach($Site in $SiteCollections)
    {
     Write-host "I am Scanning Site Collection:" $site.Url
     #Check Whether the Search User is a Site Collection Administrator
     foreach($SiteCollAdmin in $Site.RootWeb.SiteAdministrators)
        {
      if($SiteCollAdmin.LoginName -eq $SearchUser)
      {
       "$($Site.RootWeb.Url) `t Site `t $($Site.RootWeb.Title)`t Site Collection Administrator `t Site Collection Administrator" | Out-File $OutputReport -Append
      }    
    }
    
     #Loop throuh all Sub Sites
  foreach($Web in $Site.AllWebs)
  {
      if($Web.HasUniqueRoleAssignments -eq $True)
            {
             Write-host "I am Scanning Site:" $Web.Url
     
            #Get all the users granted permissions to the list
              foreach($WebRoleAssignment in $Web.RoleAssignments )
    {
                 #Is it a User Account?
          if($WebRoleAssignment.Member.userlogin)  
           {
              #Is the current user is the user we search for?
              if($WebRoleAssignment.Member.LoginName -eq $SearchUser)
             {
               #Write-Host  $SearchUser has direct permissions to site $Web.Url
               #Get the Permissions assigned to user
       $WebUserPermissions=@()
                foreach ($RoleDefinition  in $WebRoleAssignment.RoleDefinitionBindings)
                {
                 $WebUserPermissions += $RoleDefinition.Name +";"
                }
               #write-host "with these permissions: " $WebUserPermissions
           
         #Send the Data to Log file
               "$($Web.Url) `t Site `t $($Web.Title)`t Direct Permission `t $($WebUserPermissions)" | Out-File $OutputReport -Append
             }
           }
        #Its a SharePoint Group, So search inside the group and check if the user is member of that group
         else
          {
                        foreach($user in $WebRoleAssignment.member.users)
                            {
                #Check if the search users is member of the group
               if($user.LoginName -eq $SearchUser)
                {
                  #Write-Host  "$SearchUser is Member of " $WebRoleAssignment.Member.Name "Group"
                  #Get the Group's Permissions on site
                $WebGroupPermissions=@()
                  foreach ($RoleDefinition  in $WebRoleAssignment.RoleDefinitionBindings)
                  {
                      $WebGroupPermissions += $RoleDefinition.Name +";"
                     }
                #write-host "Group has these permissions: " $WebGroupPermissions
                
               #Send the Data to Log file
               "$($Web.Url) `t Site `t $($Web.Title)`t Member of $($WebRoleAssignment.Member.Name) Group `t $($WebGroupPermissions)" | Out-File $OutputReport -Append
              }
             }
     }
    }
      }
      
    ###*****  Check Lists with Unique Permissions *******###
   foreach($List in $Web.lists)
   {
             if($List.HasUniqueRoleAssignments -eq $True -and ($List.Hidden -eq $false))
                {
                 Write-host "Scanning List:" $List.RootFolder.Url
                    #Get all the users granted permissions to the list
     foreach($ListRoleAssignment in $List.RoleAssignments )
                    {
                     #Is it a User Account?
             if($ListRoleAssignment.Member.userlogin)  
              {
                 #Is the current user is the user we search for?
                 if($ListRoleAssignment.Member.LoginName -eq $SearchUser)
                {
                  #Write-Host  $SearchUser has direct permissions to List ($List.ParentWeb.Url)/($List.RootFolder.Url)
                  #Get the Permissions assigned to user
                   $ListUserPermissions=@()
                    foreach ($RoleDefinition  in $ListRoleAssignment.RoleDefinitionBindings)
                    {
                                 $ListUserPermissions += $RoleDefinition.Name +";"
                                }
                  #write-host "with these permissions: " $ListUserPermissions
               
                  #Send the Data to Log file
                  "$($List.ParentWeb.Url)/$($List.RootFolder.Url) `t List `t $($List.Title)`t Direct Permissions `t $($ListUserPermissions)" | Out-File $OutputReport -Append
                }
              }
              #Its a SharePoint Group, So search inside the group and check if the user is member of that group
             else
              {
       foreach($user in $ListRoleAssignment.member.users)
       {
                   if($user.LoginName -eq $SearchUser)
                    {
                     #Write-Host  "$SearchUser is Member of " $ListRoleAssignment.Member.Name "Group"
                      #Get the Group's Permissions on site
                    $ListGroupPermissions=@()
                      foreach ($RoleDefinition  in $ListRoleAssignment.RoleDefinitionBindings)
                      {
                                  $ListGroupPermissions += $RoleDefinition.Name +";"
                                 }
                    #write-host "Group has these permissions: " $ListGroupPermissions
                
                    #Send the Data to Log file
                    "$($Web.Url) `t Site `t $($List.Title)`t Member of $($ListRoleAssignment.Member.Name) Group `t $($ListGroupPermissions)" | Out-File $OutputReport -Append
                  }
                }
             }
                    }
                }
            }
     }
 }
      
 Write-host "`n Access Rights Report Generated!"
 }
  
#Call the function to Check User Access
GetUserAccessReport "http://Yoursharepointname.com" "i:0#.w|sharepoint\Sabina"

it will generate a tab separated CSV file.

as belolow

Credit goes to Salaudeen Rajack Rereferenced from Salaudeen SharePointDiary  

Isnt it simple !! Cheers!!