Script to get COunt for all workflow history list from all sites present in CSV

sns 9,241 Reputation points
2023-02-23T03:50:26.3666667+00:00

Script to get COunt for all workflow history list from all sites present in CSV

I have 1100 sites includes sub sites and site collections. in CSV file

For example below is count 21 in the nintex workflow history list for one site

User's image

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,422 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Yanli Jiang - MSFT 30,626 Reputation points Microsoft External Staff
    2023-02-23T07:34:32.7633333+00:00

    Hi sns ,

    Are all the sites you mentioned located in the same web application?

    If so, I found a similar post for your reference:

    https://www.sharepointfix.com/2013/01/powershell-script-to-get-sharepoint.html

    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Yanli Jiang - MSFT 30,626 Reputation points Microsoft External Staff
    2023-02-24T09:32:41.7266667+00:00

    Hi sns ,

    As it is related to the third-party software, I cannot test it. I can only provide a rough script for your reference. And you can give a try.

    It is recommended that you go to relevant forums to get better help.

    Thanks for your support and understanding.

    Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue 
    
    #Read urls in csv
    $Items = Import-Csv -Path C:\xxx\count.csv
    $Urls = $Items.Url
    Write-Output $Urls
    
    #loop each url and get the list in site
    foreach($Url in $Urls){
        $spweb = Get-SPWeb $Url
        $spLists =  $spweb.Lists | Where { $_.BaseTemplate -eq "WorkflowHistory" }
    	{
            Write-Host $spweb.Title
    		Write-Host $list.Title
    		Write-Host $list.ItemCount
        }	
    }
    

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.