https://github.com/matteoguadrini/psfstools
Tools for File Server Role
https://github.com/matteoguadrini/psfstools
backup-archivefiles cmdlet deduplication disk-usage duplicate-files file-server file-server-resource-manager filesystem fs powershell powershell-module projectfolder server-topology topology
Last synced: 8 months ago
JSON representation
Tools for File Server Role
- Host: GitHub
- URL: https://github.com/matteoguadrini/psfstools
- Owner: MatteoGuadrini
- License: gpl-3.0
- Created: 2019-01-15T16:14:20.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-05-20T13:55:04.000Z (over 5 years ago)
- Last Synced: 2025-03-04T10:45:24.317Z (11 months ago)
- Topics: backup-archivefiles, cmdlet, deduplication, disk-usage, duplicate-files, file-server, file-server-resource-manager, filesystem, fs, powershell, powershell-module, projectfolder, server-topology, topology
- Language: PowerShell
- Homepage: https://matteoguadrini.github.io/PSFSTools/
- Size: 116 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README

# PSFSTools is:
Simple file server tools for complex task.
## A powershell module
**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](https://www.powershellgallery.com/packages/PSFSTools).
> ATTENTION: This module is not signed. Before import or execute cmdlet on this module, see [about_signing](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/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 call ```Set-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
```
## A collection of tool
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
## Tools:
* 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:
```powershell
Get-Help about_psfstools
```
### New-ProjectFolder
Creates a project folder and assign ACL with three Active Directory groups: Owner, Writer, Reader. For example:
```powershell
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:
```powershell
Get-Help New-ProjectFolder -Full
```
### Remove-OlderThan
Removes files and folders older than days. In addition, also deletes empty folders. For example:
```powershell
Remove-OlderThan -Path C:\Temp -Days 15 -Recurse
```
Delete file and empty folder in *C:\Temp*, if creation date is older than 15 days.
For more info, run:
```powershell
Get-Help Remove-OlderThan -Full
```
### Backup-ArchiveFiles
Archive files older than a number of years. For example:
```powershell
Backup-ArchivedFiles -Path C:\Temp -Years 2 -ArchivePath D:\Temp -Exclude C:\Temp\Docs,"C:\Temp\Docs two" -AllFiles
```
Looking 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:
```powershell
Get-Help Backup-ArchiveFiles -Full
```
## File server topology configuration
To create and maintain a file server topology, use the following commands.
### New-TemplateFileServer
With this command you can create an example topology file of a file server.
```powershell
New-TemplateFileServer -Path C:\Temp\fs1.xml
```
Change the topology according to your needs.
### Write-FileServerFromTemplate
Applying topology means creating folders and assigning them permissions, specified in the topology template file.
To apply it, run this command:
```powershell
Write-FileServerFromTemplate -Template C:\Temp\fs1.xml -RootPath D:\FS
```
Applying 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:
```powershell
Get-Help New-TemplateFileServer -Full
Get-Help Write-FileServerFromTemplate -Full
```
## Report cmdlet
These cmdlets are used to run reports
### Get-DedupFiles
To recover files that are duplicated in a certain path
```powershell
Get-DedupFiles -Path C:\Temp
```
Or to traverse the path, just specify the _-Recurse_ parameter:
```powershell
Get-DedupFiles -Path C:\Temp -Recurse
```
For more info, run:
```powershell
Get-Help Get-DedupFiles -Full
```
### Show-LatestCreatedFile
Show 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.
```powershell
Show-LatestCreatedFile -Path C:\Temp -Recurse -Size 50MB -CreationTime '05/29/2016'
```
For more info, run:
```powershell
Get-Help Show-LatestCreatedFile -Full
```
### Show-LatestWritedFile
Show 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.
```powershell
Show-LatestWritedFile -Path C:\Temp -Recurse -Size 50MB -CreationTime '05/29/2016'
```
For more info, run:
```powershell
Get-Help Show-LatestWritedFile -Full
```
### Show-LatestAccessedFile
Show 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.
```powershell
Show-LatestAccessedFile -Path C:\Temp -Recurse -Size 50MB -CreationTime '05/29/2016'
```
For more info, run:
```powershell
Get-Help Show-LatestAccessedFile -Full
```
### Show-FolderLength
Show to estimate file space usage.
Track the directories which are consuming excessive amount of space on a drive.
```powershell
Show-FolderLength -Path C:\Temp
```
For more info, run:
```powershell
Get-Help Show-FolderLength -Full
```
## Backup/Restore ACL cmdlet
These cmdlets are used to backup and restore ACL on folder structure
### Backup-ACLFolders
Backup ACL traverse folders on specific path.
The backup csv header is:
*"Path","FileSystemRights","AccessControlType","IdentityReference","IsInherited","InheritanceFlags","PropagationFlags"*.
```powershell
Backup-ACLFolders -Path C:\Temp -OutputCSV C:\Temp2\acl_temp.csv
```
For more info, run:
```powershell
Get-Help Backup-ACLFolders -Full
```
### Restore-ACLFolders
Restore 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
```powershell
Restore-ACLFolders -InputCSV C:\Temp2\acl_temp.csv
```
For more info, run:
```powershell
Get-Help Restore-ACLFolders -Full
```
## Share cmdlet
These cmdlets are used to manage file server share
### Suspend-FSShare
Temporary suspension of a samba share. Permission will be maintained at the end of the suspension.
> ATTENTION: For this operation, need administrative permissions
```powershell
Suspend-FSShare -Share Temp
```
For more info, run:
```powershell
Get-Help Suspend-FSShare -Full
```
**A great thanks**.
For donations, press this
For me
[](https://www.paypal.me/guos)
For [Telethon](http://www.telethon.it/)
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.
[Adopt the future](https://www.ioadottoilfuturo.it/)