Author: techrevmarrell

PowerShell – Count Items in SharePoint Recycle Bin

This is a random script I put together due to a one off issue I have been having. I have a script that I use to clear items from a large list. Unfortunately it dumps these deleted items into the SharePoint Recycle bin for that site collection. Normally this wouldn’t be too big of an issue, but when I say this list is large, I really mean like it can get million items large. So what I do is use a script that deletes the items in 1000 item batches. Again, no problem until a site owner needs to find a random file that was deleted by a user and has to click through 15 pages to find it. Doesn’t make the easy task for them, so easy and quick anymore. That said I created couple lines in my batch delete script that will delete the items in the recycle bin based upon who deleted the item. And it works great, but since I had 80k items in my recycle bin, I needed a way to tell if things are really getting deleted. Since there doesn’t appear to be a item count in the UI for the recycle bin. Since I figured I may need this again, or someone somewhere may run into a similar situation, I’d just post it. So here ya go! <code> Add-PSSnapin Microsoft.SharePoint.PowerShell $spSite =...

Read More

Use PowerShell to create new SharePoint Workflow History List – (Works with Nintex)

I recently had an issue where I’ve needed to create move a large and active workflow to write to a new history list. If the list already exists I can simply point the Workflow to the new list using the GUI. There is an option using the GUI to create a new workflow list, but when it creates the list, it’s based off of the name of the Workflow. So lets say may list hits a million items and I need to create another list. If I use the gui and select create a new workflow list, I’ll get an error that the list name basically already exists. Using SharePoint Designer I could edit my workflow, create a new list, but then I’d need to republish it to the site. So the easiest method in my particular case, is to simply create a new workflow using PowerShell, then associate the workflow to that new list. The PowerShell to generate the new list is Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue $spweb = Get-SPWeb “http://mysitecollection” $SPTemplate = $spweb.ListTemplates[“Workflow History”] $spweb.Lists.Add(“WrkFlowHistoryListName”,”Workflow History List Description”,$SPTemplate)...

Read More

Twitter Posts