Winget is installed but not recognized when executing script using psexec

Matthias Veelaert 16 Reputation points
2022-03-21T14:23:10.667+00:00

Hi there,

I have written a batch script to uninstall two programs from my local machine by using winget. When I run the script by double clicking or running as admin, it works. When I try to use PsExec to run the script, it says winget is not recognized.

Does anyone have a solution to this or is this a known issue?

Thanks in advance!!!!

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
11,195 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 39,511 Reputation points
    2022-03-23T18:42:01.853+00:00

    Hello @Matthias Veelaert

    Usually the main issue when running PSEXEC when elevated permissions are required is that either UAC is enabled or the syntax is not adequate.

    Please try disabling UAC: https://learn.microsoft.com/en-us/troubleshoot/windows-server/windows-security/disable-user-account-control

    Use the –h switch to indicate that PSEXEC will use elevation for execution. Reference: https://learn.microsoft.com/en-us/sysinternals/downloads/psexec

    Hope this helps with your query,

    ---------------

    --If the reply is helpful, please Upvote and Accept as answer--

    0 comments No comments