wmi-query

Retrieve VolumeGUIDs via Win32_PnPEntity using VBA

雨燕双飞 提交于 2019-12-09 23:20:15
问题 Is there a way to list the VolumeGUID's from a USB Drive based on the DeviceID from Win32_PnPEntity I am able to retrieve all the VolumeGUID's from Win32_Volume. But I do not know which ones are associated with the USB Drive other than the Drive Letter. I use the following to get USB Names and DeviceID's Sub USBInfo() Dim strComputer As String Dim strDeviceName As String Dim objWMIService As Object Dim colControllers As Object Dim objController As Object Dim colUSBDevices As Object Dim

Monitoring Drives with WMI

醉酒当歌 提交于 2019-12-09 00:46:52
问题 I am trying to monitor drives a local PC. I am interested in two events: when the drive is connected (USB drive, CD-ROM, Network Drive, etc.) and disconnected. I wrote a quick proof of concept using the ManagementOperationObserver and it partially works. Right now (with the code below), I am getting all sort of events. I would like to get only events when a drive is connected and disconnected. Is there a way to specify this in the Wql Query? Thanks! private void button2_Click(object sender,

“The RPC server is unavailable” using WMI query

最后都变了- 提交于 2019-12-08 15:15:27
问题 I have a workgroup of web servers running Server 2008 R2 in which I'm trying to manage a script that checks the disk space of all of them. I had set this up a few months ago when the servers were being set up and I believe it was working fine. Now I go and check and it's giving an error saying "The RPC server is unavailable". The script is a C# ASP.NET page, though I've tried comparable calls in PowerShell and it gives the same error. The script works fine to access the information for the

WMI Query for list of hotfixes installed in a system?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-08 07:14:52
问题 I am writing a perl script that will list the hotfixes installed in my system and check if any pre-requisite hotfixes are not available before beginning my program; So I need to be able to enumerate the list of hotfixes in the system; Here there is a mention of using wmic to generate a html file. Is it possible to do this via a WMI query? 回答1: I have figured out the answer for this myself!! There is a vbscript option provided here. The perl version goes like this.. use Win32::OLE qw( in ); my

WMI Query for list of hotfixes installed in a system?

醉酒当歌 提交于 2019-12-08 05:15:31
I am writing a perl script that will list the hotfixes installed in my system and check if any pre-requisite hotfixes are not available before beginning my program; So I need to be able to enumerate the list of hotfixes in the system; Here there is a mention of using wmic to generate a html file. Is it possible to do this via a WMI query? I have figured out the answer for this myself!! There is a vbscript option provided here . The perl version goes like this.. use Win32::OLE qw( in ); my $machine = "."; my $WMIServices = Win32::OLE->GetObject ( "winmgmts:{impersonationLevel=impersonate,

Powershell function throwing null exception

强颜欢笑 提交于 2019-12-08 02:53:46
问题 Okay, so I've read up on calling functions and passing parameters in powershell but maybe I'm not understanding something. I am calling a function and passing a couple parameters and everything works fine. It is variable defined within the function that seems to be null when it isn't. Function: function get-session { $session = New-PSSession -ComputerName $ip -Credential $cred -Auth CredSSP $subcomps = 'COMP1' foreach ($Computer in $subcomps) { $Computer Invoke-Command -Session $session

ManagementException - Invalid Class

做~自己de王妃 提交于 2019-12-07 03:39:01
问题 I am having an issue querying WMI that has me completely baffled. The Application I am building utilizes WMI counters that are installed as part of the VMware View Agent into a VDI desktop. The counters provide information about the remote display protocol PCoIP. I have working code to query the counters: ManagementObjectSearcher searcher = new ManagementObjectSearcher(); ObjectQuery generalQuery = new ObjectQuery("SELECT * FROM Win32_PerfRawData_TeradiciPerf_PCoIPSessionGeneralStatistics");

Powershell function throwing null exception

*爱你&永不变心* 提交于 2019-12-06 13:59:41
Okay, so I've read up on calling functions and passing parameters in powershell but maybe I'm not understanding something. I am calling a function and passing a couple parameters and everything works fine. It is variable defined within the function that seems to be null when it isn't. Function: function get-session { $session = New-PSSession -ComputerName $ip -Credential $cred -Auth CredSSP $subcomps = 'COMP1' foreach ($Computer in $subcomps) { $Computer Invoke-Command -Session $session -ScriptBlock { Get-WmiObject -ComputerName $Computer -Query "SELECT * FROM Win32_Group" } } Remove-PSSession

C# WMI reading remote event log

我与影子孤独终老i 提交于 2019-12-06 09:34:40
问题 Im trying to run a WMI query against another computer for errors within the last 5 hours or so. When running a WMI query, shouldnt you at least filter the initial query with a where clause? Im basing my code off of samples generated from the WMI code creator on MSDN Here is the select query im using private ManagementScope CreateNewManagementScope(string server) { string serverString = @"\\" + server + @"\root\cimv2"; ManagementScope scope = new ManagementScope(serverString); return scope; }

Searching for a File on Remote Machine WMI C#

你说的曾经没有我的故事 提交于 2019-12-06 08:44:27
问题 I want to search for a file on remote machine. I don't know the EXACT file path but I know its under C:\Windows\System My query is something like this in WMI string querystr = "SELECT * FROM CIM_DataFile Where Path='C:\\Windows\\System'"; ObjectQuery query = new ObjectQuery(querystr ); ManagementObjectSearcher Searcher = new ManagementObjectSearcher(Scope, query); I get invalid query error. Is the query valid ? Any way to specify Path Under ? 回答1: You have two issues in your code you must