none
VBscript information raid par WMI

    Question

  • Bonjour,

    J'aurais besoin de récupérer sur des machines de marque différente (ce qui exclu les API propriétaires) via un VB Script les informations sur les disques RAID installés, à savoir :

    Le type (RAID0, RAID5, etc..)

    Les caractéristiques de ces montages

    Et toute information qui me permettrait de recréer l'environnement en cas de problème.

    D'avance merci à celui ou celle qui me donnera la solution.

    Une petit précision ce script doit tourner sous W2K3 WXP et si possible pouvoir tourner aussi sous W2K.

    vendredi 23 septembre 2011 09:22

Réponses

  • Bonjour,

    Jete un oeil ici http://www.anchor.com.au/hosting/dedicated/monitoring_windows_software_raid

    En plus tu veux tester ce script aussi :

    Option Explicit
    Const strComputer = "."

    Dim objWMIService
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

    ' Find drive letter of system drive
    Dim colOS, objOS, strSystemDrive
    Set colOS = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem WHERE Primary=True")
    For Each objOS in colOS
    strSystemDrive = Left(objOS.SystemDirectory,2)
    Next

    Dim colPartitions, objPartition
    Dim colDisks, objDisk
    Dim colIDEInterfaces, objIDEInterface
    Dim colIDEControllers, objIDEController
    Dim colSCSIInterfaces, objSCSIInterface
    Dim colSCSIControllers, objSCSIController
    Dim colDrivers, objDriver


    'Trace logical drive (system drive) down to disk controller and output details
    Set colPartitions = objWMIService.ExecQuery("ASSOCIATORS OF {Win32_LogicalDisk.DeviceID=""" & strSystemDrive & """} WHERE AssocClass = Win32_LogicalDiskToPartition")
    For Each objPartition in colPartitions
    Set colDisks = objWMIService.ExecQuery("ASSOCIATORS OF {Win32_DiskPartition.DeviceID=""" & objPartition.DeviceID & """} WHERE AssocClass = Win32_DiskDriveToDiskPartition")
    For Each objDisk in colDisks
    If objDisk.InterfaceType = "IDE" Then
    Set colIDEInterfaces = objWMIService.ExecQuery("ASSOCIATORS OF {Win32_PNPEntity.DeviceID=""" & Replace(objDisk.PNPDeviceID,"\","\\") & """} WHERE AssocClass = Win32_IDEControllerDevice")
    For Each objIDEInterface in colIDEInterfaces
    Set colIDEControllers = objWMIService.ExecQuery("ASSOCIATORS OF {Win32_PNPEntity.DeviceID=""" & Replace(objIDEInterface.PNPDeviceID,"\","\\") & """} WHERE AssocClass = Win32_IDEControllerDevice")
    If colIDEControllers.Count > 0 Then
    For Each objIDEController in colIDEControllers
    Wscript.Echo "Name: "        & objIDEController.Name
    Wscript.Echo "PNP ID: "      & objIDEController.PNPDeviceID

    Set colDrivers = objWMIService.ExecQuery("SELECT * FROM Win32_PnPSignedDriver WHERE DeviceID = '" & Replace(objIDEController.PNPDeviceID,"\","\\") & "'")
    For Each objDriver In colDrivers
    Wscript.Echo "Driver version: " & objDriver.DriverVersion
    Next
    Next
    Else
    Wscript.Echo "Description: " & objIDEInterface.Description
    Wscript.Echo "PNP ID: "      & objIDEInterface.PNPDeviceID

    Set colDrivers = objWMIService.ExecQuery("SELECT * FROM Win32_PnPSignedDriver WHERE DeviceID = '" & Replace(objIDEInterface.PNPDeviceID,"\","\\") & "'")
    For Each objDriver In colDrivers
    Wscript.Echo "Driver version: " & objDriver.DriverVersion
    Next
    End If
    Next
    Else
    Set colSCSIInterfaces = objWMIService.ExecQuery("ASSOCIATORS OF {Win32_PNPEntity.DeviceID=""" & Replace(objDisk.PNPDeviceID,"\","\\") & """} WHERE AssocClass = Win32_SCSIControllerDevice")
    For Each objSCSIInterface in colSCSIInterfaces
    Set colSCSIControllers = objWMIService.ExecQuery("ASSOCIATORS OF {Win32_PNPEntity.DeviceID=""" & Replace(objSCSIInterface.DeviceID,"\","\\") & """} WHERE AssocClass = Win32_SCSIControllerDevice")
    If colSCSIControllers.Count > 0 Then
    For Each objSCSIController in colSCSIControllers
    Wscript.Echo "Description: " & objSCSIController.Description, "info"
    Wscript.Echo "PNP ID: "      & objSCSIController.PNPDeviceID, ""

    Set colDrivers = objWMIService.ExecQuery("SELECT * FROM Win32_PnPSignedDriver WHERE DeviceID = '" & Replace(objSCSIController.PNPDeviceID,"\","\\") & "'")
    For Each objDriver In colDrivers
    Wscript.Echo "Driver version: " & objDriver.DriverVersion
    Next
    Next
    Else
    Wscript.Echo "Description: " & objSCSIInterface.Description
    Wscript.Echo "PNP ID: "      & objSCSIInterface.PNPDeviceID

    Set colDrivers = objWMIService.ExecQuery("SELECT * FROM Win32_PnPSignedDriver WHERE DeviceID = '" & Replace(objSCSIInterface.PNPDeviceID,"\","\\") & "'")
    For Each objDriver In colDrivers
    Wscript.Echo "Driver version: " & objDriver.DriverVersion
    Next
    End If
       Next
    End If
    Next
    Next


    Bechir Gharbi | http://myitforum.com/cs2/blogs/bgharbi/ | Time zone : GMT+1
    mardi 27 septembre 2011 09:13

Toutes les réponses

  • Bonjour,

    Jete un oeil ici http://www.anchor.com.au/hosting/dedicated/monitoring_windows_software_raid

    En plus tu veux tester ce script aussi :

    Option Explicit
    Const strComputer = "."

    Dim objWMIService
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

    ' Find drive letter of system drive
    Dim colOS, objOS, strSystemDrive
    Set colOS = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem WHERE Primary=True")
    For Each objOS in colOS
    strSystemDrive = Left(objOS.SystemDirectory,2)
    Next

    Dim colPartitions, objPartition
    Dim colDisks, objDisk
    Dim colIDEInterfaces, objIDEInterface
    Dim colIDEControllers, objIDEController
    Dim colSCSIInterfaces, objSCSIInterface
    Dim colSCSIControllers, objSCSIController
    Dim colDrivers, objDriver


    'Trace logical drive (system drive) down to disk controller and output details
    Set colPartitions = objWMIService.ExecQuery("ASSOCIATORS OF {Win32_LogicalDisk.DeviceID=""" & strSystemDrive & """} WHERE AssocClass = Win32_LogicalDiskToPartition")
    For Each objPartition in colPartitions
    Set colDisks = objWMIService.ExecQuery("ASSOCIATORS OF {Win32_DiskPartition.DeviceID=""" & objPartition.DeviceID & """} WHERE AssocClass = Win32_DiskDriveToDiskPartition")
    For Each objDisk in colDisks
    If objDisk.InterfaceType = "IDE" Then
    Set colIDEInterfaces = objWMIService.ExecQuery("ASSOCIATORS OF {Win32_PNPEntity.DeviceID=""" & Replace(objDisk.PNPDeviceID,"\","\\") & """} WHERE AssocClass = Win32_IDEControllerDevice")
    For Each objIDEInterface in colIDEInterfaces
    Set colIDEControllers = objWMIService.ExecQuery("ASSOCIATORS OF {Win32_PNPEntity.DeviceID=""" & Replace(objIDEInterface.PNPDeviceID,"\","\\") & """} WHERE AssocClass = Win32_IDEControllerDevice")
    If colIDEControllers.Count > 0 Then
    For Each objIDEController in colIDEControllers
    Wscript.Echo "Name: "        & objIDEController.Name
    Wscript.Echo "PNP ID: "      & objIDEController.PNPDeviceID

    Set colDrivers = objWMIService.ExecQuery("SELECT * FROM Win32_PnPSignedDriver WHERE DeviceID = '" & Replace(objIDEController.PNPDeviceID,"\","\\") & "'")
    For Each objDriver In colDrivers
    Wscript.Echo "Driver version: " & objDriver.DriverVersion
    Next
    Next
    Else
    Wscript.Echo "Description: " & objIDEInterface.Description
    Wscript.Echo "PNP ID: "      & objIDEInterface.PNPDeviceID

    Set colDrivers = objWMIService.ExecQuery("SELECT * FROM Win32_PnPSignedDriver WHERE DeviceID = '" & Replace(objIDEInterface.PNPDeviceID,"\","\\") & "'")
    For Each objDriver In colDrivers
    Wscript.Echo "Driver version: " & objDriver.DriverVersion
    Next
    End If
    Next
    Else
    Set colSCSIInterfaces = objWMIService.ExecQuery("ASSOCIATORS OF {Win32_PNPEntity.DeviceID=""" & Replace(objDisk.PNPDeviceID,"\","\\") & """} WHERE AssocClass = Win32_SCSIControllerDevice")
    For Each objSCSIInterface in colSCSIInterfaces
    Set colSCSIControllers = objWMIService.ExecQuery("ASSOCIATORS OF {Win32_PNPEntity.DeviceID=""" & Replace(objSCSIInterface.DeviceID,"\","\\") & """} WHERE AssocClass = Win32_SCSIControllerDevice")
    If colSCSIControllers.Count > 0 Then
    For Each objSCSIController in colSCSIControllers
    Wscript.Echo "Description: " & objSCSIController.Description, "info"
    Wscript.Echo "PNP ID: "      & objSCSIController.PNPDeviceID, ""

    Set colDrivers = objWMIService.ExecQuery("SELECT * FROM Win32_PnPSignedDriver WHERE DeviceID = '" & Replace(objSCSIController.PNPDeviceID,"\","\\") & "'")
    For Each objDriver In colDrivers
    Wscript.Echo "Driver version: " & objDriver.DriverVersion
    Next
    Next
    Else
    Wscript.Echo "Description: " & objSCSIInterface.Description
    Wscript.Echo "PNP ID: "      & objSCSIInterface.PNPDeviceID

    Set colDrivers = objWMIService.ExecQuery("SELECT * FROM Win32_PnPSignedDriver WHERE DeviceID = '" & Replace(objSCSIInterface.PNPDeviceID,"\","\\") & "'")
    For Each objDriver In colDrivers
    Wscript.Echo "Driver version: " & objDriver.DriverVersion
    Next
    End If
       Next
    End If
    Next
    Next


    Bechir Gharbi | http://myitforum.com/cs2/blogs/bgharbi/ | Time zone : GMT+1
    mardi 27 septembre 2011 09:13
  • Merci,

    De la réponse je testes et je te donnerais un retour le plus vite possible.

    Pour le moment je n'ai plus de machine RAID de libre pour des tests.

    mardi 27 septembre 2011 10:13