Any luck referencing uninstaller in AppData directory?

Hi there!

I am working on a PSADT script for a program whom their uninstaller is in the APPDATA folder. I'm having a hard time getting the path correct - here is what I have currently:

Start-ADTProcess -FilePath "$env\LOCALAPPDATA\Programs\FSLink Configuration Software\unins000.exe" -ArgumentList '/VERYSILENT /norestart' -Wait -WindowStyle 'Hidden' -PassThru

Do you think the issue is with the file path or would a different cmdlet be more appropriate for something like this? Since this uninstaller is coded to delete itself after its initialized, putting it in the Files folder under PSADT template is not an option.

Thanks!

Depending on where and how you are launching PSADT, Start-ADTProcessAsUser might be a better fit.

But the variable should be $envLocalAppData. You have a \ that doesn't belong.

Instead of:

Or as @JimO says, try this:
Start-ADTProcess -FilePath "$envLocalAppData\Programs\FSLink Configuration Software\unins000.exe" -ArgumentList '/VERYSILENT /norestart' -Wait -WindowStyle 'Hidden' -PassThru

FYI: I'm assuming you are installing as the user, too.

The application will eventually be installed as SYSTEM (we are going to create a Win32 Intune package for deployment).

Thank you. The app will eventually be deployed via Intune, so it's being installed as SYSTEM. Would your recommendation to use Start-ADTProcessAsUser apply in that case?

Unfortunately, both of these options did not work.

Message : Exception calling "LaunchAsync" with "1" argument(s): "The system cannot find the file specified.

                    The system cannot find the file specified.
                    "

InnerException : System.IO.FileNotFoundException: The system cannot find the file specified.

                    The system cannot find the file specified.

                       at PSADT.LibraryInterfaces.Kernel32.CreateProcess(String lpApplicationName, Span`1& lpCommandLine, Nullable`1 lpProcessAttributes, Nullable`1 lpThreadAttributes, BOOL bInheritHandles, PROCESS_CREATION_FLAGS dwCreationFlags, SafeEnvironmentBlockHandle lpEnvironment, String lpCurrentDirectory, STARTUPINFOW& lpStartupInfo, PROCESS_INFORMATION& lpProcessInformation) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT\LibraryInterfaces\Kernel32.cs:line 293
                       at PSADT.ProcessManagement.ProcessManager.LaunchAsync(ProcessLaunchInfo launchInfo) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT\ProcessManagement\ProcessManager.cs:line 0
                       at CallSite.Target(Closure , CallSite , Type , Object )

If you are using Start-ADTProcess and are running as System, $envLocalAppData would resolve to "C:\WINDOWS\system32\config\systemprofile\AppData\Local". Does the file exist there?

It does not. It is here:

C:\Users(USERACCOUNT)\AppData\Local\Programs\FSLink Configuration Software

Edit: We will only running the install as SYSTEM when it is packaged as a Intune WinApp file. I'm just running as a local admin on my machine for testing - not sure if that helps but wanted to distinguish just in case.

Folks......I am a ding dong.

Please excuse my newness, but I found the problem.

One thing I neglected to mention is that the script I am working on is actually installing TWO programs, but they are related and interact with each other. The install/uninstall process worked fine for the first application but the second one failed. I thought that with subsequent changes I was making for the secondary program having trouble, it would just ignore the first line calling for the uninstallation of the first program.

Nope. Because the first program was uninstalled with the previous test, the script was failing because it could no longer find the uninstaller for the first application in the code.

Anyway. Once I removed the lines for testing, install/uninstall process now works thanks to making a slight revision to the code (which you lovely folks helped with).

Thank you. I am still very new, still learning. Appreciate your help and patience!

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.