Simple file server tools for complex task.
PSFSTools is a powershell module. Download and copying it under %Windir%\System32\WindowsPowerShell\v1.0\Modules for all users or under %UserProfile%\Documents\WindowsPowerShell\Modules for the current user or install through PowershellGallery.
ATTENTION: This module is not signed. Before import or execute cmdlet on this module, see about_signing session. Verify execution of scripts is allowed with
Get-ExecutionPolicy(should be RemoteSigned or Unrestricted). If scripts are not enabled, run PowerShell as Administrator and callSet-ExecutionPolicy RemoteSigned -Scope CurrentUser -Confirm.
You can also install it via git:
git clone https://github.com/MatteoGuadrini/PSFSTools.git
cd PSFSTools
copy /Y PSFSTools %Windir%\System32\WindowsPowerShell\v1.0\Modules
Various task on a file server, require execution complexity; how and when to archive, create folders assigned to certain groups or delete files older than one month or delete folders that are no longer used.
This module, with
- New-ProjectFolder
- Remove-OlderThan
- Backup-ArchiveFiles
- New-TemplateFileServer
- Write-FileServerFromTemplate
- Get-DedupFiles
- Show-LatestCreatedFile
- Show-LatestWritedFile
- Show-LatestAccessedFile
- Show-FolderLength
- Backup-ACLFolders
- Restore-ACLFolders
For more module info, run:
Get-Help about_psfstoolsCreates a project folder and assign ACL with three Active Directory groups: Owner, Writer, Reader. For example:
New-ProjectFolder -Name Test -LitheralPath C:\Project -Permission Owner,Writer,Reader -OU "OU=Test,DC=Test,DC=local"The name of directory is Test and your path is C:\Project\Test. This cmdlet, creates a three Active Directory security group:
- Test_Readers (Read, Execute)
- Test_Writers (Read, Execute, Write, Modify)
- Test_Owners (Full Control)
And apply these on path with permission in brackets. For more info, run:
Get-Help New-ProjectFolder -FullRemoves files and folders older than days. In addition, also deletes empty folders. For example:
Remove-OlderThan -Path C:\Temp -Days 15 -RecurseDelete file and empty folder in C:\Temp, if creation date is older than 15 days. For more info, run:
Get-Help Remove-OlderThan -FullArchive files older than a number of years. For example:
Backup-ArchivedFiles -Path C:\Temp -Years 2 -ArchivePath D:\Temp -Exclude C:\Temp\Docs,"C:\Temp\Docs two" -AllFilesLooking for file with Access Date older than two years into path C:\Temp; the destination path is D:\Temp. With Exclude option you can skip file in specified paths. Flag AllFiles means than all files in a folder must be older than two years. This cmdlet performing a move. For more info, run:
Get-Help Backup-ArchiveFiles -FullTo create and maintain a file server topology, use the following commands.
With this command you can create an example topology file of a file server.
New-TemplateFileServer -Path C:\Temp\fs1.xmlChange the topology according to your needs.
Applying topology means creating folders and assigning them permissions, specified in the topology template file. To apply it, run this command:
Write-FileServerFromTemplate -Template C:\Temp\fs1.xml -RootPath D:\FSApplying the command a second time, the new folders in the topology will be created, while the existing ones will be ignored. All permissions will be overwritten, if -Force parameter is specified.
For more info, run:
Get-Help New-TemplateFileServer -Full
Get-Help Write-FileServerFromTemplate -FullThese cmdlets are used to run reports
To recover files that are duplicated in a certain path
Get-DedupFiles -Path C:\TempOr to traverse the path, just specify the -Recurse parameter:
Get-DedupFiles -Path C:\Temp -RecurseFor more info, run:
Get-Help Get-DedupFiles -FullShow the latest created files based on a date or size. The size of the files can be specified in bytes 1, 1MB, 1GB, 1TB, 1PB.
Show-LatestCreatedFile -Path C:\Temp -Recurse -Size 50MB -CreationTime '05/29/2016'For more info, run:
Get-Help Show-LatestCreatedFile -FullShow the latest modified files based on a date or size. The size of the files can be specified in bytes 1, 1MB, 1GB, 1TB, 1PB.
Show-LatestWritedFile -Path C:\Temp -Recurse -Size 50MB -CreationTime '05/29/2016'For more info, run:
Get-Help Show-LatestWritedFile -FullShow the latest accessed files based on a date or size. The size of the files can be specified in bytes 1, 1MB, 1GB, 1TB, 1PB.
Show-LatestAccessedFile -Path C:\Temp -Recurse -Size 50MB -CreationTime '05/29/2016'For more info, run:
Get-Help Show-LatestAccessedFile -FullShow to estimate file space usage. Track the directories which are consuming excessive amount of space on a drive.
Show-FolderLength -Path C:\TempFor more info, run:
Get-Help Show-FolderLength -FullThese cmdlets are used to backup and restore ACL on folder structure
Backup ACL traverse folders on specific path. The backup csv header is: "Path","FileSystemRights","AccessControlType","IdentityReference","IsInherited","InheritanceFlags","PropagationFlags".
Backup-ACLFolders -Path C:\Temp -OutputCSV C:\Temp2\acl_temp.csvFor more info, run:
Get-Help Backup-ACLFolders -FullRestore ACL traverse folders on specific path. The backup csv header is: "Path","FileSystemRights","AccessControlType","IdentityReference","IsInherited","InheritanceFlags","PropagationFlags".
ATTENTION: For this operation, need administrative permissions
Restore-ACLFolders -InputCSV C:\Temp2\acl_temp.csvFor more info, run:
Get-Help Restore-ACLFolders -FullThese cmdlets are used to manage file server share
Temporary suspension of a samba share. Permission will be maintained at the end of the suspension.
ATTENTION: For this operation, need administrative permissions
Suspend-FSShare -Share TempFor more info, run:
Get-Help Suspend-FSShare -FullA great thanks.
For donations, press this
For me
For Telethon
The Telethon Foundation is a non-profit organization recognized by the Ministry of University and Scientific and Technological Research. They were born in 1990 to respond to the appeal of patients suffering from rare diseases. Come today, we are organized to dare to listen to them and answers, every day of the year.

