0
#!/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: 構文エラー: 引用符で囲まれていない文字列"

\\machineName 変数を実際の IP 192.168.1.100 に置き換えると、正常に動作します。

4

0 に答える 0