I am attempting to find all .PST files for the logged on user. However, I seem unable to add a path to 'Drive'. I would like to search all files under C:\users\ + $env:UserName This command seems to find all PST files on C:\ $Res = Get-CimInstance CIM_DataFile -filter "Drive='c:' [...] read more
IMPORTANT UPDATE: As Cheran S stated below, it's a good idea to avoid using "taskmgr" for this script. I'm not going to edit the code, as I feel it's best to maintain the original question as much as possible since doing so would partially invalidate & obfuscate Cheran's answer & [...] read more
I try to determine in which IRQNumber a specific device is associated. Then, when I have the IRQNumber, I want to list all the devices which are on this IRQ to see if the specific device is the only one on this IRQ or if it shares it. Thanks to [...] read more
I'm implementing a WMI interface in Delphi VCL, I managed to have it working, but I'm now trying to make it a little more robust. The portion of code I'm working on is this: var FWbemServices: ISWbemServices; WMIObject: ISWbemObjectSet; WMISQLQuery: String; FCount: Integer; ... FWbemServices := FWbemLocator.ConnectServer('', 'root\CIMV2', '', '', [...] read more
I am writing a Python script to retrieve the list of administrators users from a remote Windows box using the WMI client (https://pypi.python.org/pypi/WMI/1.4.9). This is the code I am using: import wmi wql = r'SELECT * FROM Win32_GroupUser WHERE GroupComponent="Win32_Group.Domain=\"MY_MACHINE\",Name=\"Administrators\""' host = '10.253.6.38' domain = 'My_Domain' user = 'My_User' auth_user [...] read more
For starters, here's the WMI module I'm referring to. I've tried many combinations of code, and understand how to remove network printers with wmic from the command line, as well as a basic understanding on how to remove network printers with wmi in VB, etc. but I still can't figure [...] read more
I am trying to close multiple applications at the same time using the following VBS script, but am getting the error 0x80041017 on the For Each loop line. It works fine with just one application but I added another to terminate strComputer = "." strProcessToKill1 = "Acrobat.exe" strProcessToKill2 = "iexplore.exe" [...] read more
I'm new to Python (and coding in general) and I'm working my way through the WMI module. What I am looking for is a way to query WMI for event log errors filtered for date. For example, if I do the following, it works: events = userwmi.query("Select * from Win32_NTLogEvent [...] read more
I've encountered the following error while scripting in Python. ERROR Tue 19. Jan 14:51:21 2010 C:\Python24\Lib\site-packages\win32com\client\util.py:0: Script Error com_error: (-2147217385, 'OLE error 0x80041017', None, None) Unfortunately, I don't know what it means, or even what other information I might need to find out. Does anyone have any insight into this? read more
Following another thread, I read that wmic diskdrive get serialnumber in cmd would produce the serial number for the hdd installed. I'm getting a message: ERROR: Code = 0x80041017 Description = Invalid query Is there another command or another way of getting the serial number (all I want to do [...] read more
I have a very simple WMI test-script that I am running locally on a server to diagnose a problem I'm having getting WMI some data. Essentially, all WMI queries I run on this machine (locally) fail with an error code 0x80041017. Option Explicit Dim WmiQuery WmiQuery = "SELECT * FROM [...] read more
I am attempting to get a list of services that are running on a windows machine with python. My Code: import wmi c = wmi.WMI() wql = "SELECT * FROM Win32_Service WHERE State = ""Running""" for x in c.query(wql): print(x) I am getting an error and I do not understand [...] read more
I can get deviceID from WMI, then I want to use that deviceID to check weather device is in enabled\disabled state and if it's status is OK or not, basically I want to use WQL to query that device later on using this usb device unique DeviceID. Here is a [...] read more
I am working on Windows 2008 Server R2. I found this VBScript that should be checking the whether a service is either started or stopped. Here is the script: 'Declare Variables Dim objWMIService, objProcess, colProcess, Status, strComputer, strService 'Assign Arguments strComputer = WScript.Arguments(0) strService = WScript.Arguments(1) Status = False 'Check [...] read more
I am develop wmi application to get windows logs by using WQL query. How to use CONCAT() method in that query. Input WQL Query : wmic -U XXX%XXX //XXX "Select CONCAT(Category, '|DHCP') from Win32_NTLogEvent where TimeWritten > '06/04/2014 13:59:00' and Logfile = 'Security'" Output : [wmi/wmic.c:212:main()] ERROR: Retrieve result data. [...] read more
The following query should return a set of files that were created to the G drive in the folder test. I am having trouble getting the following WMI query to work: SELECT * FROM __InstanceCreationEvent WITHIN 1 WHERE TargetInstance ISA 'CIM_DataFile' AND TargetInstance.Drive = 'G:' AND TargetInstance.Path = '\\test\\' The [...] read more