WMI (Windows Management Instrumentation) is a Microsoft system for managing Windows remotely. It is present on almost all Windows since Windows Me (2000).
Here is the command to launch a program on a remote computer:
WMIC /node:"p_serveur_name" /user:"p_account" /password:"p_password" process call create "p_program.exe" , "p_working_dir"
- p_serveur_name: the name of the server on which to start the process
- p_account: the identifier of the account to use on the server
- p_password: the password of the account on the server
- p_program.exe: the program to launch
- p_working_dir: the working directory (by default Windows \ System32)
To start a Batch file, you can use as parameter: 'cmd /c "my_file.bat"'.
- 0 : Successful completion
- 2 : Access denied
- 3 : Insufficient privilege
- 8 : Unknown failure
- 9 : Path not found
- 21 : Invalid parameter
The WMIC command does not wait for execution to complete to return a value. To know the end of a process, the server must be interrogated at regular intervals to find out if the process identifier (PID) no longer exists.
If you have the error "The RPC server is not available"
This error can occur if you do not put the correct value in the "server name" part. It can also occur in other cases. Microsoft support gives the following fix:
- Go to the registry
- Go to HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services/Netlogon
- Edit the key of DependOnService
- Modify its value by :
- Restart the machine
If you have the error "Access denied"
Several origines are possible.
First, check the firewalls of both machines, temporarily disabling them for the duration of the test.
Identifier and password
In the event of an error in the username or password value, you will receive an Access Denied message fairly quickly. Check these out. The identifier can be passed by prefixing it with the domain name: Domaine\Identifier.
Remote Access Execute permissions may not be enabled. Follow the procedure below:
- Open the components services : start / execute / dcomcnfg
- Open Console root, Component services, Computers, My Computer
- Click on My computer then properties
- Go to tab Sécurity COM
- In the lower part (Execution and activation authorization), click on Modify limits
- Make sure that the account you are using (an Administrator account for example) has the Remote execution and Remote activation checkboxes checked.
Disable UAC for local accounts, using the following procedure:
- Open the registry (regedit.exe)
- Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
- Crate the key LocalAccountTokenFilterPolicy as DWORD value, set it to 1
- Retry the test with the WMIC command
Dernière modification le 12/03/2021 - Quillevere.net