Reputation: 2092
I have a Python script running on a Linux machine that uses WMI
to retrieve data about local Windows machines.
Currently I am only retrieving information from them via WMI
queries and I am unsure of how to send it commands to perform. I want to be able to send a shutdown command using the wmi
class defined here.
I am currently fetching information as shown below:
import wmi_client_wrapper as wmi
wmic = wmi.WmiClientWrapper(username="Administrator", password="password", host=ip,)
disk = wmic.query("SELECT Size,FreeSpace FROM Win32_LogicalDisk")
I am using the wmi_client_wrapper
python package to programmatically query for data via wmi
. How would I use this package to go about sending the shutdown command via wmi
?
Upvotes: 0
Views: 239
Reputation: 2092
It looks like the Python package being used, wmi_client_wrapper
, implements a wmi object that only has the following methods:
['_construct_query', '_fix_dictionary_output', '_make_credential_args', '_parse_wmic_output', '_setup_params', 'query']
of which only the query
method makes calls directly to the WMI
interface of the windows machine being targeted. Since WMI
queries can only possibly retrieve data, that means that if restricted to just being able to query, the package being used cannot send commands via WMI
to your target machine.
Upvotes: 1