Cush Posted July 7, 2022 Posted July 7, 2022 Apologies if this is answered elsewhere, I have searched the menu. I am using the Chrome UDF without issues, but have noticed that sometimes Chrome randomly starts the Software Reporter Tool which is a resource-hog. I address this currently by removing permissions from the .exe file but when Chrome updates itself these are restored. One option is to delete the .exe altogether which I thought I could achieve using FileExists and FileDelete, but the problem is the path where the tool is located has a variable element. For this computer the path is C:\Users\Dell\AppData\Local\Google\Chrome\User Data\SwReporter\102.286.200\software_reporter_tool.exe The '102.286.200' changes from time to time, so what I'd like to be able to do is obtain that part of the path using a script so I can assemble the delete commands properly. Any help much appreciated
Nine Posted July 7, 2022 Posted July 7, 2022 (edited) StringInStr with StringMid can perform this. SRER can do it quite easily. #include <Constants.au3> Local $sURL = "C:\Users\Dell\AppData\Local\Google\Chrome\User Data\SwReporter\102.286.200\software_reporter_tool.exe" Local $sSub = StringRegExpReplace($sURL, ".*\\SwReporter\\(.*)\\.*", "$1") MsgBox($MB_SYSTEMMODAL, "Test", $sSub) Edited July 7, 2022 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy
Solution Subz Posted July 7, 2022 Solution Posted July 7, 2022 Alternatively you could use _FileListToArrayRec to find all instances of software_reporter_tool.exe and delete, for example: #include <File.au3> Global $g_aSWReporter = _FileListToArrayRec(@LocalAppDataDir & "\Google\Chrome\User Data", "software_reporter_tool.exe", 1, 1, 0, 2) If @error Then Exit For $i = 1 To $g_aSWReporter[0] ;~ Uncomment below to delete instance ;~ FileDelete($g_aSWReporter[$i]) ConsoleWrite($g_aSWReporter[$i] & @CRLF) Next
rudi Posted July 8, 2022 Posted July 8, 2022 in addition to the solutions provided already I'd like to mention to create a SYSTEM task, that will cleanup all occurences in all local user profiles, running e.g. at 08:00 AM every day: #RequireAdmin $SchTasks="schtasks.exe" $Daily="täglich" ; modify to your localization's string for "daily" --> schtasks /create /? $Highest="höchste" ; modify to your localization's string for "higest" $Time24="08:00" $Params = '/create /ru "SYSTEM" /tn "Delete Chrome Software Reporter from all user profiles" /tr "C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -command &{gci c:\users\software_reporter_tool.exe -r -file -force -ea si | remove-item -force}" /sc ' & $Daily & ' /st ' & $Time24 & ' /HRESULT /RL ' & $Highest & ' /f' $result=ShellExecuteWait($SchTasks,$Params) MsgBox(0,"Result",$result) with the additional parameter " /s OtherPChostName" you can push this as a scheduled task to remote PCs as well (admin rights required on the remote system, of course) Earth is flat, pigs can fly, and Nuclear Power is SAFE!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now