wmi

Send Message to remote PC in local network

Hello friends. How can I in c# send Message box to remote computer? I have credentials of remote PC and know PC name. Can use for this purpose WMI? ...

How to get information about network adapters in c++?

How to get information about all network adapters in system? Name, Manufacturer, Location(PCI, slot2), Driver Version. Actually i retrieved Name and Manufacturer with WMI but i can't find Location and Driver version. I need only c++ solutions not MFC/clr. winapi function? wmi (missing something)? Also i need to retrieve .NET version on ...

C# WMI code to calculate freespace and drivespace on a Mount Point, on Windows server 2008

I have found plenty of information on how to look at physical drives but I need to monitor several mount points on my physical drives. I would prefer to do this through wmi but any .NET objects that could do it would be fine as well. ...

Delete local windows profile with PowerShell

I am trying to write a script that will delete the local profile of a test account. I am using the following line to return the SID of any account that starts with "test-" PowerShell: $UserSID = (Get-WmiObject Win32_UserProfile | Where {$_.LocalPath -like '*\test-*'}).SID Once I had the SID I used wmic to do the deletion but, I am not ...

WMI Flakiness / Enumerating User Accounts

I am using WMI to enumerate users of the computer but with some customers I am getting cryptic exceptions and/or the code doesn't work as expected. For one customer NO user account information is returned from this simple code: SelectQuery query = new SelectQuery("Win32_UserAccount", string.Format("Domain='{0}'", Environment.MachineNa...

WMIC command lind issues when run from Java

Currently I have an applet that runs some command line commands. The applet will not work on random computers. The commands that seem to be causing issue are WMIC commands. The applet is signed and works on some computers but simply hangs in others(even with the same OS and Browser version). I'v done a significant amount of testing and t...

Disabling Bluetooth support in Windows XP-7

Hi I'm trying to write a program to disable the Bluetooth service on computers (so, forbid users from connecting to Internet via Bluetooth) I've tried following methods: Disable the "bthserv" service (Bluetooth Support Service). It works on Windows Vista and 7, but there is no such service in Windows XP (I haven't tested, but I think ...

Discover associated files of a certain process through WMI?

Is it possible to determine for a certain process (id), which files are associated to it (i.e. the executable file as well as all files that are currently accessed by the process)? I have to use WMI unless there is no other option to avoid NtQuerySystemInformation. I already have a piece of code which can determine for a certain file, w...

WMI Win32_Printer not working on XP Embedded

Hi everybody, I have some code which works on a standard XP system, but fails on XP Embedded test machine. I get System.Management.ManagementException : Provider Load Failure Here is my code: string query = "Select * From Win32_Printer"; ManagementObjectSearcher searcher = new ManagementObjectSearcher(query); ManagementObj...

How to access WinRM in C#

I'd like to create a small application that can collect system information (Win32_blablabla) using WinRM as opposed to WMI. How can i do that from C#? The main goal is to use WS-Man (WinRm) as opposed to DCOM (WMI). ...

How do I create an SRV record in DNS with C#

I am using WMI to create different types of DNS records but am having a problem with SRV records. I keep getting a "Not found" error whenever I pass the DomainName parameter. The domain name looks good to me. Has anyone ever successfully done this? Here is my code: internal static void CreateSrvRecordInDns(string Zone, string OwnerNam...

WMI Get the Last Logged in User

Using WMI how can I get the last logged in user for a computer. Currently this is what I have for some reason its returning null. Any ideas why and is this the correct way to get the last logged in user. (NOTE: I am using it on Windows 7 machines) Using System.Management; var scope = new ManagementScope(@"\\COMPUTER_NAME\root\CIMV2"); ...

WMI: "Invalid Namespace" when trying to retrieve "SqlServerAlias" scope

Following code is throwing ManagementException: "Invalid Namespace". Any idea? private ManagementClass GetManagementObject() { const String client = @"localhost"; const String sqlServerAliasScope = @"SqlServerAlias"; const String aliasScopePart = @"\root\Microsoft\SqlServer\ComputerManagement10"; ManagementScope scope =...

how to cleanup view model properly?

hello, i have a view model that is used as the data source for my custom control. in the view model's constructor i set up a WMI ManagementEventWatcher and start it. my view model implements IDisposable, so i stop the watcher in the Dispose method. when i embed the custom control into a window, and then close the window to exit the app...

Zenoss need to get freespace threshold and alerts on windows "mount points"

I have a WMI query that will give me all the data I need to do this but I can't figure out how to get this working in Zenoss. I know I need to set data points and a threshold, and optionaly a graph. The problem is examples of how to do this with WMI are few and very confusing. Could anyone atleast point me to documention on how to do thi...

How can I restore default trustees to Windows XP SP3, to make WMI happy?

Sorry if this question is a little off topic, but I noticed people are discussing WMI here and thought that maybe this as good a forum as any, and better than most. I wanted to configure a port for my SQL Server, and it turned out that my mis-configured or corrupt WMI installation is creating an obstacle. I've tried numerous things to ...

WMI event when App-V application is started/stopped

Is there a WMI event you can subscribe to that will fire when a virtualized application (App-V) is started or stopped? I need to monitor the currently running applications on the App-V client, and preferably, I'd like to avoid constant polling. ...

How to make WMIC output properties in a specific order?

If I run this command: wmic path win32_logicaldisk where drivetype=3 get caption,size,freespace I get the following output: Caption FreeSpace Size C: 118386499584 183399067648 D: 5383057408 66550706176 (That is, first freespace and then size.) Is there any way to get the properties in the same order that I spe...

Setting a Environment Variable without restarting in Windows

I am running a Windows 7 system where i want to be able to set a system environment variable and be able to see it in subsequent command prompts that i launch. When i set the system environment variable using "setx" thins work fine, But given that i want to use the same script code for XP and Windows 7 I cannot do this on XP because XP ...

How to query specific adapters in Win32_PerfFormattedData_Tcpip_NetworkInterface?

Hi all, The title says it all - how can I query specific adapters (ideally based on the IP address) from Win32_PerfFormattedData_Tcpip_NetworkInterface? I've spent a while googling this issue, but I didn't come up with a solution. I tried using Win32_NetworkAdapter and Win32_NetworkAdapterConfiguration, however, I cannot link these to ...