Link to home
Start Free TrialLog in
Avatar of sunhux
sunhux

asked on

How to remove & add a Program using PowerShell command

I'll need to uninstall a software agent on a mass scale (thousands) & then install with another version
as doing so one by one is not feasible.

I have a way to send "Remote PowerShell" commands (though I could send Windows batch ie .bat
commands too but often this run into errors) to the various Windows servers.  Below is the
output of sc queryex of the service & attached the software name (which is an msi file ie uninstall
Agent-Windows-8.0.0-1732.x86_64.msi, Agent-Windows-9.0.0-2004.x86_64.msi
& then reinstall with Agent-Windows-9.0.0-5001.x86_64.msi  )


sc queryex ds_agent

SERVICE_NAME: ds_agent
        TYPE               : 10  WIN32_OWN_PROCESS
        STATE              : 4  RUNNING
                                (STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0
DS_RemovePgm.jpg
Avatar of sunhux
sunhux

ASKER

The installation process will prompt for administrator password & asks to
to confirm to proceed
Avatar of FOX
Sunhux,
I would use psexec with the bat file that you have.  You can run the psexec command against a list of machines inputting your username and password one time and it will hit all those machines with the credentials

https://technet.microsoft.com/en-us/sysinternals/psexec.aspx
ASKER CERTIFIED SOLUTION
Avatar of FOX
FOX
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sunhux

ASKER

Have used psexec before;  challenge is the installation process will prompt to
confirm to proceed & other prompting