December 10, 2013

Find All Checked-Out Files and Checked-In Files by Power Shell Script

Copy following code in power shell file and run it as administrator:-
   1:   [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
   2:  #Region MOSS2007-CmdLets
   3:  Function Get-SPWebApplication()
   4:  {  
   5:    Param( [Parameter(Mandatory=$true)] [string]$WebAppURL )
   6:    return [Microsoft.SharePoint.Administration.SPWebApplication]::Lookup($WebAppURL)
   7:  }
   8:  Function global:Get-SPSite()
   9:  {
  10:    Param( [Parameter(Mandatory=$true)] [string]$SiteCollURL )
  11:     if($SiteCollURL -ne '')
  12:      {
  13:      return new-Object Microsoft.SharePoint.SPSite($SiteCollURL)
  14:     }
  15:  }
  16:  Function global:Get-SPWeb()
  17:  {
  18:   Param( [Parameter(Mandatory=$true)] [string]$SiteURL )
  19:    $site = Get-SPSite($SiteURL)
  20:          if($site -ne $null)
  21:              {
  22:                $web=$site.OpenWeb();
  23:              }
  24:      return $web
  25:  }
  26:  #EndRegion
  27:   Function GetCheckedOutFiles()
  28:   {  
  29:      #Define 'Web Application URL' as Mandatory Parameter
  30:      Param( [Parameter(Mandatory=$true)] [string]$WebAppURL )
  31:      $WebApp=Get-SPWebApplication($WebAppURL)
  32:      #Write the CSV Header - Tab Separated
  33:   "Site Collection Name `t Site Name`t Library `t File Name `t File URL `t  Last Modified `t Checked-Out By" | out-file CheckedOutFiles.txt
  34:    write-host "start..."
  35:   #Arry to Skip System Lists and Libraries
  36:   $SystemLists =@("Converted Forms", "Master Page Gallery", "Customized Reports", "Form Templates", 
  37:                   "List Template Gallery", "Theme Gallery", "Reporting Templates",  "Solution Gallery",
  38:             "Style Library", "Web Part Gallery","Site Assets", "wfpub")
  39:     #Loop through each site collection
  40:    foreach($Site in $WebApp.Sites)
  41:     {
  42:      #Loop through each site in the site collection
  43:       foreach($Web in $Site.AllWebs)
  44:     {
  45:              #Loop through each document library
  46:              foreach ($List in $Web.GetListsOfType([Microsoft.SharePoint.SPBaseType]::DocumentLibrary))
  47:              {
  48:                  #Get only Document Libraries & Exclude Hidden System libraries
  49:                  if ( ($List.Hidden -eq $false) -and ($SystemLists -notcontains $List.Title) )
  50:                  {
  51:       #Loop through eadh Item
  52:        foreach ($ListItem in $List.Items)
  53:        {
  54:                    if( ($ListItem.File.CheckOutStatus -ne "None") -and ($ListItem.File.CheckedOutByUser -ne $null))
  55:        {
  56:                         #Log the data to a CSV file where versioning size > 0MB!
  57:                          "$($Site.RootWeb.Title) `t $($Web.Title) `t $($List.Title) `t $($ListItem.Name) `t $($Web.Url)/$($ListItem.Url) `t  $($ListItem['Modified'].ToString()) `t  $($ListItem.File.CheckedOutByUser)" | Out-File CheckedOutFiles.txt -Append
  58:         #*** Uncomment the below line to Check-in****#
  59:         $ListItem.File.Checkin("Checked in by Administrator")
  60:                 write-host $ListItem.Name
  61:        }
  62:                      }
  63:                  }
  64:              }
  65:     $Web.Dispose()         
  66:          }
  67:   $Site.Dispose()         
  68:      }
  69:      write-host "Checked out Files Report Generated Successfully!"
  70:  }
  71:  #Call the Function to Get Checked-Out Files
  72:  Write-Host "Enter the Web Application URL:"
  73:  $WebAppURL= Read-Host
  74:  GetCheckedOutFiles $WebAppURL 

If you have any questions you can reach out our SharePoint Consulting team here.

What Doesn’t Migrate with SharePoint Built in Import/Export and other known issues

​Item created by, created date, last modified date
Workflows (Definitions)
Workflow State & Tasks
Workflow History
Check in/check out state
Audit logs
Usage Logs that have not been processed
List configuration/app configuration
Site collection settings (Site Collection Ownership, Quota, email notification settings and a lot more)
Personalized views
Alerts
Recycle bin state/items including admin and user Recycle bin items
Lookup lists have issues due to remapping of object GUIDs
Object GUIDS are not preserved (This causes all sorts of weird things and can cause issues down the road. Empty folders may not migrate) This includes using import/export in STSADM or Windows Powershell, SOAP or Web services as well both result in loss of object id consistency including reparenting. The only way to avoid this is using the Content Migration object model.
Empty objects may not migrate (Discussion lists may have some problems related to this, and some folder structures may be remapped.)
Users that no longer exist are removed during import/export (related to ownership being re-written)
Surveys that are not completed will not be exported
Global Navigation inheritance issues (parenting challenges)
Known issues with conflicts when used with content deployment
No migration of features, solutions or assemblies associated with site/web (Must be manually migrated if separate farm and exist on destination)
Content overwritten if exists
Site dependencies on Site Collection Gallery lists (example if you migrate a web the parent site collection may have galleries that the web uses i.e. galleries include some look and feel, masterpages, images, features, and webparts.) known to have issues (Need more detail)
No list level migration (granularity is site level in 2007; Windows Powershell SharePoint Cmdlet in 2010 gives you list level) Thanks @toddklindt
Scale limitations (reliability goes down the larger the site <25gb add="" as="" best="" br="" case="" compression="" database="" databases="" dedicated="" exports="" fidelity="" higher="" if="" increases="" is="" it="" large="" likelihood="" migration="" no="" note:="" parameter="" that="" the="" will="" work.="" you=""> Portal Template Global Nav known to have issues (Need detail. Problem appears to be associated with site collection property loss)
Security remapping AD group challenges for groups between 2 untrusted forests
Versions of aspx pages (Need more detail)
Can’t change site template during migration
Can’t consolidate sites during migration
No good list of what fails to import
blocked file types
files over max file size
Objects that don’t contain objects may not be migrated (See comments in Gary LaPointe’s Export lists blog)
Post migration sync (No way to migrate again. If template already chosen or not blank)
No support between farms of different builds and versions. Have to be exact same version number (This may be different in 2010).
No ability to target a specific content without manual intervention (limiting all others or setting capacity high)
You can experience problems if you re-run Stsadm on site content that has already been imported. If that occurs, all list items that are not document libraries are duplicated on the target site.​


If you have any questions you can reach out our SharePoint Consulting team here.