Support Forum: Get Support for Patch My PC Products and Services

Microsoft Configuration Manager and Intune (Enterprises/Paid) => Support and General Questions (Enterprises Using ConfigMgr and Intune) => Topic started by: Red5sb on December 11, 2024, 07:43:51 AM

Title: Does anyone have experience running the PMPC community Software-Uninstall script
Post by: Red5sb on December 11, 2024, 07:43:51 AM
 https://github.com/PatchMyPCTeam/Community-Scripts/tree/main/Uninstall/Pre-Uninstall/Uninstall-Software

I can't add arguments when executing the PS1 from the cloud portal, so I'm trying to specify values like $DisplayName within the PS1 itself. I've set that value in the script in both locations where $DisplayName is set: under the 'AdditionalArguments' parameters, and under the Get-InstalledSoftware function.

Yet when I test run the PS1, it still prompts me to enter a value for DisplayName in the command line:
cmdlet Uninstall-Software.ps1 at command pipeline position 1
Supply values for the following parameters:
DisplayName:

Anyone know how I need to properly supply this value (or others) within the PS1?
Title: Re: Does anyone have experience running the PMPC community Software-Uninstall script
Post by: Nithin (Patch My PC) on December 12, 2024, 03:04:58 AM
Hello Red5sb,

As an example, I have used the Anywhere 365 integrator MSI version of the app to uninstall with Uninstall All Argument.
Please note that the Community Uninstall script queries the MSI silent uninstall string, and you can hardcode the silent uninstall string as suggested by the vendor; otherwise, the uninstallation may fail.

Please let me know if you have any questions or concerns.

param (
    [Parameter(Mandatory = $false)]
    [String]$DisplayName = "*Anywhere365 Integrator*",
 
    [Parameter()]
    [ValidateSet('Both', 'x86', 'x64')]
    [String]$Architecture = 'Both',
 
    [Parameter()]
    [ValidateSet('HKLM', 'HKCU')]
    [String[]]$HivesToSearch = 'HKLM',
 
    [Parameter()]
    [ValidateSet(1, 0)]
    [Int]$WindowsInstaller,
 
    [Parameter()]
    [ValidateSet(1, 0)]
    [Int]$SystemComponent,
 
    [Parameter()]
    [String]$VersionLessThan,
 
    [Parameter()]
    [String]$VersionEqualTo,
 
    [Parameter()]
    [String]$VersionGreaterThan,
 
    [Parameter(ParameterSetName = 'EnforcedArguments')]
    [String]$EnforcedArguments,
 
    [Parameter(ParameterSetName = 'AdditionalArguments')]
    [String]$AdditionalArguments,
 
    [Parameter(ParameterSetName = 'AdditionalEXEorMSIArguments')]
    [String]$AdditionalMSIArguments,
 
    [Parameter(ParameterSetName = 'AdditionalEXEorMSIArguments')]
    [String]$AdditionalEXEArguments,
 
    [Parameter()]
    [Switch]$UninstallAll = $true,
 
    [Parameter()]
    [Switch]$Force,
 
    [Parameter()]
    [String]$ProcessName,
 
    [Parameter()]
    [String[]]$RemovePath
)




Title: Re: Does anyone have experience running the PMPC community Software-Uninstall script
Post by: gwalker1 on February 27, 2025, 09:46:43 PM
Can the uninstall script be packaged as a Win32 application and run in system context with parameters being stated in the command line?
Title: Re: Does anyone have experience running the PMPC community Software-Uninstall script
Post by: Nithin (Patch My PC) on February 28, 2025, 02:35:42 AM
Hey Gwalker1,

The script above has been hardcoded to uninstall "Anywhere365 Integrator" as an example. Yes, you can use a community script to uninstall apps by modifying the parameters as needed.
Title: Re: Does anyone have experience running the PMPC community Software-Uninstall script
Post by: vercel on March 06, 2025, 07:24:24 AM
It looks like the script isn't picking up the predefined value for $DisplayName. Try setting a default value within the script like $DisplayName = "YourValue" at the beginning. Also, ensure the parameter is not marked as [Parameter(Mandatory=$true)]. If you're running this via a cloud portal, check if the execution environment supports passing inline parameters. You might find more troubleshooting steps on the official documentation website (https://ikonicdev.com/).
Title: Re: Does anyone have experience running the PMPC community Software-Uninstall script
Post by: Nithin (Patch My PC) on March 07, 2025, 12:47:47 AM
Hey Vercel,

The script above is an example for uninstalling the Anywhere365 Integrator app. You can find the full script available on our GitHub repository here:
https://github.com/PatchMyPCTeam/Community-Scripts/blob/main/Uninstall/Pre-Uninstall/Uninstall-Software/Uninstall-Software.ps1

Let me know if you need any further assistance.