Asked by:
powershell

Question
-
Hi All
do we have script to get all folders
sub folders
owner of the folder or last modified by in sharepoint document library.
Regards,
prasad.
- Edited by prasad chenikkala Tuesday, December 19, 2017 9:07 AM
- Moved by Bill_Stewart Friday, January 26, 2018 3:40 PM Off-topic/unanswerable
Tuesday, December 19, 2017 8:14 AM
All replies
-
Please read this first: https://social.technet.microsoft.com/Forums/scriptcenter/en-US/c47b1bc2-f7fd-4d2e-8ff2-e8a81ce090d4/this-forum-is-for-scripting-questions-rather-than-script-requests?forum=ITCG
Also find scripts here: http://gallery.technet.microsoft.com/
Learn PowerShell: https://mva.microsoft.com/en-us/training-courses/getting-started-with-microsoft-powershell-8276
Script requests: https://gallery.technet.microsoft.com/scriptcenter/site/requests
\_(ツ)_/
Tuesday, December 19, 2017 8:20 AM -
#Get all lists in farm
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Get the Site collection
$Site= Get-SPSite http://sharepointsite
$outputPath = “c:\Portallist.csv”
Function GetMyFiles($Folder)
{
Write-Host “+in : “$Folder.Name
foreach($file in $Folder.Files)
{
Write-Host “`t” $file.Name
Add-Content -Path $outputPath -Value ” File Name : $($file.Name)”
}
#Loop through all subfolders and call the function recursively
foreach ($SubFolder in $Folder.SubFolders)
{
if($SubFolder.Name -ne “Forms”)
{
Write-Host “`t” -NoNewline
Add-Content -Path $outputPath -Value ” Folder Name : $($SubFolder.Name)”
GetMyFiles($Subfolder)
}
}
}
this is the script Iam using
- Edited by prasad chenikkala Tuesday, December 19, 2017 8:48 AM
Tuesday, December 19, 2017 8:37 AM -
What is it that is the issue. What errors are you getting?
We do not write custom scripts. You can find scripts in the Gallery for SharePoint. I suggest starting there.
\_(ツ)_/
Tuesday, December 19, 2017 8:55 AM -
I am trying to full folders and subfolders under document library with name and owner and modifiedy by
but it is not generating report
Regards,
Prasad.
Tuesday, December 19, 2017 8:58 AM -
That is because the script you have copied from somewhere is nota capable of accessing SharePoint. You need to learn SharePoint first and then learn basic PowerShell.
Look in the Gallery for hundreds of examples of getting information from SharePoint. You will also have to install the SharePoint support library and spend a good amount of time learning how to use it.
I suspect there is at least one script in the Gallery that is very close to what you need.
\_(ツ)_/
Tuesday, December 19, 2017 9:03 AM -
I should also note that you can attach a document library as a folder in File Explorer which will give you file times and, I believe it will also give you the owner. It will also show you all subfolders. Post in the SharePoint forum for more information on how to attach a library from SharePoint.
\_(ツ)_/
Tuesday, December 19, 2017 9:08 AM