How Can I Automate Cleaning Useless SharePoint Sites?

0
2
Asked By CodingCrusader123 On

Hi everyone! I'm currently interning and I've been tasked with the manual job of cleaning up unnecessary sites from SharePoint, which has proven to be quite repetitive and tedious. I suspect there must be a way to automate this cleaning process. The focus is on sites that are under 2GB in size.

Here's what I'm hoping to achieve:

1. Make myself an admin on all targeted sites so I can manage them freely.
2. Identify and delete sites created by obsolete users that are under 1GB and have not been modified (not just 'last visited') since 2024.
3. Remove all directories that have not seen any modifications since 2024, being careful not to delete directories that contain elements modified after that date. This is particularly sensitive as I don't want to lose any valuable data by mistake.

I have admin access at my company and an OnMicrosoft address. I've tried tackling the first goal but ran into issues, especially with errors regarding my ID, even though I have the permissions necessary for these tasks.

Is this goal realistic for my skill level? What's the best way to get started? What tools should I explore? I'm convinced that if something can be done manually through the GUI, there should be a more efficient way to do it via the command line interface. However, I'm still getting familiar with PowerShell and Microsoft's limitations. Thanks for any guidance!

2 Answers

Answered By PowerShellGuru89 On

First off, make sure you have the correct PowerShell modules installed for SharePoint, as they’re essential for this task. Be careful though—you don’t want to run your scripts on live data until you're absolutely certain they work correctly. Try creating test files and changing their attributes to see how your scripts behave first. You should also think about the timing of these operations; moving large amounts of files may disrupt users, so plan accordingly!

InternExplorations -

Thanks for the detailed response! I’m mostly dealing with sites under 2GB, so it sounds manageable. I’ll follow your advice on testing. It’s super helpful!

Answered By TechSavvyNinja On

Consider checking out the Graph API; it can make a lot of these tasks easier! It might seem daunting at first, but trust me, it's worth it. Once you get the hang of it, you'll find it simplifies many repetitive processes.

InternExplorations -

I was hesitant about the Graph API too, but I've heard it really streamlines things. I’ll definitely look into it!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.