Clear user's ie Form Data, Browser History, cookies and one more thing

So we have this crappy application to uninstall it, you need to delete folder from C:\users*\appdadata…
I think I have that right I have tested it and it seems to be working fine.
However, I have a few problems. the application is user profile specif, so there are things that need to be done as the user. one is Clear browser history, cookies, temporary internet files, and etc.
1 = Browsing History
2 = Cookies
4 = Temporary Internet Files
8 = Offline favorites and download history
16 = Form Data

I’m not sure if that’s how the below code would work and for the current user or If I need to use “Execute-ProcessAsUser” However since its something from windows do I still use the

`Execute-Process -Path "RunDll32.exe" -Parameters 'InetCpl.cpl,ClearMyTracksByProcess 2'

or

`Execute-ProcessAsUser -Path "RunDll32.exe" -Parameters 'InetCpl.cpl,ClearMyTracksByProcess 2' -Wait

Then I have never been able to do this (the one more thing)
This part I have alwasy had a .bat script calling it and the user was clicking allow. but this was when I wasusing BigFix. now with SCCM Im trying to leverage this tool more and be more automated. this would be a great help as well if any of you had ever had to deal with this before.

This is the code and Im getting erros now after I added the execute-prcessasuser I wasnt getting erros when I was running it as execute-process

##*===============================================
		##* PRE-INSTALLATION
		##*===============================================
		[string]$installPhase = 'Pre-Installation'

		## Show Welcome Message, close Internet Explorer if required, allow up to 3 deferrals, verify there is enough disk space to complete the install, and persist the prompt
		Show-InstallationWelcome -CloseApps 'iexplore,' -silent -CheckDiskSpace -PersistPrompt
    
		## Show Progress Message (with the default message)
		Show-InstallationProgress

		## <Perform Pre-Installation tasks here>
       
        Execute-Process -Path "$envLocalAppData\Programs\composer-launch-pad\Uninstall ComposerLaunchPad.exe" /S
        Remove-Folder -Path "$envLocalAppData\Programs\composer-launch-pad\resources\app.asar.unpacked\app\extern\windows\screen-rec"
        Remove-Folder -Path "$envLocalAppData\Programs\composer-launch-pad"
        Remove-Folder -Path "$envLocalAppData\Google\Chrome\User Data\Default\Cache"
        Remove-Folder -Path "$envAppData\ComposerLaunchPad"
        Remove-Folder -Path "$envAppData\composer-launch-pad"
        ## History
        Execute-ProcessAsUser -Path "$envSystem32Directory\RunDll32.exe" -Parameters 'InetCpl.cpl,ClearMyTracksByProcess 1' -wait
        ##Cookies:
        Execute-ProcessAsUser -Path "$envSystem32Directory\RunDll32.exe" -Parameters 'InetCpl.cpl,ClearMyTracksByProcess 2' -wait
        ## Temp Internet Files:
        Execute-ProcessAsUser -Path "$envSystem32Directory\RunDll32.exe" -Parameters 'InetCpl.cpl,ClearMyTracksByProcess 8' -wait
        Execute-ProcessAsUser -Path "$envSystem32Directory\RunDll32.exe" -Parameters 'InetCpl.cpl,ClearMyTracksByProcess 4' -wait
        ## Form Data:
        Execute-ProcessAsUser -Path "$envSystem32Directory\RunDll32.exe" -Parameters 'InetCpl.cpl,ClearMyTracksByProcess 16' -wait

I think I got an idea for the window. but its not working.

        Execute-ProcessAsUser -Path "$envProgramFilesX86\Internet Explorer\iexplore.exe" -Parameters "clp://launchurl=https://hosted.com/WebAgent/Default.aspx" 
        Send-Keys -WindowTitle 'internet explorer' -Key 'a' -WaitSeconds 5

Any ideas or help would be great!

What error are you getting?

Also, if you want to open an app through internet explorer, it will always ask for permission.

I’m not getting an error anymore. However, I don’t see the prompts that you normally see IE do when it’s being executed per se in a .bat
image

This is the code ATM

       If ([System.IO.File]::Exists("$envLocalAppData\Programs\composer-launch-pad\Uninstall ComposerLaunchPad.exe"))
       {
        Execute-ProcessAsUse -Path "$envLocalAppData\Programs\composer-launch-pad\Uninstall ComposerLaunchPad.exe" /S
        Remove-Folder -Path "$envLocalAppData\Programs\composer-launch-pad\resources\app.asar.unpacked\app\extern\windows\screen-rec"
        Remove-Folder -Path "$envLocalAppData\Programs\composer-launch-pad"
        Remove-Folder -Path "$envLocalAppData\Google\Chrome\User Data\Default\Cache"
        Remove-Folder -Path "$envAppData\ComposerLaunchPad"
        Remove-Folder -Path "$envAppData\composer-launch-pad"
        ## History
        Execute-ProcessAsUser -Path "$envSystem32Directory\RunDll32.exe" -Parameters 'InetCpl.cpl,ClearMyTracksByProcess 1' -wait
        ##Cookies:
        Execute-ProcessAsUser -Path "$envSystem32Directory\RunDll32.exe" -Parameters 'InetCpl.cpl,ClearMyTracksByProcess 2' -wait
        ## Temp Internet Files:
        Execute-ProcessAsUser -Path "$envSystem32Directory\RunDll32.exe" -Parameters 'InetCpl.cpl,ClearMyTracksByProcess 8' -wait
        Execute-ProcessAsUser -Path "$envSystem32Directory\RunDll32.exe" -Parameters 'InetCpl.cpl,ClearMyTracksByProcess 4' -wait
        ## Form Data:
        Execute-ProcessAsUser -Path "$envSystem32Directory\RunDll32.exe" -Parameters 'InetCpl.cpl,ClearMyTracksByProcess 16' -wait
        }
    
		##*===============================================
		##* INSTALLATION
		##*===============================================
		[string]$installPhase = 'Installation'

		## Handle Zero-Config MSI Installations
		If ($useDefaultMsi) {
			[hashtable]$ExecuteDefaultMSISplat =  @{ Action = 'Install'; Path = $defaultMsiFile }; If ($defaultMstFile) { $ExecuteDefaultMSISplat.Add('Transform', $defaultMstFile) }
			Execute-MSI @ExecuteDefaultMSISplat; If ($defaultMspFiles) { $defaultMspFiles | ForEach-Object { Execute-MSI -Action 'Patch' -Path $_ } }
		}

		## <Perform Installation tasks here>
        Execute-ProcessAsUser "composerlaunchpad.exe" /S
        Execute-ProcessAsUser -Path "$envProgramFilesX86\Internet Explorer\iexplore.exe" -Parameters "clp://launchurl=https://acmblsiisa1priv.noblehosted.com/NobleWebAgent/Default.aspx" -Wait
        Set-RegistryKey -Key 'HKEY_LOCAL_MACHINE\SYSTEM\ADT\Noble' -Name 'version' -Value '115' -Type String
        Send-Keys -WindowTitle 'internet explorer' -Key 'Allow'

I mean all of this browser data is stored in files so you can just delete it as files.

Your approach will open a closable window. You could just do a MessageBox with Yes/No and ask for permission to delete their saved data if you need their approval. Otherwise just remove it as files.