Change File Attributes
Mit wenig Aufwand verändern wir die Attribute einer Datei.
Set-ItemProperty -Path "C:\Temp\TestFile.txt" -Name LastWriteTime -Value ((Get-Date).AddDays(-7)) Set-ItemProperty -Path "C:\Temp\TestFile.txt" -Name LastAccessTime -Value ((Get-Date).AddDays(-5)) Set-ItemProperty -Path "C:\Temp\TestFile.txt" -Name CreationTime -Value ((Get-Date).AddDays(-3)) Set-ItemProperty -Path "C:\Temp\TestFile.txt" -Name IsReadOnly -Value $true
Get-ChildItem -Path *.xml | foreach {$_.CreationTime = ($_.CreationTime).AddHours(6)} Get-ChildItem -Path *.xml | foreach {$_.LastAccessTime = ($_.LastAccessTime).AddHours(6)} Get-ChildItem -Path *.xml | foreach {$_.LastWriteTime = ($_.LastWriteTime).AddHours(6)} CreationTimeUtc LastAccessTimeUtc LastWriteTimeUtc