wmi

How to convert WMI DateTime to standard DateTime?

I'm trying to read the install date from WMI (Win32_OperatingSystem.InstallDate). The return value looks like this: 20091020221246.000000+180. How can I get a valid Date? ...

MSNdis_StatusMediaDisconnect and device Unique Name.

Hello, I'm using ManagementEventWatcher to watch the disconnection of network cable using System.Management. ManagementEventWatcher with the WQL: SELECT * FROM MSNdis_StatusMediaDisconnect, and the following method is fired, when EventArrived: private void ServiceNetWorkStatusWmiDisconnected(object sender, EventArrivedEventArgs args...

WMI Access denied excptn

string s = Form1.ipadd; string devic; devic = comboBox1.Text; groupBox2.Text = devic + " Information"; ConnectionOptions _Options = new ConnectionOptions(); _Options.Username = "Babar"; _Options.Password = ""; ManagementPath _Path = new ManagementPath(s...

The best way to always detect a removable device

In my previous question "How to find the unique serial number of a flash device?" I ended up asking for a way to get the drive letter. That problem is solved. However, my initial question has not been answered. I wanted to be able to tell removable devices (USB drives, SD cards, (external HDDs?), etc.) apart and always be able to recogn...

Getting the .NET Class associated with a process

As part of a WMI Coupled provider that I'm creating I need to write an instance enumerator. The code I have is below. What I need to do is get the Class instance associated with the process. Any ideas? static public WMIProviderSample GetInstance([ManagementName("ID")] int processId) { try { Process[] ...

Passing objects as arguments in VBScript

I'm working on a project to capture various disk performance metrics using VBScript and would like to use a sub procedure with an object as an argument. In the following code samples the object I'm referring to is objitem.AvgDiskQueueLength which will provide a value for the disk queue length. I haven't found a way to make it work since ...

Is there a standard way to access the windows services file in .Net?

Is there a standard way in .Net to access and modify the windows services file? Right now I'm just accessing the file via a stream and writing to the file like I would for any other file. The file is located in c:\windows\system32\drivers\etc\, but I'm worried that this may change in 64 bit versions of Windows or may vary in different ve...

How can I execute this WMI Query in VC++ ?

Hi, I recently saw this Stackoverflow question about detecting the "real" version of Windows. I have a application that uses code thats only availible on Windows Vista and up. To maintain compatibility with Windows XP, I have created my own version which does exactly the same as the Vista code, but is nowhere near as fast as the Vista ...

how to use WMI to discover a running batch (.bat) filename?

Currently with WMI's Win32_Process, I seem unable to detect if a batch file is currently running all it lists is CommandLine of cmd.exe, without telling me which batch file that particular cmd.exe is running. Anybody have any insights there? code snippet (ruby-wmi) many_args = 'batch_file.bat' procs = WMI::Win32_Process.find(:all) pro...

Mapped Network drive couldn't access using WMI.

I have two machines, Say Machine1 and Machine2. I have mapped one shared folder in Machine2 in Machine1 as Z. I started one application say App1 which list all drives of machine and the application is in Machine1. I started this App1 from Machine1 and I got all my drives Including the mapped drive 'Z'. But when I Started the App1 which i...

Is there a way to configure IIS 5.1 remotely without DirectoryServices?

I need to view information about virtual directories in IIS on an XP machine (ie, IIS 5.1) from a remote computer. I have used the DirectoryServices namespace in the past successfully, but I am unable to now because (I believe) it uses particular parts of ADSI that are only installed with IIS - so it cannot be used on a client machine ...

Pretty (maker-free) device names, where do I find those?

I'm looking to do some things involving (removable) devices, so I was looking at WMI and other APIs, the 'Devices and Printers' screen and the Safely Remove Hardware popup as I want to have as seamless an experience as possible. Problem however.. is that I can't find any way to get the names as my user 'knows' them in his PC. Example......

Shared folder permission!

Hi! I use this code to share folder: Public Sub Share() Dim managementClass As New ManagementClass("Win32_Share") Dim inParams As ManagementBaseObject = managementClass.GetMethodParameters("Create") inParams("Description") = "My Description" inParams("Name") = "Share Name" inParams("Path") = "D:...

Programmatically determining space available from UNC Path

Is there a programmatic API for determining available space on NAS sotrage from a UNC path? I looked through the WMI documentation and it wasn't clear that this is possible. A code example and references to the relevant API calls would be much appreciated. ...

WMI query issue in PowerShell

Here is where I have started: #Get Physical Memory function getwmiinfo ($svr) { gwmi -query "select * from Win32_PhysicalMemory" -computername $svr | select [$svr], DeviceLocator } $Servers = get-content -path "C:\test.txt" foreach($Servers in $Servers) { getwmiinfo $Servers } I get this: [risk] Devic...

WDM returns privilege error for WMI request

My application attempts to update data in my NDIS IM driver using the usual WMI Put/PutInstance calls. The PutInstance returns error WBEM_E_FAILED. The wmiprov.log shows the following: WDM call returned error: 1314 WDM specific return code: 1314 This error translates to "A required privilege is not held by the client." My applicatio...

Access SQL - WMI Namespaces from Remote Machine

Hi, i am playing with Powershell and SQL WMI events and i am wondering if i can do this stuff remotely from the admin notebook: I'd like to query the "root\Microsoft\SqlServer\ServerEvents\MSSQLSERVER" namespace: On SQLServer directly: get-wmiobject -list -namespace "root\Microsoft\SqlServer" >> Works! get-wmiobject -list -namespac...

WMI Access Denied on XP

Our application uses bunch of WMI calls. When using guest account connecting to local WMI server fails with ACCESS_DENIED, this works fine with user account and above. How to access WMI server under guest account? I added guest account to allow full access using WMIMGMT.MSC but still I am getting access denied errors. Any suggetions? ...

RPC server is unavailable when connecting to WMI on a remote computer..

A server had to be re-built after Hard drive crash.. After installing exact Image of the Server software, The WMI fails to connect when called (RPC Server is unavailable) from another computer. However, Can connect using Visual Studio (2005) Server Explorer. The calling server is Windows 2000 server and the called is Windows 2003. Both ...

What is the difference between these two methods of killing a process?

I am writing a C# application that, among other things, automatically closes the advertisement a certain game displays after the user exits the game. My program accomplishes this by killing the game process when it detects that the user has exited the game. My program is similar to an Autohotkey script written by someone else that does s...