#!/usr/bin/python
import os
readLine = open('desktops.txt','r')
for line in readLine:
machineName = line
query = os.system(r'wmic -U corp.fakedomain.com/domainusername%password //'+machineName+ '"Select * from Win32_UserAccount Where LocalAccount = True"|grep "500|"|cut -d "\\" -f 2|cut -d "|" -f1')
获取.....
“示例:wmic -U [domain /] adminuser%password // host”select * from Win32_ComputerSystem“ sh:语法错误:未终止的引用字符串“
如果我用真实的IP 192.168.1.100替换\\ machineName变量,它可以正常工作。