2011-01-20 3 views
3

바이러스 백신이 최신이고 실행 중인지 확인하려면 서버 그룹을 확인해야합니다. 까다로운 점은 Windows 2003 및 2008 서버에 퍼져 있기 때문에 모두 검사 할 수 있어야한다는 것입니다.C에서 바이러스 백신 상태 확인

C# 또는 VB.NET에서이 작업을 수행 할 수있는 방법이 있습니까?

WMI를 사용하여 간단히 살펴 보았지만 2008/win7 컴퓨터에 표시됩니다. Microsoft는 사용자가 제공 한 정보를 변경했습니다.

수있는 사람의 도움을 실행 가능

  • AV 이름
  • AV 버전
  • AV 항상 최신
  • AV/:

    은 요약하면, 나는 다음과 같은 필요 ?

답변

3

언급 한대로 WMC를 사용하여 here 샘플을 찾을 수 있습니다. 이 포스터에는 이것이 Win 7 머신에서 수행되고 있다고 나와 있습니다. 아래 코드는 시작해야합니다 ...

ConnectionOptions _connectionOptions = new ConnectionOptions(); 
//Not required while checking it in local machine. 
//For remote machines you need to provide the credentials 
//options.Username = ""; 
//options.Password = ""; 
_connectionOptions.EnablePrivileges = true; 
_connectionOptions.Impersonation = ImpersonationLevel.Impersonate; 
//Connecting to SecurityCenter2 node for querying security details 
ManagementScope _managementScope = new ManagementScope(string.Format("\\\\{0}\\root\\SecurityCenter2", ipAddress), _connectionOptions); 
_managementScope.Connect(); 
//Querying 
ObjectQuery _objectQuery = new ObjectQuery("SELECT * FROM AntivirusProduct"); 
ManagementObjectSearcher _managementObjectSearcher = 
    new ManagementObjectSearcher(_managementScope, _objectQuery); 
ManagementObjectCollection _managementObjectCollection = _managementObjectSearcher.Get(); 
if (_managementObjectCollection.Count > 0) 
{ 
    foreach (ManagementObject item in _managementObjectCollection) 
    { 
     Console.WriteLine(item["displayName"]); 
     //For Kaspersky AntiVirus, I am getting a null reference here. 
     //Console.WriteLine(item["productUptoDate"]); 

     //If the value of ProductState is 266240 or 262144, its an updated one. 
     Console.WriteLine(item["productState"]); 
    } 
} 
+0

감사합니다. 그것은 내가 원래 혼란스러워했던 productState였습니다. 이 답변을 통해 http://www.neophob.com/2010/03/wmi-query-windows-securitycenter2/를 통해 제품 상태에 대한 더 많은 정보를 얻으실 수 있습니다. 또한 securityCenter2는 Vista SP1 이상을 제공합니다. –

+0

쿼리, Windows 7에서 최신 바이러스 백신 기능을 사용할 수 있습니까 ?? @Aaron McIver – TechBrkTru

3

환경 설정에 따라 보안 및 권한을 지정해야 할 수 있습니다. 또한 과 같은 일부 바이러스 백신 제품 (예 : McAfee)은 WMI을 통해 데이터를 사용할 수 없도록합니다.

이 조각을 사용하여 WMI에서 바이러스 백신 정보를 조회 할 수 있습니다 이것에 대한

string computer = Environment.MachineName; 
string wmipath = @"\\" + computer + @"\root\SecurityCenter"; 
string query = @"SELECT * FROM AntivirusProduct"; 

ManagementObjectSearcher searcher = new ManagementObjectSearcher(wmipath, query); 
ManagementObjectCollection results = searcher.Get(); 

foreach (ManagementObject result in results) 
{ 
    // do something with `result[value]`); 
} 
+0

WHS가 AV를 설치했는지 여부를 알기 위해 클라이언트 컴퓨터에서 정보를 얻는 지 궁금합니다. McAfee가 이러한 옵션 중 하나이기 때문에; 내가 수집하는 특정 업체 일 수 있습니다. –

+0

@Arron 나는 탐지가 어떻게 작동하는지에 대해서는 매우 모호하지만 McAfee eOrchestrator와 관련이 있다는 것을 기억합니다. –

+0

답변 greg을 주셔서 감사합니다. xp/vista (pre-sp1) 및 nt 2003에서 작동하는 것으로 보입니다. 이제 더 많은 테스트를 거칩니다. –

관련 문제