I am trying to execute the below PowerShell code in Jenkins and see the SUCCESS message, but in the control panel, the application still remains as it is. I have downloaded the PowerShell plugin to directly execute PowerShell scripts.
I can execute the script manually without an issue.
Windows Powershell script code:
$uninstallString = gci "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" | foreach { gp $_.PSPath } | ? { $_ -match "program name" } | select BundleCachePath
if ($uninstallString -ne $null){Start-Process $uninstallString.BundleCachePath -ArgumentList "-Uninstall -Quiet -Wait"}else{Write-Host "Uninstall string not found!"}
I have also tried to run the command using "&" operator:
& "G:\uninstall\uninstall.ps1
I have created a freestyle project to do so.
I am not seeing any error after running the job. Is there something I am missing or I need to configure?
Building in workspace C:\Program Files (x86)\Jenkins\workspace\Uninstall_ORD
[Uninstall_ORD] $ powershell.exe -NonInteractive -ExecutionPolicy ByPass "& 'C:\Windows\TEMP\jenkins6372953575964806337.ps1'"
Finished: SUCCESS
Thanks,
H