Enable list and library Versions using PowerShell Script except the hidden lists

Enable list and library Versions using PowerShell Script  except the hidden lists
Using this script we can Enable Version with Major Version Limit under site content(Only visible list, not hidden list) all list and library

Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue

$web = get-spsite "https://dotnetsharepoint.com/"

# For All Sub Sites
foreach ($spWeb in $web.AllWebs)
{
$lists = $spWeb.lists
foreach ($list in $lists)
{
#Only visible list under site contents
if(!$list.Hidden)
{
    # Enabling version   
    if($list.EnableVersioning -eq $false)
    {  
         write-host $list.title "Version Enabled for this site"
         $list.Enableversioning = $true
         $List.MajorVersionLimit = 5
         $list.update()
    }
}

}

}

Export user list from SharePoint groups using PowerShell script

Export user list from SharePoint groups using PowerShell script
 We can get all users from all groups in SharePoint using below script. Using the below script we can get sub rooms users also.
  
Add-PsSnapin Microsoft.SharePoint.PowerShell


$URL= "https://Dotnetsharepoint.com"

     $site = Get-SPSite $URL
   
     #Write the Header to "Tab Separated Text File"
        "Site Name `t Group Name `t User Name “| out-file "D:\SPUsersList.xslx"
       
     #Iterate through all Webs (All Sub rooms)
      foreach ($web in $site.AllWebs)
      {
        #Write the Header to "Tab Separated Text File"
        "$($web.title) `t" | out-file "D:\SPUsersList.xslx" -append

         #Get all Groups  
         foreach ($group in $Web.groups)
         {
                "`t `t $($Group.Name)" | out-file "D:\SPUsersList.xslx" -append
             
                        foreach ($user in $group.users)
                        {
                           #Exclude Built-in User Accounts                            

                                "`t `t `t $($user.name)" | out-file "D:\SPUsersList.xslx" -append
                        }
         }
     }

    write-host "Report Generated at D:\SPUsersList.xlsx"