wmi

“Win32 exception occurred releasing IUnknown at…” error using Pylons and WMI

落花浮王杯 提交于 2019-12-22 14:54:43
问题 Im using Pylons in combination with WMI module to do some basic system monitoring of a couple of machines, for POSIX based systems everything is simple - for Windows - not so much. Doing a request to the Pylons server to get current CPU, however it's not working well, or atleast with the WMI module. First i simply did (something) this: c = wmi.WMI() for cpu in c.Win32_Processor(): value = cpu.LoadPercentage However, that gave me an error when accessing this module via Pylons ( GET http://ip

Run command on remote computer

巧了我就是萌 提交于 2019-12-22 12:41:10
问题 I want to run a command in command prompt on a remote computer using C#. Per this link How to execute a command in a remote computer?, I am trying to do this using the following code: public static void RunRemoteCommand(string command, string RemoteMachineName) { ManagementScope WMIscope = new ManagementScope( String.Format("\\\\{0}\\root\\cimv2", RemoteMachineName)); WMIscope.Connect(); ManagementClass WMIprocess = new ManagementClass( WMIscope, new ManagementPath("Win32_Process"), new

Can I use EnableStatic for configuring an IPv6 addres (using WMI)?

本秂侑毒 提交于 2019-12-22 10:29:21
问题 I would like to use WMI (in C++) to configure a static IPv6 address. Configuring a static IPv4 address is working fine using EnableStatic , which is part of a WMI class named Win32_NetworkAdapterConfiguration . Can anyone help me configure an IPv6 address using WMI? I have been looking for example code, but have not found any. 回答1: No. According to the Win32_NetworkAdapterConfiguration documentation on the MSDN web site, this API supports limited IPv6 functionality (looks like it's limited to

how to get hard disk driver's serial number in python

最后都变了- 提交于 2019-12-22 09:48:46
问题 I tried to use wmi to get the hard disk's serial number. What I did is this: Start ipython and use this way to get serial num: import wmi c = wmi.WMI() for x in c.Win32_PhysicalMedia(): print x The result is like this: instance of Win32_PhysicalMedia { SerialNumber = "2020202020202020202020205635514d385a5856"; Tag = "\\\\.\\PHYSICALDRIVE0"; }; But my computer is win7, I start ipython with administrator privilege and do the same thing again, but now the result is different: instance of Win32

can't terminate process using WMI but taskkill works

丶灬走出姿态 提交于 2019-12-21 21:43:36
问题 My user is in the Administrators group. I am using the .NET WMI API (System.Management) to kill a process using this code: var scope = new ManagementScope("\root\cimv2"); scope.Connect(); var query = new ObjectQuery( string.Format("Select * from Win32_Process Where ProcessID = {0}", processId)); var searcher = new ManagementObjectSearcher(scope, query); var coll = searcher.Get().GetEnumerator(); coll.MoveNext(); var mgmtObj = (ManagementObject)coll.Current; var ret = (uint) mgmtObj

Counting printed Pages by Clients with c# and WMI

让人想犯罪 __ 提交于 2019-12-21 21:36:38
问题 the goal is like i said in the Topic. I know there are a lot of articles on that specific Problem and i tried all most all of them. But since non of them worked out for me, I'm now trying to find out why this one just works sometimes and sometimes nothing is happening although many things are printed. So this is my code which right now should wait for a job to be printed and just tell me about it. Nothing more. private void StartMonitor() { try { var opt = new ConnectionOptions {

WMI retrieve groups that a user is member of?

ぐ巨炮叔叔 提交于 2019-12-21 21:27:45
问题 this is my code for retrieving My local Computer Info : ManagementObjectSearcher Usersearcher = new ManagementObjectSearcher("SELECT * FROM Win32_ComputerSystem"); ManagementObjectCollection Usercollection = Usersearcher.Get(); string[] sep = { "\\" }; string[] UserName = Usercollection.Cast<ManagementBaseObject>().First()["UserName"].ToString().Split(sep, StringSplitOptions.None); ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_UserAccount where Domain =

QCoreApplication QApplication with WMI

こ雲淡風輕ζ 提交于 2019-12-21 12:03:07
问题 I found some WMI C++ Application Examples in MSDN website. I have tried the code form the below link http://msdn.microsoft.com/en-us/library/aa390423%28v=VS.85%29.aspx when I copied and run the application as win32 console application it worked well. the same code I put into the Qt application , When I use QApplication anApplication ( argc, argv ); in my code it is not working But if I use QCoreApplication anApplication ( argc, argv ); it is working shows me error like "when i change

Want to script Windows WMI (wmiprvse.exe) to release handle on file

爱⌒轻易说出口 提交于 2019-12-21 06:45:06
问题 I'm working with a VB Script file written by someone else that uses Windows Management Instrumentation (WMI) calls to check on the status of several Windows Services. This script runs every few minutes on set schedule. I need to upgrade/replace the .exe for those services. I stop the VB Script, stop the services, and uninstall the services so they no longer appear in the Services panel (services.msc). Unfortunately, WMI (wmiprvse.exe) still has a handle on the service .exe files. I can

Windows C# implementation of linux dd command

…衆ロ難τιáo~ 提交于 2019-12-21 04:06:58
问题 I'm writing a C#.Net app to run on windows that needs to take an image of a removable disk and chuck it onto a Linux Live USB. The Live USB is the inserted into the target machine and boots, on start up it runs a script which uses the dd command like so to flash it onto another drive: dd if=/path/to/file/from/csharp/program of=/dev/sdX The problem I am having is creating the image on the windows side. I have tried my Live Linux out with files I have created on a Linux system using dd and that