Closed effyl01 closed 2 years ago
Hi Effy,
For that you would need to get the subsites (and sub-subsites etc. recursively if you have multi-level structure).
Have a look if that helps: https://github.com/PowershellScripts/SharePointOnline-ScriptSamples/tree/develop/Site%20Management/Get%20all%20site%20collections%20and%20their%20subsites
If not, I can try to create a sample
Hi Arleta, I actually saw that code and gave it my best try and couldn't. I would very much appreciate it if you could combine the 2 scripts. I also think this will be a generic script that all site permutations can enjoy. Thanks, Effy L.
Hi Effy,
Here is a script for you: https://github.com/PowershellScripts/SharePointOnline-ScriptSamples/blob/develop/Versioning/Enable%20versions%20for%20selected%20sites%20and%20their%20subsites/Script.ps1
Let me know what you think
I am assuming @effyl01 you liked it :) since there is no response. Closing the issue
Thank you for the code. I am trying to set versioning on for a a few sites and I am reading them from a text file. All is well, but how to add so it will run on the sub-sites of those site collection as well.
foreach ($line in Get-Content c:\sites.txt) { $sitecollection=Get-SPosite $line set-Versioning -Url $sitecollection.url -Username $Username -Password $Password -Versioning $Versioning }
thanks! Effy.