wmi-query

How do I get the available FreeSpace from a drive from a remote computer?

心已入冬 提交于 2019-12-12 11:20:10
问题 I'm trying to get the FreeSpace from the D drive of a remote computer. Towards the end, I'm getting a ManagementException was unhandled by user code "Not Found" This is the line that gives me the error: fs = m["FreeSpace"].ToString(); Here's my code: ConnectionOptions oConn = new ConnectionOptions(); oConn.Username = "username"; oConn.Password = "password"; oConn.Authority = "ntlmdomain:XXX"; ManagementScope scope = new ManagementScope("\\\\Remote_Computer\\root\\CIMV2", oConn); scope.Connect

Detect .Net Framework 3.5 or higher using VBS through WMI

[亡魂溺海] 提交于 2019-12-12 09:58:14
问题 I have created a script which detects installed .Net Framework installed through registry. The condition should specifically detect 3.5 or higher version and continue the process. However, using the registry it seems not possible. Every time there is a new version installed, you have to search and input the registry or modify the script just to make it works. Then I searched it up on google that it can be done through WMI and this seems gonna work. I have modified the script to be flexible

Getting Machine Serial Number With WMI Class [duplicate]

有些话、适合烂在心里 提交于 2019-12-12 04:53:23
问题 This question already has answers here : Getting Service Tag from Dell Machine using .net? (4 answers) Closed 5 years ago . I wrote this part of c# WMI Code for getting MotherBoard serial Number ManagementObjectSearcher ComSerial = new ManagementObjectSearcher("SELECT * FROM Win32_BaseBoard"); foreach (ManagementObject wmi in ComSerial.Get()) { try { MainBoard.Text = wmi.GetPropertyValue("SerialNumber").ToString(); } catch { } } But in fact i want to learn PC(Machine) Serial Number(Written On

How to find list of file path in files and in sub folders of C Drive based on different extension through WMI in C#

[亡魂溺海] 提交于 2019-12-11 19:26:35
问题 I need to search files of the extension mp3 and many more from the whole C Drive and store only its path in specific list string,currently I'm just printing on the Console I get repetitive results too .I just want to skip even if one file is found.How is it possible to search all type of extension file apart with mp3 and avi and many more List<string> filesmediaFound = new List<string>(); string machinename = Environment.MachineName; string wmifilepath = @"\\" + machinename + @"\root\CIMV2";

How do I include computername in output

烂漫一生 提交于 2019-12-11 08:48:21
问题 PS newbe here... How do I get the remote computer name to appear in the output? $computer = "PC3090-121","APCD02" Get-WmiObject Win32_Printer -ComputerName $computer | Select-Object SystemName,Name,Local | Format-Table -AutoSize I've tried including -computername, computername, %computername% in the Select and format-table -properties - no joy... My searches have come up empty, or I couldn't understand them. ------------------------------ answer: $computer = "PC3090-121","APCD02" Get

Finding NT user (Windows login) that uses SQL Server Login

 ̄綄美尐妖づ 提交于 2019-12-11 08:05:50
问题 As part of a security task I need to find all SQL Server logins that connect to the SQL server instance. I create extended event for capture logins and filter only SQL Server logins. The problem is that I can not tell from the SQL Server what was the NT user that was used. Example: From the xEvent I can see that user [sa] logged in to the SQL server instance and I can also see this client host name. BUT , now I would like to know what was the domain account that was logged in to the client

Wrong LastLogon returned from Win32_NetworkLoginProfile

本小妞迷上赌 提交于 2019-12-10 22:04:47
问题 Using WMI Explorer (or any other tool), the LastLogon timestamp for my user is showing an outdated value instead of the current date (since I'm currently using this PC): SELECT * FROM Win32_NetworkLoginProfile -- LastLogon = 20150212180405.000000+120 At the same time, other domain users are listed with LastLogon as the current date, so this is an issue for my user only. On the other hand, NetUsers is reporting the current date, as expected: DOMAIN\user user name 2015/03/10 10:14 What is the

What are some common WMI queries

人盡茶涼 提交于 2019-12-10 21:03:43
问题 I'm building a C# monitor app which uses WMI to grab some performance details of a remote computer. What are some good WMI queries to grab helpful stats such as CPU load, RAM usage, HDD free space, etc. For example, you can get the CPU load from the property "LoadPercentage" with the query "SELECT * FROM Win32_Processor". What are some other useful properties & queries? 回答1: I think it's a bit complicated recommend a couple of classes in particular because the WMI is extensive and depends on

Select query of wmi used to view the process which has max usage of cpu

核能气质少年 提交于 2019-12-10 19:04:52
问题 What is the query used to view the topmost process which is having maximum usage of CPU using WMI? 回答1: Use Win32_PerfFormattedData_PerfProc_Process class. Select IDProcess, Name, PercentProcessorTime from Win32_PerfFormattedData_PerfProc_Process Once you have those informations you can sort by PercentProcessorTime. It should work fine. 来源: https://stackoverflow.com/questions/4212124/select-query-of-wmi-used-to-view-the-process-which-has-max-usage-of-cpu

c# 'Invalid class' in a simple WMI query

霸气de小男生 提交于 2019-12-10 02:43:32
问题 I will like to find some result after this query, but in the beginning of the foreach loop, the error "invalid class" occur. string wmiQuery = string.Format("SELECT * FROM Win32_Process"); var searcher = new ManagementObjectSearcher(wmiQuery); var wmiResults = searcher.Get(); foreach (ManagementObject retObject in wmiResults) { Console.WriteLine("[{0}]\tName: {1}", retObject["ProcessID"], retObject["Name"]); } I use window 7 64, and i wonder if Win32_Process exists. I also use wmi code