Parent Directory | Revision Log
Initial import of Remove-Item-Secure.ps1: new script to secure erase files; Fixes Get-LenovoProductInfo.ps1 which broke when Lenovo added a captcha; New query URL for Get-LenovoProductInfo.ps1 provides warranty and part data from a single web request instead of one each;
<# .NOTES Written by Ian Cammarata http://ian.cammarata.us Remove-Item-Secure To Do: -Lots of stuff .SYNOPSIS Secure erase files. .EXAMPLE PS> #> <# mkdir secure-erase-test mkdir secure-erase-test/test Set-Content "secure-erase-test/ing.txt" "asdf" Set-Content "secure-erase-test/test/ing.txt" "asdf" Copy-Item tmp/*.jpg secure-erase-test/test/ explorer.exe (Join-Path (pwd) "secure-erase-test/test/") #> [cmdletbinding( SupportsShouldProcess = $True )] param( #File system object to secure erase. [Parameter( Mandatory = $True, Position = 0, ValueFromPipeline= $True )] [Alias( "Files" )] [String[]] $Path ) #BEGIN { #} PROCESS { Foreach ( $item in $Path ) { $branches = Get-ChildItem $item -Recurse | ? { $_.PSIsContainer } $leaves = Get-ChildItem $item -Recurse | ? { $_.PSIsContainer -eq $False } "Burning leaves..." Foreach ( $leaf in $leaves ) { if ( $psCmdlet.ShouldProcess( $leaf, "Secure Erase" ) ) { Set-Content $leaf ("0" * $tmp[1].Length) $leaf.MoveTo( ( Join-Path $leaf.Directory ( Get-Random ) ) ) $leaf.Delete() } } "Chopping branches..." Foreach ( $branch in $branches ) { $branch.MoveTo( ( ( Join-Path $branch.PSParentPath ( Get-Random ) ) -split "::" )[1] ) } Remove-Item $Path -Recurse -Force } }
Contact | ViewVC Help |
Powered by ViewVC 1.0.4 |