Advertisement
Laughing_Mantis

PatchExtract Version 1.25 by Greg Linares (@Laughing_Mantis)

Nov 14th, 2016
603
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <#
  2. ================
  3. PATCHEXTRACT.PS1
  4. =================
  5. Version 1.25 Microsoft MSU Patch Extraction and Patch Organization Utility by Greg Linares (@Laughing_Mantis)
  6.  
  7. This Powershell script will extract a Microsoft MSU update file and then organize the output of extracted files and folders.
  8.  
  9. Organization of the output files is based on the patch's files and will organize them based on their archicture (x86, x64, or wow64)
  10. as well as their content-type, ie: resource and catalog files will be moved to a JUNK subfolder and patch binaries and index files will
  11. goto a PATCH folder.
  12.  
  13. This script was developed in order to aid reverse engineers in quickly organizing patches so they can be binary diffed faster and easier.
  14. This was especially developed with the new bulk Microsoft Kernel patches in mind.
  15.  
  16. Example output folder structure ouput would be similar to this:
  17.  
  18. C:\PATCHES\MS15-XXX\PRE
  19.     -x86
  20.         - x86 Binary patched files
  21.     -x64
  22.         - x64 binary patched files
  23.     -WOW64
  24.         - syswow64 binary patched files
  25.     -JUNK
  26.         - resource, catalog, mum, and other non-binary based patched files
  27.     -PATCH
  28.         - original patch, cabs and xml files from the extraction
  29.     -MSIL
  30.         - MSIL .NET binary patched files ***New in Version 1.1***
  31.  
  32.     Directories will automagically be organized into filename-version to remove garbage filler folder names
  33.        
  34.        
  35. =============
  36. REQUIREMENTS
  37. =============
  38. 'expand.exe' to be present in %WINDIR%\SYSTEM32 (it is by default) - It will execute this file @ the current users permissions
  39. A valid Microsoft MSU patch file to extract (PATCH variable)
  40. Directory and File write/creation permissions to the PATH folder specified
  41.        
  42.    
  43. =======    
  44. USAGE
  45. =======
  46.  
  47. Powershell -ExecutionPolicy Bypass -File PatchExtract.ps1 -Patch C:\Patches\Windows6.1-KB3088195-x64.msu -Path C:\Patches\MS15-XXX\POST\
  48.  
  49.  
  50. This would extract the patch file C:\Patches\Windows6.1-KB3088195-x64.msu to the folder C:\Patches\MS15-XXX\POST\.
  51. It will then create all the sub organization folders within C:\Patches\MS15-XXX\POST\ folder.
  52.  
  53. (Note: the optional Powershell parameters '-ExecutionPolicy Bypass' is necessary in some environments to overcome Powershell execution restrictions)
  54.  
  55. ==========
  56. ARGUMENTS
  57. ==========
  58. -PATCH <STRING:Filename> [REQUIRED] [NO DEFAULT]
  59.     Specifies the MSU file that will be extracted to the specified PATH folder and then organized into the x86, x64, WOW, JUNK, and BIN folders specified
  60.     Extract command will be "expand -F:* <PATCH> <PATH>"
  61.     Non MSU files have not been tested however if the extraction does not generate a CAB file of the same name (indicator of successful extraction of MSU files)
  62.     the script assumes extraction failed.
  63.    
  64. -PATH <STRING:FolderPath> [REQUIRED] [NO DEFAULT]
  65.     Specified the folder that the PATCH file will be extracted and organized into
  66.     If the specified folders does not exist yet, the user will be prompted if they want to create it.
  67.     Relative paths '.\POST' can be used but it has not extensively been tested.
  68.  
  69.     ***New in Version 1.1***
  70.     The -PATH variable may be now omitted to expand to current directory
  71.    
  72.  
  73. -x86 <STRING:Foldername> [OPTIONAL] [DEFAULT='x86']
  74.  
  75.     Specifies the folder name within $PATH to store x86 patch binaries
  76.     example: -x86 32bit
  77.    
  78.    
  79. -x64 <STRING:Foldername> [OPTIONAL] [DEFAULT='x64']
  80.  
  81.     Specifies the folder name within $PATH to store x64 patch binaries
  82.     example: -x64 64bit
  83.    
  84. -WOW <STRING:Foldername> [OPTIONAL] [DEFAULT='WOW64']
  85.  
  86.     Specifies the folder name within $PATH to store wow64 type patch binaries
  87.     example: -WOW sysWOW64
  88.  
  89. -MSIL <STRING:Foldername> [OPTIONAL] [DEFAULT='MSIL']
  90.  
  91.     *** New in Version 1.1***
  92.     Specifies the folder name within $PATH to store .NET type patch binaries
  93.     example: -MSIL DOTNET
  94.    
  95. -JUNK <STRING:Foldername> [OPTIONAL] [DEFAULT='JUNK']
  96.  
  97.     Specifies the folder name within $PATH to store resource, catalog, and other generally useless for diffing patch binaries
  98.     example: -JUNK res
  99.    
  100.    
  101. -BIN <STRING:Foldername> [OPTIONAL] [DEFAULT='PATCH']
  102.  
  103.     Specifies the folder name within $PATH to store extraction xml and original patch msu and cab files
  104.     example: -BIN bin
  105.  
  106.  
  107. ================
  108. VERSION HISTORY
  109. ================
  110. I originally wrote this as an ugly batch file sometime between 2014 and 2015 as a way to organize folders but it was incomplete and buggy
  111.  
  112. Oct 15, 2015 - Initial Public Release 1.0
  113. Oct 20, 2016 - Version 1.1 Released
  114.                 * Bug fixes handling new naming format for patch .cab files
  115.                 * Added the ability to auto-extract to the same directory as current PATCH
  116.                 * filtered output directory name format to aid in bindiffing
  117.  
  118. Oct 20, 2016 - Version 1.2 Released
  119.                 * Bug fixes handling MSIL renaming issues and collisions in renameing patch folders
  120.  
  121. Nov 7, 2016 - Version 1.25 Released
  122.                 * Added hack to handle subsequent CAB files Microsoft Added in Windows 10 Cumulative Patches - will make a better way to handle this in 1.3
  123.                 * Need to figure out if the sub cabs are being extracted based on environment handling/checks
  124.  
  125.  
  126.  
  127. ==========
  128. LICENSING
  129. ==========
  130. This script is provided free as beer.  It probably has some bugs and coding issues, however if you like it or find it useful please give me a shout out on twitter @Laughing_Mantis.  
  131. Feedback is encouraged and I will be likely releasing new scripts and tools and training in the future if it is welcome.
  132.  
  133.  
  134. -GLin
  135.  
  136. #>
  137.  
  138.  
  139.  
  140.  
  141. Param
  142. (
  143.  
  144.     [Parameter(ValueFromPipelineByPropertyName = $true)]
  145.     [ValidateNotNullOrEmpty()]
  146.     [string]$PATCH = "",
  147.    
  148.     [Parameter(ValueFromPipelineByPropertyName = $true)]
  149.     [string]$PATH = "",
  150.    
  151.     [Parameter(ValueFromPipelineByPropertyName = $true)]
  152.     [string]$x86 = "x86",
  153.    
  154.     [Parameter(ValueFromPipelineByPropertyName = $true)]
  155.     [string]$x64 = "x64",
  156.    
  157.     [Parameter(ValueFromPipelineByPropertyName = $true)]
  158.     [string]$WOW = "WOW64",
  159.  
  160.     [Parameter(ValueFromPipelineByPropertyName = $true)]
  161.     [string]$MSIL = "MSIL",
  162.    
  163.     [Parameter(ValueFromPipelineByPropertyName = $true)]
  164.     [string]$JUNK = "JUNK",
  165.    
  166.     [Parameter(ValueFromPipelineByPropertyName = $true)]
  167.     [string]$BIN = "PATCH"
  168.        
  169. )
  170.  
  171. Clear-Host
  172.  
  173.  
  174.  
  175.  
  176. if ($PATCH -eq "")
  177. {
  178.     Throw ("Error: No PATCH file specified.  Specify a valid Microsoft MSU Patch with the -PATCH argument")
  179.    
  180. }
  181.  
  182. if ((Split-Path $PATCH -Parent) -eq "")
  183. {
  184.     # First look in current working directory for the relative filename
  185.     $CurrentDir = $(get-location).Path;
  186.     $PATCH = $CurrentDir + "\" + $PATCH
  187.  
  188.     # if that doesnt work we look in the current script directory (less likely)
  189.     # but hey we tried
  190.     if (!(Test-Path $PATCH))
  191.     {
  192.         $scriptDir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
  193.         $PATCH = $scriptDir + "\" + $PATCH
  194.     }
  195. }
  196.  
  197. if (!(Test-Path $PATCH))
  198. {
  199.     Throw ("Error: Specified PATCH file ($PATCH) does not exist.  Specify a valid Microsoft MSU Patch file with the -PATCH argument.")
  200. }
  201.  
  202. if ($PATH -eq "")
  203. {
  204.     $PATH = Split-Path $PATCH -Parent
  205.     write-Host ("PATH = $PATH")
  206.     Write-Host ("No PATH folder specified.  Will extract to $PATH folder.")
  207.    
  208. }
  209.  
  210. #Bug Fix (Resolve-Path Error if invalid path was specified before the path was created)
  211.  
  212.  
  213.  
  214.  
  215. if (!($PATCH.ToUpper().EndsWith(".MSU")))
  216. {
  217.     Do
  218.     {
  219.         $Attempt = Read-Host ("Warning: Specified PATCH file ($PATCH) is not a MSU file type. Do you still want to attempt extraction? [Y] or [N]")
  220.     }
  221.     Until ('Y', 'y', 'n', 'N' -ccontains $Attempt)
  222.     if ($Attempt.ToUpper() -eq 'N')
  223.     {
  224.         Write-Host ("Exiting...")
  225.         Exit
  226.     }
  227. }
  228.  
  229. if (!(Test-Path $PATH))
  230. {
  231.     Do
  232.     {
  233.         $Attempt = Read-Host ("Warning: Specified PATH folder ($PATH) does not exist. Do you want to create it? [Y] or [N]")
  234.     }
  235.     Until ('Y', 'y', 'n', 'N' -ccontains $Attempt)
  236.     if ($Attempt.ToUpper() -eq 'N')
  237.     {
  238.         Write-Host ("Exiting...")
  239.         Exit
  240.     }
  241.     else
  242.     {
  243.         New-Item $PATH -Force -ItemType Directory
  244.         Write-Host "Created $PATH Folder" -ForegroundColor Green
  245.     }
  246. }
  247.  
  248. $PATCH = Resolve-Path $PATCH
  249. $PATH = Resolve-Path $PATH
  250.  
  251. Write-Host "Patch to Extract: $PATCH"
  252. Write-Host "Extraction Path: $PATH"
  253. Write-Host "x86 File Storage Folder Name: $x86"
  254. Write-Host "x64 File Storage Folder Name: $x64"
  255. Write-Host "WOW64 File Storage Folder Name: $WOW"
  256. Write-Host "MSIL File Storage Folder Name: $MSIL"
  257. Write-Host "Junk File Storage Folder Name: $JUNK"
  258. Write-Host "Orignal Patch File Storage Folder Name: $BIN"
  259.  
  260. $SYSPATH = Join-Path -path (get-item env:\windir).Value -ChildPath "system32"
  261.  
  262. $EXPAND = Join-Path -path $SYSPATH -ChildPath "expand.exe"
  263.  
  264.  
  265. if (!(Test-Path $EXPAND))
  266. {
  267.     Throw ("Error: Cannot find 'Expand.exe' in the $SYSPATH folder.")
  268. }
  269.  
  270. $ARG = '-F:* ' + '"' + $PATCH + '" ' + '"' + $PATH + '"'
  271.  
  272. Write-Host "Executing the following command: $EXPAND $ARG" -ForegroundColor Green
  273.  
  274. Start-Process -File $EXPAND -ArgumentList $ARG -Wait
  275.  
  276.  
  277.  
  278. $CAB = Join-Path -path $PATH -ChildPath $((Get-ChildItem $PATCH).Basename + ".CAB")
  279.  
  280. if ((!(Test-Path $CAB)) -or ($CAB -eq ""))
  281. {
  282.     Write-Host "PATH = $PATH"
  283.     Write-Host (Get-ChildItem -Path $PATH -Filter *.cab)
  284.     ### Look for first existing CAB file in the directory as backup
  285.     $CAB = (Get-ChildItem -Path $PATH -Filter *.cab | Select-Object -First 1)
  286.     Write-Host "CAB = $CAB"
  287.     if (!(Test-Path $CAB))
  288.     {
  289.         Throw "Error: Patch .CAB File could not be located.  Patch Extraction failed - please send notification of this error to @Laughing_Mantis."
  290.     }
  291. }
  292. <# Microsoft newer patches do not follow this formula - likely an attempt to prevent
  293. auto extraction so we need to handle scenarios where patch cab does not have the same
  294. name as the container MSP #>
  295.  
  296.  
  297.  
  298. $ARG = '-F:* ' + '"' + $CAB + '" ' + '"' + $PATH + '"'
  299.  
  300. Write-Host "Executing the following command: $EXPAND $ARG" -ForegroundColor Green
  301.  
  302. Start-Process -File $EXPAND -ArgumentList $ARG -Wait
  303.  
  304. <# Nov 7th, 2016 - Looks like Microsoft doesn't like my tool and added new sub-CABs to make automagic patch extraction not work.
  305. Adding an additional check to look for sub-CABs incase this becomes the new normal.
  306. This is an absolute hack that will likely be bypassed next month.
  307. #>
  308.  
  309.  
  310. $patchCAB = 1
  311. Write-Host "PATH = $PATH"
  312. Write-Host (Get-ChildItem -Path $PATH -Filter *.cab)
  313. ### Look for first existing CAB file in the directory as backup
  314.  
  315.  
  316.  
  317. $patchCABID = "cab_" + $patchCAB + "_*.cab"
  318. $CAB = (Get-ChildItem -Path $PATH -Filter $PatchCABID | Select-Object -First 1)
  319. Write-Host "Debug CAB = $CAB"
  320. if (Test-Path $CAB)
  321. {
  322.     $flag = "1"
  323. }
  324.  
  325. while ($flag -eq "1")
  326. {
  327.     Write-Host "Subsequent CAB  $CAB detected - attempting beta extraction" -ForegroundColor Yellow
  328.     $ARG = '-F:* ' + '"' + $CAB + '" ' + '"' + $PATH + '"'
  329.  
  330.     Write-Host "Executing the following command: $EXPAND $ARG" -ForegroundColor Green
  331.  
  332.     Start-Process -File $EXPAND -ArgumentList $ARG -Wait
  333.  
  334.     $patchCAB++
  335.  
  336.     $patchCABID = "cab_" + $patchCAB + "_*.cab"
  337.     try
  338.     {
  339.         $CAB = (Get-ChildItem -Path $PATH -Filter $PatchCABID | Select-Object -First 1)
  340.         if ((!(Test-Path $CAB)) -or ($CAB -eq ""))
  341.         {
  342.             $flag = "0"
  343.         }
  344.     }
  345.     catch
  346.     {
  347.         $flag = "0"
  348.     }
  349.  
  350. }
  351.  
  352. $PATCHx86 = Join-Path -path $PATH -ChildPath $x86
  353. $PATCHx64 = Join-Path -path $PATH -ChildPath $x64
  354. $PATCHWOW = Join-Path -path $PATH -ChildPath $WOW
  355. $PATCHMSIL = Join-Path -path $PATH -ChildPath $MSIL
  356. $PATCHJUNK = Join-Path -path $PATH -ChildPath $JUNK
  357. $PATCHCAB = Join-Path -path $PATH -ChildPath $BIN
  358.  
  359.  
  360. if (!(Test-Path $PATCHx86 -pathType Container))
  361. {
  362.     New-Item $PATCHx86 -Force -ItemType Directory
  363.     Write-Host "Making $PATCHx86 Folder" -ForegroundColor Green
  364. }
  365.  
  366. if (!(Test-Path $PATCHx64 -pathType Container))
  367. {
  368.     New-Item $PATCHx64 -Force -ItemType Directory
  369.     Write-Host "Making $PATCHx64 Folder" -ForegroundColor Green
  370. }
  371.  
  372. if (!(Test-Path $PATCHWOW -pathType Container))
  373. {
  374.     New-Item $PATCHWOW -Force -ItemType Directory
  375.     Write-Host "Making $PATCHWOW Folder" -ForegroundColor Green
  376. }
  377.  
  378. if (!(Test-Path $PATCHMSIL -pathType Container))
  379. {
  380.     New-Item $PATCHMSIL -Force -ItemType Directory
  381.     Write-Host "Making $PATCHMSIL Folder" -ForegroundColor Green
  382. }
  383.  
  384. if (!(Test-Path $PATCHJUNK -pathType Container))
  385. {
  386.     New-Item $PATCHJUNK -Force -ItemType Directory
  387.     Write-Host "Making $PATCHJUNK Folder" -ForegroundColor Green
  388. }
  389.  
  390. if (!(Test-Path $PATCHCAB -pathType Container))
  391. {
  392.     New-Item $PATCHCAB -Force -ItemType Directory
  393.     Write-Host "Making $PATCHCAB Folder" -ForegroundColor Green
  394. }
  395.  
  396.  
  397. $PATCHFolders = Get-ChildItem -Path $PATH -Force -ErrorAction SilentlyContinue | where {$_.Attributes -eq 'Directory'}
  398.  
  399. foreach ($folder in $PATCHFolders)
  400. {
  401.     if ($folder.Name.Contains(".resources_"))
  402.     {
  403.         Move-Item $folder.FullName $PATCHJUNK -Force
  404.         Write-Host "Moving $folder to $PATCHJUNK" -ForegroundColor Green
  405.         Continue
  406.     }
  407.     else
  408.     {
  409.         if ($folder.Name.StartsWith("x86_"))
  410.         {
  411.             Move-Item $folder.FullName $PATCHx86 -Force
  412.             Write-Host "Moving $folder to $PATCHx86" -ForegroundColor Green
  413.             Continue
  414.         }
  415.        
  416.         if ($folder.Name.StartsWith("amd64_"))
  417.         {
  418.             Move-Item $folder.FullName $PATCHx64 -Force
  419.             Write-Host "Moving $folder to $PATCHx64" -ForegroundColor Green
  420.             Continue
  421.         }
  422.        
  423.         if ($folder.Name.StartsWith("wow64_"))
  424.         {
  425.             Move-Item $folder.FullName $PATCHWOW -Force
  426.             Write-Host "Moving $folder to $PATCHWOW" -ForegroundColor Green
  427.             Continue
  428.         }
  429.  
  430.         if ($folder.Name.StartsWith("msil_"))
  431.         {
  432.             Move-Item $folder.FullName $PATCHMSIL -Force
  433.             Write-Host "Moving $folder to $PATCHMSIL" -ForegroundColor Green
  434.             Continue
  435.         }
  436.     }
  437. }
  438.  
  439. <# PRETTY BINDIFF OUTPUT - changes folder names from x86-microsoft-windows-filename-hash-version-garbage to filename-version #>
  440.  
  441. $PATCHFolders = Get-ChildItem -Path $PATCHx86 -Force -ErrorAction SilentlyContinue | where {$_.Attributes -eq 'Directory'}
  442.  
  443. foreach ($folder in $PATCHFolders)
  444. {
  445.     if ($folder -like "x86_microsoft-windows-*")
  446.     {
  447.         $newfolder = $folder.Name.Replace("x86_microsoft-windows-", "")
  448.         $newname = $newfolder.Split("_")[0]
  449.         $version = $newfolder.Split("_")[2]
  450.         $newname = $newname + "_" + $version
  451.         Write-Host ("Renaming $folder to $newname") -ForegroundColor Green
  452.         Rename-Item -path $folder.FullName -newName ($newname)
  453.     }
  454.     elseif ($folder -like "x86_*")
  455.     {
  456.         $newfolder = $folder.Name.Replace("x86_", "")
  457.         $newname = $newfolder.Split("_")[0]
  458.         $version = $newfolder.Split("_")[2]
  459.         $newname = $newname + "_" + $version
  460.         Write-Host ("Renaming $folder to $newname") -ForegroundColor Green
  461.         Rename-Item -path $folder.FullName -newName ($newname)
  462.     }
  463. }
  464.  
  465. $PATCHFolders = Get-ChildItem -Path $PATCHx64 -Force -ErrorAction SilentlyContinue | where {$_.Attributes -eq 'Directory'}
  466.  
  467. foreach ($folder in $PATCHFolders)
  468. {
  469.     if ($folder -like "amd64_microsoft-windows-*")
  470.     {
  471.         $newfolder = $folder.Name.Replace("amd64_microsoft-windows-", "")
  472.         $newname = $newfolder.Split("_")[0]
  473.         $version = $newfolder.Split("_")[2]
  474.         $newname = $newname + "_" + $version
  475.         Write-Host ("Renaming $folder to $newname") -ForegroundColor Green
  476.         Rename-Item -path $folder.FullName -newName ($newname)
  477.     }
  478.     elseif ($folder -like "amd64_*")
  479.     {
  480.         $newfolder = $folder.Name.Replace("amd64_", "")
  481.         $newname = $newfolder.Split("_")[0]
  482.         $version = $newfolder.Split("_")[2]
  483.         $newname = $newname + "_" + $version
  484.         Write-Host ("Renaming $folder to $newname") -ForegroundColor Green
  485.         Rename-Item -path $folder.FullName -newName ($newname)
  486.     }
  487. }
  488.  
  489. $PATCHFolders = Get-ChildItem -Path $PATCHWOW -Force -ErrorAction SilentlyContinue | where {$_.Attributes -eq 'Directory'}
  490.  
  491. foreach ($folder in $PATCHFolders)
  492. {
  493.     if ($folder -like "wow64_microsoft-windows-*")
  494.     {
  495.         $newfolder = $folder.Name.Replace("wow64_microsoft-windows-", "")
  496.         $newname = $newfolder.Split("_")[0]
  497.         $version = $newfolder.Split("_")[2]
  498.         $newname = $newname + "_" + $version
  499.         Write-Host ("Renaming $folder to $newname") -ForegroundColor Green
  500.         Rename-Item -path $folder.FullName -newName ($newname)
  501.     }
  502.     elseif ($folder -like "wow64_*")
  503.     {
  504.         $newfolder = $folder.Name.Replace("wow64_", "")
  505.         $newname = $newfolder.Split("_")[0]
  506.         $version = $newfolder.Split("_")[2]
  507.         $newname = $newname + "_" + $version
  508.         Write-Host ("Renaming $folder to $newname") -ForegroundColor Green
  509.         Rename-Item -path $folder.FullName -newName ($newname)
  510.     }
  511. }
  512.  
  513. $PATCHFolders = Get-ChildItem -Path $PATCHMSIL -Force -ErrorAction SilentlyContinue | where {$_.Attributes -eq 'Directory'}
  514.  
  515. foreach ($folder in $PATCHFolders)
  516. {
  517.     if ($folder -like "msil_*")
  518.     {
  519.         $newfolder = $folder.Name.Replace("msil_", "")
  520.         $newname = $newfolder.Split("_")[0]
  521.         $version = $newfolder.Split("_")[2]
  522.         $newname = $newname + "_" + $version
  523.         Write-Host ("Renaming $folder to $newname") -ForegroundColor Green
  524.         Rename-Item -path $folder.FullName -newName ($newname)
  525.     }
  526.  
  527. }
  528.  
  529. $Junkfiles = Get-ChildItem -Path $PATH -Force -ErrorAction SilentlyContinue
  530.  
  531.  
  532. foreach ($JunkFile in $Junkfiles)
  533. {
  534.    
  535.     try
  536.     {
  537.         if (($JunkFile.Name.EndsWith(".manifest")) -or ($JunkFile.Name.EndsWith(".cat")) -or ($JunkFile.Name.EndsWith(".mum")))
  538.         {
  539.             Move-Item $JunkFile.FullName $PATCHJUNK -Force -ErrorAction SilentlyContinue
  540.             Write-Host "Moving $JunkFile to $PATCHJUNK" -ForegroundColor Green
  541.             Continue
  542.         }
  543.        
  544.         if (($JunkFile.Name.EndsWith(".cab")) -or ($JunkFile.Name.EndsWith(".xml")) -or ($JunkFile.Name.EndsWith(".msu")) -or ($JunkFile.Name.EndsWith("pkgProperties.txt")))
  545.         {
  546.             Move-Item $JunkFile.FullName $PATCHCAB -Force -ErrorAction SilentlyContinue
  547.             Write-Host "Moving $JunkFile to $PATCHCAB" -ForegroundColor Green
  548.             Continue
  549.         }
  550.         if ($JunkFile.Name -eq "patch")
  551.         {
  552.             Move-Item $JunkFile.FullName $PATCHCAB -Force -ErrorAction SilentlyContinue
  553.             Write-Host "Moving $JunkFile to $PATCHCAB" -ForegroundColor Green
  554.             Continue
  555.         }
  556.     }
  557.     catch
  558.     {
  559.         Write-Host "Error Processing ($JunkFile.Fullname)" -ForegroundColor Red
  560.     }
  561. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement