Script powershell avec LastwriteTime
Bonjour,
Je suis novice en Powershell et tout autre langage.
Je cherche à créer un script en PS pour me remonter dans un fichier les dossiers d'un share en remontant les acl et le lastwritetime par dossier (but vérifier les ACL sur les Share d'un serveur windows).
J'ai trouvé un script qui me remonte les dossiers avec les acl mais je n'arrive pas à trouver la syntaxe pour le lastwritetime.
ci-dessous le script trouvé:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| $ErrorActionPreference = "SilentlyContinue"
$a = New-Object -comobject Excel.Application*
$a.visible = $True
$b = $a.Workbooks.Add()
$intRow=1
$c = $b.Worksheets.Item(1)
$c.Cells.Item($intRow,1) = "Folder"
$c.Cells.Item($intRow,2) = "Compte/groupe"
$c.Cells.Item($intRow,3) = "Type d'Acces"
$c.Cells.Item($intRow,4) = "Droits"
$d = $c.UsedRange
$d.EntireColumn.AutoFit()|Out-Null
$d.Interior.ColorIndex = 19
$d.Font.ColorIndex = 11
$d.Font.Bold = $True
remove-variable arrayOfPath
$depth=2
$RootFolder="c:\"
for($i=0; $i -le $depth;$i++)
* {
* $arrayOfPath += ,$RootFolder
* $RootFolder=$RootFolder+"\"
* }
$arrayOfPath |get-childitem -directory |%{get-acl $_.fullname}|
* %{
* * * $intRow=$intRow+1 *
* * * $c.Cells.Item($intRow, 1)=$_.path.tostring().replace("Microsoft.PowerShell.Core\FileSystem::","")
* * * $droit=$_.access
* * * $droit|%{$c.Cells.Item($intRow, 2)=$_.IdentityReference.tostring();$c.Cells.Item($intRow, 3)=$_.AccessControlType.tostring();$c.Cells.Item($intRow, 4)=$_.FileSystemRights.tostring();$intRow=$intRow+1}}
* * * $time= * * * * * * * * * * * * * * * * * * * * * **
$d.EntireColumn.AutoFit()|Out-Null |
merci pour votre aide