I have been asked to write a package to remove all versions of adobe reader in my environment. We have everything from 9 to 11 and DC, so trying to create packages to uninstall all the various incremental versions doesn't seem feasible. Instead, I wrote a 2 line powershell script that will accomplish this easily:
$findapp = Get-WmiObject -Class win32_product | where-object -FilterScript {$_.Name -like "*Reader*"}
$findapp.uninstall()
(I'm aware of the get-installedsoftware option, but this will work, and is a lot less code considering the number of possible items installed..)
I created a distribution package with that script, and it will not run. Typical results in the sdclient_taskxxxx log is as follows:
Mon, 19 Feb 2018 17:18:01 ******* sdclient starting to process task *******
Mon, 19 Feb 2018 17:18:01 Task id to process: 4363
Mon, 19 Feb 2018 17:18:01 Command line: /policyfile="C:\ProgramData\LANDesk\Policies\CP.4363.RunNow._p4bNGvpgo3tj9xLYTTL+4Kcji9g=.xml"
Mon, 19 Feb 2018 17:18:01 The nostatus flag has NOT been set.
Mon, 19 Feb 2018 17:18:01 Core name 'CORE-SERVER.DOMAIN.COM' obtained from the registry
Mon, 19 Feb 2018 17:18:01 Sending task status, cmd line -coreandip=CORE-SERVER.DOMAIN.COM -taskid=4363 -retcode=229392442 "-ldap=CN=Administrative user - ,OU=Workstation,OU=Admins,OU=Accounts,DC=DOMAIN,DC=COM" -pkgid=xxxx
Mon, 19 Feb 2018 17:18:02 IsFileInCache: Cache2.GetFilePrevCountEx failed - path=\\core-server\distribution\scripts\UninstallAdobeReader.ps1
Mon, 19 Feb 2018 17:18:02 File (\\core-server\distribution\scripts\UninstallAdobeReader.ps1) is not in cache
Mon, 19 Feb 2018 17:18:02 The nostatus flag has NOT been set.
Mon, 19 Feb 2018 17:18:02 Core name 'CORE-SERVER.DOMAIN.COM' obtained from the registry
Mon, 19 Feb 2018 17:18:02 Sending task status, cmd line -coreandip=CORE-SERVER.DOMAIN.COM -taskid=4363 -retcode=229392444 "-ldap=CN=Admin User,OU=Workstation,OU=Admins,OU=Accounts,DC=Domain,DC=COM" -pkgid=2541
Mon, 19 Feb 2018 17:18:03 About to call DownloadFiles (1 files) with these settings:
Mon, 19 Feb 2018 17:18:03 m_allowedBandwidthWAN: 50
Mon, 19 Feb 2018 17:18:03 m_allowedBandwidthLAN: 75
Mon, 19 Feb 2018 17:18:03 m_discardPeriodSeconds: 604800
Mon, 19 Feb 2018 17:18:03 m_preserveDirectoryStructure: 1
Mon, 19 Feb 2018 17:18:03 m_bUseWanBWForPush: 0
Mon, 19 Feb 2018 17:18:03 m_bSynchronize: 0
Mon, 19 Feb 2018 17:18:03 Allowed download methods(m_downloadControl):
Mon, 19 Feb 2018 17:18:03 PeerOneSource
Mon, 19 Feb 2018 17:18:03 Peer
Mon, 19 Feb 2018 17:18:03 Source
Mon, 19 Feb 2018 17:18:03 m_preferredServerControl: AttemptPreferredServer
Mon, 19 Feb 2018 17:18:16 Updating system environment variable LDMS_PREFERRED_SERVER: Preferred Server
Mon, 19 Feb 2018 17:18:19 The nostatus flag has NOT been set.
Mon, 19 Feb 2018 17:18:19 Core name CORE-SERVER.DOMAIN.COM' obtained from the registry
Mon, 19 Feb 2018 17:18:19 Sending task status, cmd line -coreandip=CORE-SERVER.DOMAIN.COM -taskid=4363 -retcode=229392444 "-message=100%" -pkgid=2541
Mon, 19 Feb 2018 17:18:19 DoDownloadFromSourceSteps: DOWNLOAD_ERROR_GENERAL_FAILURE
Mon, 19 Feb 2018 17:18:19 Download Error: err=1, path=\\CORE-SERVER\distribution\scripts\UninstallAdobeReader.ps1
Mon, 19 Feb 2018 17:18:20 processing of package is complete, result -1918107543 (0x8dac0069 - code 105)
I made sure that the download folder had read access to everyone and Domain Computers.
I tried Using a batch file to copy and launch the script.
I tried with domain admin credentials in the "Account" tab.
I tried to run from the core, and download only from the core, and to use the preferred server, as normal.
I entered the path listed in the download error in a browser, and the file popped right up.
I set the user account control off and the execution policy to "unrestricted."
I also tried putting "-execution policy bypass" in the command line.
If I manually copy the script over and then launch it from a command prompt or the powershell ISE it works fine and removes acrocbat reader.
I would appreciate some insight into how this process works, as I haven't found much detail in the ivanti documentation.
I suspect there's a security setting somewhere that doesn't like allow powershell scripts to be copied and executed, but I'll be darned if I can find it.