Skip to content

Handling CIMFS Sprawl scripts

Ryan Mangan edited this page Mar 6, 2023 · 8 revisions

Updated: use the Provided PowerShell Module: https://github.com/RMITBLOG/MSIX_APP_ATTACH/tree/master/Cim%20Sprawl%20PowerShell%20Module

Move-CimFiles -DestinationDirectory "C:\Users\dev01\Desktop\testing\out" -SourceDirectory "C:\Users\dev01\Desktop\testing" -TimeToleranceSeconds "4"

The following script gets the date and time when the CIMFS files were created. This allows you to identify which belong to which.

Get-ChildItem -Path C:\Users\Ryan\Desktop\cimtest\testmove | Foreach-Object { write-output "$($_.Mode) $($_.LastWriteTime) $($_.FullName)" }

The second script moves a bunch of files with the same or similar date/time range.

[DateTime]$start_time = "02/06/2021 11:49:50" [DateTime]$end_time = "02/06/2021 11:49:52" $des_folder = "C:\Users\Ryan\Desktop\cimtest\testmove"

Get-ChildItem C:\Users\Ryan\Desktop\cimtest* -Recurse | foreach { if ($_.lastwritetime -ge $start_time -and $_.lastwritetime -le $end_time) { move-item $_.fullname $des_folder } }

This essentially allows you to untangle multiple cims created in one folder directory which is difficult to separate or manage.

Clone this wiki locally