Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

Uninstall w/wildcards for Yahoo Search Set

Hi All,

Is there a way for PDQ, or a script, to allow a wildcard in a path to uninstall software? e.g. Yahoo Search Set. For example, Yahoo is one of those fantastic companies that uses a random ID in their uninstall process making it difficult for mass removal. Here's a list of 3 different PC's with it installed and the uninstall command:

PC1: "C:\Program Files (x86)\Yahoo!\yset{6C65AE16-DBA3-7740-B2F9-6487B83696A1}\unset.exe"
PC2: "C:\Program Files (x86)\Yahoo!\yset{4EAB7C76-98E3-9E4B-8369-A856659E96B8}\unset.exe"
PC3: "C:\Program Files (x86)\Yahoo!\yset{7EADCBA3-B431-904C-B312-4F13A62D76B7}\unset.exe"

I'm looking for a creative way to essentially do this in my uninstall package; wildcard the unique ID and keep the rest of the path since that doesn't change.

"C:\Program Files (x86)\Yahoo!\yset*\unset.exe"

If it needs to be a script, is it possible to dig into 'C:\Program Files (x86)\Yahoo!\yset', then search each subfolder for 'unset.exe' and execute it?

Thanks for any assistance you can provide.

Rory

0

Comments

5 comments
Date Votes
  • I would LOVE to be able to do this for those programs that include their version numbers in their install path (I'm looking at you Adobe!).

    0
  • Since the majority of the path is the same, you could gather those items with PowerShell and wild cards.

    For Example, iTunes in my repository:

    Get-Item D:\Repository\Apple\iTunes\*\32\iTunes.msi
        Directory: D:\Repository\Apple\iTunes\12.6.0.100\32
    Mode                LastWriteTime         Length Name
    ----                -------------         ------ ----
    -a----        3/22/2017   8:07 PM      150200320 iTunes.msi
        Directory: D:\Repository\Apple\iTunes\12.6.2.20\32
    Mode                LastWriteTime         Length Name
    ----                -------------         ------ ----
    -a----        7/19/2017   1:44 PM      153620480 iTunes.msi
        Directory: D:\Repository\Apple\iTunes\12.7.0.166\32
    Mode                LastWriteTime         Length Name
    ----                -------------         ------ ----
    -a----        9/11/2017   4:19 PM      151175168 iTunes.msi
    

    Then with your example: C:\Program Files (x86)\Yahoo!*\unset.exe That should work for getting all those different versions. You'll want to store it into a variable, and for each object perform the desired task.

    I put in some extra output to demonstrate it was grabbing and running for each one of the found files, but here's basically what you could do: Example!

    0
  • @chrisj Thank you for that! On your screenshot, and the 'Start-Process $_ -ArgumentList' portion, does that look at the iTunes.msi for all applicable parameters, or is it assuming I know what the parameter is to be specified like you did with "help"?

    0
  • I was able to get this working fine for the Yahoo Search Set so I greatly appreciate the assistance. I struggled a little with how Deploy handles path wildcards. I couldn't use %PROGRAMFILES(x86)% and had to hard code the path instead. It appeared Deploy hard-coded the wildcard. Error here:

    Get-Item : Cannot find path 'C:\windows\AdminArsenal\PDQDeployRunner\service-1\exec%PROGRAMFILES(x86)%\Yahoo!\yset' because it does not exist.

    Regardless, it wasn't a concern. I was using the built-in PowerShell script Step in the package so I adjusted and seems to work great.

    Here is the final script I used as @chrisj so kindly showed us:

    $YahooSearchSet = Get-Item "C:\Program Files (x86)\Yahoo!\yset\*\unset.exe"
    
    $YahooSearchSet | ForEach-Object {
    Start-Process $_
    }
    

    This should make uninstalling these types of software much easier in the future.

    0
  • That variable is ${env:ProgramFiles(x86)} in PowerShell. The {} are necessary due to the () in the name. You can see all PowerShell environment variables by running Get-ChildItem env:* | Sort-Object Name.

    0