-
Notifications
You must be signed in to change notification settings - Fork 13
Handling CIMFS Sprawl scripts
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.
Copyright 2021 - 2023 Ryanmangansitblog ltd and Ryan Mangan. Ryanmangansitblog.com