Remote Command via WMI

Description

The script will run a command on a remote system using the WMI API.

Overview

This script leverages the Windows Management Instrumentation API to run a command on a remote system using either impersonation of the current user or explicit credentials.

WMI is an administration feature that provides a uniform environment to access Windows system components. The WMI service enables both local and remote access with the latter leveraging the Distributed Component Object Model (DCOM). Remote WMI over DCOM operates using port 135.

Arguments

Parameter Type Description
Target string The IP address or hostname of the system to run the command.
Username string The local or domain username to authenticate with.
Password string The password for the specified user.
Command string The command to run on the target system.

Dependencies

  • None

Employment Considerations

  • Impersonation requires that the current user have access to the remote system.
  • You will not receive any output from the executed command using this mechanism.

Example Text Output

Example of successful execution.

__GENUS          : 2
__CLASS          : __PARAMETERS
__SUPERCLASS     :
__DYNASTY        : __PARAMETERS
__RELPATH        :
__PROPERTY_COUNT : 2
__DERIVATION     : {}
__SERVER         :
__NAMESPACE      :
__PATH           :
ProcessId        : 2288
ReturnValue      : 0
PSComputerName   :
Scroll to Top