Sunday, August 23, 2015

Multiple ways to Install Software remotely on Windows - Method 3 Command line microsoft psexec tool

Multiple ways to Install software remotely
Multiple ways to Install Software remotely on Windows - Method 1 Group Policy
Multiple ways to Install Software remotely on Windows - Method 2 Third party softwares

Multiple ways to Install Software remotely on Windows - Method 3 Command line PSEXEC tool
Multiple ways to Install Software remotely on Windows - Method 4 WMI (Windows Management Instrumentation) 
Multiple ways to Install Software remotely on Windows - Method 5 PowerShell Remoting
Multiple ways to Install Software remotely on Windows - Method 6 PowerShell DSC (Desired State Configuration)
Multiple ways to Install Software remotely on Windows - Method 7 Copy Portable applications 
Multiple ways to Install Software remotely on Windows - Method 8 Task scheduler 

Last 2 methods I shown where GUI and easy ones. In this section I will be showing how to 
use Command line Microsoft sysinternal tool called PSEXEC (It is part of PSTOOLS). This is One of the best tool for doing windows operations remotely. This has saved my day many times.

I will be showing VMware tools installation remotely. (They are necessary to install on newly deployed Virtual Machines on VMware ESXi), they contains multiple file, you can obtain them from right clicking VM, inside the VM ISO file will be mounted, copy all the CD contains to share folder, and provide appropriate priviledges.


PSEXEC is a command line tool single exe file, and need to download from microsoft website https://technet.microsoft.com/en-in/sysinternals/bb897553.aspx.

Once you download unzip it and extract PSEXEC.exe to c:\windows folder. 

Next create 2 files on the local drive from where you will be executing psexec, I have created under c:\temp, one is computerslist.txt file and second is installationscript.bat. Computerlist.txt contains all the computers list. (here I want to show you installation of application on multiple PC instead of single one). And the second batch has script to map software share drive and run setup.exe file on the mapped drive. If you use batch file you wont get Access denied or any other busy error.

Batch file commands are
net use s: \\192.168.33.11\Softwares\VmwareTools /user:vcloud\vkunal Computer@1
* Username and password is mandatory.

S:\setup.exe /S /v /qn REBOOT=R
*Running setup.exe from mapped drive, Automated installation Parameters found from VMware tools documents
Open Command prompt (cmd). And run below command.

psexec.exe @c:\temp\computerslist.txt -c c:\temp\installationscript.bat

For command line summary I am running psexec.exe kept under c:\windows, it is taking computer names serially from @c:\temp\Computerslist.txt and next psexec will copy installationscript.bat file will be copied on computer's list and executed.

(I am getting error code 3010 means Plan for reboot to take vmware tools installation, If you are getting error 1603 means there is some fatal error while installation, try rebooting remote servers might fixt your issue)
PSEXEC tool is highly dependent on Admin$ share. I Admin$ share is disabled it doesn't work. 
Next method I would be showing is WMI Windows Management Instrumentation using process class. Multiple ways to Install Software remotely on Windows - Method 4 WMI (Windows Management Instrumentation)

1 comment:

Maurice.Torres said...

Good howto! One more way is using free tool Action1 to install software remotely. This tool works on multiple computers simultaneously and also can work on computers isn't connected to your network all time.
https://www.action1.com/p/Free-Install-Software-Remotely-58.html