wmi-service

how to run a powershell script as a windows service from inside a Java program?

不想你离开。 提交于 2020-01-14 03:50:29
问题 I have the following code that runs a windows service from inside Java.The code uses JInterop Java library, JInterop is a pure Java COM client for windows COM server. More details of JIntop are available here [http://fishi.devtail.io/weblog/2015/01/21/pure-java-dcom-bridge-j-interop/] String cmdFile = "service.bat"; results = wbemServices_dispatch.callMethodA( "Get", new Object[]{ new JIString("Win32_Process"), new Integer(0), JIVariant.OPTIONAL_PARAM()}); IJIDispatch wbemObjectSet_dispatch =

How to restart service remotely?

冷暖自知 提交于 2020-01-12 13:48:34
问题 I can start or stop service remotely from .net project. ConnectionOptions options = new ConnectionOptions(); options.Username = @"192.168.36.22\test"; options.Password = "test"; ManagementScope scope = new ManagementScope(@"\\192.168.36.22\root\cimv2", options); scope.Connect(); ManagementOperationObserver Stop = new ManagementOperationObserver(); Stop.Completed += new CompletedEventHandler(Stop_CallBack); try { string NameServices = "ArcGIS Server"; WqlObjectQuery query = new WqlObjectQuery(

WMI call to get drivers

匆匆过客 提交于 2019-12-23 19:17:56
问题 I am new using WMI. What is it? Can I use WMI call in C# for example to get list of drivers on my PC? If so, which class do I call? 回答1: To list the installed drivers you can use the Win32_PnPSignedDriver WMI class as is show on this sample. using System; using System.Collections.Generic; using System.Management; using System.Text; namespace GetWMI_Info { class Program { static void Main(string[] args) { try { string ComputerName = "localhost"; ManagementScope Scope; Scope = new

Monitor Drive. Using VB Script

僤鯓⒐⒋嵵緔 提交于 2019-12-17 14:55:39
问题 I want to monitor a drive for file changes, using VBScript. I have the below code. It works fine for InstanceCreationEvent and InstanceDeletionEvent . But InstanceModificationEvent is not happening. From googling I got to know we need to use CIM_DataFile instead of CIM_DirectoryContainsFile to monitor InstanceModificationEvent . I am not sure how to modify the code. Can anyone help. FYI: One script should monitor all the folders and subfolders in a drive. PS: Any suggestion to improve the

Issue when executing IWbemServices.ExecQuery when executing WMI using JNA

六眼飞鱼酱① 提交于 2019-12-11 02:46:43
问题 I am trying to write a Java program which uses JNA to execute WMI query to execute on remote machine (Provided username/password). I am trying to port this WMI example. I have modified this code here for my testing purpose (directly provided username/password) and it works fine. But, in my java code, when executing the query using ExecQuery, I am getting the error code 0x80070005. String machineName = "machine"; String userNameWithDomain = "\\administrator"; String pass = "Password"; String

How to detect antivirus installed on windows 2003 server and 2008 server 2003 server R2and 2008 server R2 using WMI or other then WMI in C++

无人久伴 提交于 2019-12-04 04:10:24
问题 i have used WMI to detect that antivirus is present on OS, itz woking fine and display me information of antivirus like name and instance id on win xp and window7 by using Namespace:\root\SecurityCenter and \root\SecurityCenter, \root\Security. if(isHLOSVersion( )) hres = pLoc->ConnectServer( _bstr_t(L"root\\SecurityCenter2"), // Object path of SecurityCenter NULL, // User name. NULL = current user NULL, // User password. NULL = current 0, // Locale. NULL indicates current NULL, // Security

Monitor Drive. Using VB Script

家住魔仙堡 提交于 2019-11-27 16:22:42
I want to monitor a drive for file changes, using VBScript. I have the below code. It works fine for InstanceCreationEvent and InstanceDeletionEvent . But InstanceModificationEvent is not happening. From googling I got to know we need to use CIM_DataFile instead of CIM_DirectoryContainsFile to monitor InstanceModificationEvent . I am not sure how to modify the code. Can anyone help. FYI: One script should monitor all the folders and subfolders in a drive. PS: Any suggestion to improve the code and performance or other ideas also welcome. My Code: Dim arrFolders Dim strComputer Dim