Governance! Governance! Governance! – This topic is long lasting… There are so many things comes under governance and if you have a good governance then it means your SharePoint environment is stable, process oriented, disciplined, following capacity planning etc. In my last article, I discussed about one of the most vital governance agenda i.e. site use confirmation and deletion-
http://sharepointknowledgebase.blogspot.com/2014/02/site-use-confirmation-and-deletion.html
http://sharepointknowledgebase.blogspot.com/2014/02/site-use-confirmation-and-deletion.html
Today’s article is based in continuation with the above article. How? Let me explain - Suppose you don’t want to implement the functionality i.e. (site use confirmation and deletion), then what’s the alternative?
A. Should be something by which we can think off?
B. Should be something by which we can implement with proper considerations?
C. Should be something which there is a minimal risk?
Don’t worry! I also thought of the same questions and started exploring the options by means of PowerShell, by means of any third party tool, by means of SQL queries….
Done a lot of research, analyzed so many test cases, spend so many hours to prepare a script, spend numerous days to explore the site columns in SQL database and then finally got it that I wanted as per my requirements.
You must be thinking that which path/solution I am talking about-
Let me brief some details before sharing the actual data-
For this requirement, you need two reports like-
Site collection administrators across all site collections
Site collections which are under-utilized / not been accessed from a long time.
I will not talk about the first point as it’s very easy and you can prepare it in a simple manner via PowerShell. In case of any queries then please let me know.
Regarding second point which is our main agenda / goal – This can be extracted via SQL Query!
Please refer the following SQL Query which will accomplish this requirement.
SELECT FullUrl AS 'Site URL', TimeCreated,
DATEADD(d,DayLastAccessed + 65536, CONVERT(datetime, '1/1/1899', 101))
AS lastAccessDate FROM Webs WHERE
(DayLastAccessed <> 0) AND (FullUrl LIKE N'sites/%') ORDER BY lastAccessDate
You need to run this query against the specific content database and extract the report.
1. Login to your SQL box
2. Open SQL Server management studio
3. Click on “New Query” from the top
4. Change the database from the dropdown
5. Select your content database
6. Paste the above query in the query box
7. Select it (control A)
8. Execute it from the top.
9. You will get the report in the bottom section. That’s it- You are done.
If you have any queries/questions regarding the above mentioned information then please let me know. I would be more than happy to help you as well as resolves your issues, Thank you.
References:-
Product Applies To:-
1. SharePoint Server 2007
2. SharePoint Server 2010
3. SharePoint Foundation 2010
4. SharePoint Foundation 2013
5. SharePoint Server 2013
This is very cool!! Ironically, I'm doing SQL commands today :)
ReplyDeleteThank you Amol, it would be great if you could share how to get report using PS for list of Site Collection Administrators also
ReplyDeleteHere is the one-
Deletefunction Get-SPfarmAdministrators {
$admin = Get-SPAdminWebApplication
foreach ($adminsite in $admin.Sites ) {
$adminWeb = Get-SPweb($adminsite.url)
$AdminGroupName = $adminWeb.AssociatedOwnerGroup
$farmAdministratorsGroup = $adminweb.SiteGroups[$AdminGroupName]
return $farmAdministratorsGroup.users
}
}
function Get-ALLSiteCollectionAdminstrators{
$spWebApps = Get-SPWebApplications
foreach ($spWebApp in $spWebApps)
{
#WEB APPLICATION ENTITY
$WebAppElem= $resultInXml.CreateElement("WebApplication")
$WebAppElem.SetAttribute("Url", $spWebApp.Url);
$WebAppsElem.AppendChild($WebAppElem);
#SITE COLLECTIONS ENTITY
$SiteCollsElem= $resultInXml.CreateElement("SiteCollections")
$WebAppElem.AppendChild($SiteCollsElem);
foreach($site in $spWebApp.Sites)
{
#SITE COLLECTION ENTITY
$SiteCollElem= $resultInXml.CreateElement("SiteCollection")
$SiteCollElem.SetAttribute("Url", $site.Url);
$SiteCollsElem.AppendChild($SiteCollElem);
#SITE COLLECTION ADMINISTRATORS ENTITY
$SiteCollAdmsElem= $resultInXml.CreateElement("SiteCollectionAdministrators")
$SiteCollElem.AppendChild($SiteCollAdmsElem);
foreach($siteAdmin in $site.RootWeb.SiteAdministrators)
{
#SITE COLLECTION ADMINISTRATOR ENTITY
$SiteCollAdmElem= $resultInXml.CreateElement("SiteCollectionAdministrator")
$SiteCollAdmElem.SetAttribute("UserLogin",$siteAdmin.UserLogin)
$SiteCollAdmElem.SetAttribute("DisplayName",$siteAdmin.DisplayName)
$SiteCollAdmsElem.AppendChild($SiteCollAdmElem);
# Write-Host "$($siteAdmin.ParentWeb.Url) - $($siteAdmin.DisplayName)"
}
$site.Dispose()
}
}
}
Let me know in case of any queries, Thanks
ReplyDeleteHi amol i am unable to copy the code u kept in your blog....can u say y?
ReplyDeletehi, unfortunately you are not allowed to query the Content databases directly.
ReplyDeleteYou don't have appropriate rights to execute the command, Please contact your SQL Team to get this done / get yourself proper access by which you can run this command. Thanks
DeleteIs it supported from Microsoft this approach?
ReplyDeleteYes as we are not modifying the database values!
DeleteHello I know his is very old but trying to figure out what i am doing wrong.
ReplyDeletei past the query but get no results. Says completed successfully but all fields are empty.
Thanks
Wanted to share my findings with the query. If I run this in our environment, I get three of our most used sites as lastAccessed over five years ago. Not sure this is bringing back the expected data. I access all three of them, and no change in the results.
ReplyDeleteHi Matt, were you able to find on this one..We are also running this script..but script is not showing last accessed time correctly.
DeleteDATEADD(d,DayLastAccessed + 65536, CONVERT(datetime, '1/1/1899', 101))
ReplyDeleteAS lastAccessDate --- > what is the reason to this part and why.
I think things like this are really interesting. I absolutely love to find unique places like this. It really looks super creepy though!!
ReplyDeleteMachine learning training in chennai
machine learning with python course in Chennai
best training insitute for machine learning
Nice Blog
ReplyDeleteaws course in Bangalore
aws training center in Bangalore
cloud computing courses in Bangalore
amazon web services training institutes in Bangalore
best cloud computing institute in Bangalore
cloud computing training in Bangalore
aws training in Bangalore
aws certification in Bangalore
best aws training in Bangalore
aws certification training in Bangalore
Nice post thanks for sharing this post
ReplyDeletetableau course in Marathahalli
best tableau training in Marathahalli
tableau training in Marathahalli
tableau training in Marathahalli
tableau certification in Marathahalli
tableau training institutes in Marathahalli
I think things like this are really interesting.
ReplyDeletedevops course in Marathahalli
best devops training in Marathahalli
Devops certification training in Marathahalli
devops training in Marathahalli
devops training institute in marathahalli
this blog is very informative and interesting also
ReplyDeleteselenium training centers in Bangalore
best software testing training institutes in Bangalore with placements
automation testing courses in Bangalore
selenium testing course in Bangalore
software testing institutes in Bangalore
selenium training in Bangalore
best selenium training in Bangalore
selenium course in Bangalore
This is the first time I visit here. Your post is just outstanding! thanx for such a wonderful post, its great and good work.
ReplyDeleteEmbedded System Course Chennai
Embedded Training Institutes in Chennai
Corporate Training in Chennai
Power BI Training in Chennai
Linux Training in Chennai
Pega Training in Chennai
Unix Training in Chennai
Primavera Training in Chennai
Embedded Training in Thiruvanmiyur
Embedded Training in Tambaram
thanks for sharing this information
ReplyDeleteUiPath Training in Bangalore
tableau training in bangalore
best tableau training institutes in bangalore
tableau classroom training in bangalore
best python training institute in bangalore
python training in bangalore
python training in jayanagar bangalore
Artificial Intelligence training in Bangalore
Thank you for allowing me to read it, welcome to the next in a recent article. And thanks for sharing the nice article, keep posting or updating news article.
ReplyDeletePython training in bangalore
Thank you for allowing me to read it, welcome to the next in a recent article. And thanks for sharing the nice article, keep posting or updating news article.
ReplyDeletePython training in bangalore
Python training in Bangalore
Data science with python training in Bangalore
Thanks for sharing a blog.
ReplyDeletePython training in bangalore
Python training in Bangalore
Data science with python training in Bangalore
Angular js training in bangalore
Hadoop training in bangalore
DevOPs training in bangalore
This is a very good tip particularly to those fresh to the blogosphere. Short but very accurate information… Thank you for sharing this one. A must read post!
ReplyDeleteANGULAR TRAINING IN BANGALORE
UI Development Institute in Bangalore
Python Training in Marathahalli
bookmarked!!, I like your site!
ReplyDeleteUI DEVELOPMENT TRAINING IN MARATHAHALLI
PYTHON TRAINING IN MARATHAHALLI,BANGALORE
REACTJS TRAINING IN MARATHAHALLI,BANGALORE
UI DEVELOPMENT TRAINING IN BANGALORE
Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.
ReplyDeleteApache Spark with Scala online training
AWS online training
Thanks for your informative article, Your post helped me to understand the future and career prospects & Keep on updating your blog with such awesome article.
ReplyDeleteBest Data Science with R Online Certification
Nice Article and Thank you for sharing the informative informations...!
ReplyDeleteOracle DBA Course in Chennai
oracle dba training institutes in chennai
Advanced Excel Training in Chennai
Placement Training in Chennai
Soft Skills Training in Chennai
JMeter Training in Chennai
Job Openings in Chennai
Oracle DBA Training in Anna Nagar
Tableau Training in Chennai
Appium Training in Chennai
Thank you for sharing. Machine Learning Training in Bangalore from Indian Cyber Security Solutions design the course to provide a broad introduction to machine learning, data-mining, and statistical pattern recognition. Machine learning is the science of getting computers to act without being explicitly programmed. In the past decade, machine learning has given us self-driving cars, practical speech recognition, effective web search, and a vastly improved understanding of the human genome. Machine learning is so pervasive today that you probably use it dozens of times a day without knowing it. Machine Learning Course done by ICSS in Kolkata. ICSS is the Best Machine Learning Institute in Bangalore.
ReplyDeleteI wanted to build my career in IT. Hats-off to the trainers at the training centre. They provide complete assistance and always ready to guide.
ReplyDelete<software testing training institutes in bangalore
software testing training in bangalore
best software testing training institutes in bangalore
software testing training course content
software testing training interview questions
software testing training & placement in bangalore
software testing training center in bangalore
I am looking for and I love to post a comment that "The content of your post is awesome" Great work!
ReplyDeleteDigital marketing course mumbai
This comment has been removed by the author.
ReplyDelete