Friday, 17 February 2017

How to execute a command remotely on Windows Computers Client

We can use WMIC(Windows Management Instrumentation Command-line tool) to access WMI data on local or remote computers via command prompt to execute any command. 

WMIC utility provides a command line interface for WMI(Windows Management Instrumentation) and use of this we can manage remote system.

Ok, Let’s take an example, Suppose we want to update Group Policy on a single remote user’s computer using group policy update command, then following command will help to initiate  gpupdate.exe, kindly change Target_Computer_Name with a remote computer name.

WMIC /node:Target_Computer_Name process call create "cmd.exe /c GPUpdate.exe
Suppose you want to run group policy update command on multiple users, then use this following command 

FOR /F "Tokens=*" %L IN (RemoteComputers.TXT) DO WMIC /node:%L process call create "cmd.exe /c GPUpdate.exe"

Suppose if you want to stop any othere service on a remote computer then use following command, Kindly replace the Target_ Service with the service name which you want to stop.

WMIC /node:Target_Computer_Name process call create "Net Stop Target_Service"

We can use help command /? to discover the additional options as well.

No comments:

Post a comment