Answer the question
In order to leave comments, you need to log in
How to correctly transfer the domain name of the user?
Hello.
To get the CPU value from a remote windows server I am trying to execute the following code
import re
import wmi
from subprocess import Popen, PIPE
def get_cpu(computer, user, password):
c = wmi.WMI(computer=computer, user=user, password=password, find_classes=False)
utilizations = [cpu.LoadPercentage for cpu in c.Win32_Processor()]
utilization = int(sum(utilizations) / len(utilizations)) # avg all cores/processors
return utilization
print(get_cpu("webserver01", "newdomain\007user", "password"))
Answer the question
In order to leave comments, you need to log in
I'll try to suggest that you need to escape the slash:
print(get_cpu("webserver01", "newdomain\\007user", "password"))
the problem was that I was trying to connect to the local PC, prescribing the US.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question