Just kicking off 2022 with a couple Radical PowerShell Scripts for Sitecore!
I was working on some automation tasks and found where these scripts would be useful:
Get-SitecoreSite for auto detecting where the Sitecore Site is located, ie: WWWRoot/Sitecore.
If you don’t provide the site name, it will check all folders under wwwroot (or custom path you provide) for /bin/sitecore.kernel.dll.
So you could easily get the 1 sitecore site you have deployed or a full list of sites (if you have more than one).
Get-SitecoreVersion given path (or otherwise would call Get-SitecoreSite) then uses /sitecore/shell/sitecore.version.xml to show the actual Sitecore Version installed.
Easy to install:
PS> Install-Script Get-SitecoreSite
PS> Install-Script Get-SitecoreVersion
Thanks to PowerShellGallery:
https://powershellgallery.com/packages/Get-SitecoreSite
https://powershellgallery.com/packages/Get-SitecoreVersion
All MIT Open Source on Github:
https://github.com/SharedSitecore/Get-SitecoreSite
https://github.com/SharedSitecore/Get-SitecoreVersion