Install Apps Remotely Through
Command Line
WMIC {Windows Management Instrumentation Command - Line} is a
powerful tool that often does not see overmuch utilize due to the
deficiency of (simple accessible) available documentation. More info
can be got on WMIC here:
technet.microsoft.com/en-us/library/bb742610.aspx. We shall be using
WMIC with domains admin credential to crawl via list of nodes
(Laptops / PCs) and set up an program example without disrupting the
users.
So there are match advanced methods to complete such work, we
shall be analyzing the most straight forward function: an
installation of MSI file needing no option located on each remote
local drive user.
1 | Load up the commands shell with proper access permission
Though the WMIC instructions can
be provided proper credential prior to operations, it is typically
best practice to ignore the clear text typing password (who is
that searching over our shoulders;)). We shall run the runas
commands las given below:
Runas/
user:DomainAdminAccount@DOMAIN cmd
… which will punctual you for the credential of your
DomainAdminAccount. If attested, we shall be handed the commands
shell exe4cuting as Admin. |
---|
Install Apps Remotely Through Command Line |
2 | Step inside WMIC
One of the good qualities of WMIC
is that it can be execute from any type of machines. With your
admin commands shell, we are going to input the wmic command given
by input.
(Note that: You could have leaped into WMIC straightly from the
command. runas.. this just interrupt out these steps) |
---|
3 | Installation Calling (for a single machine)
Installation of WMIC call permits
compatible WMI application to be installed with no interactions
from the users (they view nothing, the programs are simply
configured reported to the default installation parameter us or
the products packager have specific).
Here is the rub: single MSI
package will have dissimilar "options" (the 2nd enter
mandatory in the installed call as displayed in the screen-shot
attached). To change our examples, we're installing from an MSI
that urgent no option.
We shall input the set up call
like the given below:
> /
node:exampleremotemachine products call install true,""
, "c: \PathToYour\File.msi"
Which will punctual us for
verification in the format given below:
Execute (Win32_Product) →
Install() (Y/N)?
To which you should response yes
(y) to make sure. If our WMI complaints MSI packages were
successfully configured, we must view the something like the given
below:
Successful Execution of Method:. Out Parameters: instanceof __PARAMETERS { ReturnValue=0; }; |
---|
Call the Installation |
4. | Installation Calling (for a list of machines)
We shall utilize the WMIC's
quality to handle the flat text files as input for the node to
execute this installations on the machines list(in our examples,
saved on the local hard drive of admin in C:\
computers.txt) by executing the commands given below:
>/node::@"c:\computers.txt"
products call install true,"" , "c:\
PathToYour\File.msi
Which will repeat via the list in
computers.txt... skipping over the bad node (For Example:
machines are switched off), and interrogative for the confirmation
of installation for each and all machines.
So as indicate in the section, we
should have the installation and MSI files available on the remote
local harddisk computer for this way to works. In most conditions,
this is not desirable - it would be perfect to configure from the
drive of network. Unluckily without updated scripting (utilizing
delegation methods for mapping the disks of network), this isn't
realizable.
The explanations for this stem from WMI's require to execute as
(in such case) the admin of domain and inability of WMI to
negotiate the networks connections of drive by this admin ID of
domain without few concerns of security. There are work around...
but they fall outside the scopes of this how to. If another single
wants to write a how to using WMIC to configure from an MSI
packages (or more advanced .exe wrappers) situated on the machine
of networked, We would merrily referenced this! |
---|
Conclusion
Hopefully we have been plotted by the power of WMIC... so copying
over MSI / installation file to each PC's local disk is not desirable
in mostly case, it can sometimes be the quickest way of installation
of background (our users do not require even be cognizant of
installation).
No comments:
Post a Comment