Ветеран
Сообщения: 27449
Благодарности: 8087
|
Профиль
|
Отправить PM
| Цитировать
Пробуйте:
читать дальше »
Код:
Option Explicit
Dim strComputer
Dim objSWbemDateTime
Dim objSWbemLocator
Dim objSWbemServicesEx
Dim objSWbemObjectEx_Win32_LogicalDisk
Dim objSWbemObjectEx_Win32_SID
Dim objSWbemObjectEx_CIM_DataFile
Dim strDrivesCondition
Dim strExtensionsCondition
Dim strExtension
strComputer = "."
Set objSWbemDateTime = WScript.CreateObject("WbemScripting.SWbemDateTime")
Set objSWbemLocator = WScript.CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServicesEx = objSWbemLocator.ConnectServer(strComputer, "root\cimv2")
' Drives condition
strDrivesCondition = ""
For Each objSWbemObjectEx_Win32_LogicalDisk In objSWbemServicesEx.ExecQuery("SELECT Name FROM Win32_LogicalDisk WHERE DriveType=3")
strDrivesCondition = strDrivesCondition & "Drive = '" & objSWbemObjectEx_Win32_LogicalDisk.Name & "' OR "
Next
strDrivesCondition = Left(strDrivesCondition, Len(strDrivesCondition) - Len(" OR "))
' Extensions condition
strExtensionsCondition = ""
For Each strExtension In Array("avi", "MP3", "WMA", "MPG", "MP4")
strExtensionsCondition = strExtensionsCondition & "Extension = '" & strExtension & "' OR "
Next
strExtensionsCondition = Left(strExtensionsCondition, Len(strExtensionsCondition) - Len(" OR "))
For Each objSWbemObjectEx_CIM_DataFile In objSWbemServicesEx.ExecQuery( _
"SELECT CSName, Name, CreationDate From CIM_DataFile WHERE (" & strDrivesCondition & ") AND (" & strExtensionsCondition & ")")
objSWbemDateTime.Value = objSWbemObjectEx_CIM_DataFile.CreationDate
For Each objSWbemObjectEx_Win32_SID In objSWbemServicesEx.Get("Win32_LogicalFileSecuritySetting='" & objSWbemObjectEx_CIM_DataFile.Name & "'").Associators_("Win32_LogicalFileOwner", "", "Owner")
WScript.Echo objSWbemObjectEx_CIM_DataFile.CSName, vbTab, objSWbemObjectEx_Win32_SID.ReferencedDomainName & "\" & objSWbemObjectEx_Win32_SID.AccountName, vbTab, objSWbemDateTime.GetVarDate, objSWbemObjectEx_CIM_DataFile.Name
Next
Next
Set objSWbemServicesEx = Nothing
Set objSWbemLocator = Nothing
Set objSWbemDateTime = Nothing
WScript.Quit 0
|
Последний раз редактировалось Iska, 16-08-2012 в 17:48.
Отправлено: 17:41, 16-08-2012
| #4
|