WMI Issue


  • On a set of Windows 2012 servers, i check disk free space for hard disks, every day.  
    In a vb script is Without any changes to my knowledge to server security (using logon account), this vb script would work fine.  But lately, within the last few days, (note that the script runs without any error), i can execute it and it creates the WMI object.  But now each day, the hard disk value does not change from day to day.  The intVal_3 value of free disk space stays the same on each day it is run. And i have verified that the hard disk value has in fact changed every day.  It does the same using another user's logon.  So where do I start to analyse this issue?  I have been looking into  using WBEMTEST but dont know what to test from within that tool.  Because the script, noted below, actually runs and returns free disk space then that suggests permission to use wbem object is fine.  Could a O/S patch have caused this?  Any other suggestions on what to check.  thanks.

    2018-03-13:  Today, a reboot of the server did not help either.

    Const HARD_DISK = 3
    Const ForWriting = 2
    Const ForAppending = 8

    Dim intVal
    Dim strUserName 
    Dim strPassword 
    Dim fso
    Dim tst
    Dim strMachineName
    Dim objFSO
    Dim objTextFile
    Dim strDateTime

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    strDomain = ""

    strUser = ""
    strPassword = ""

    strComputer = ""

    WScript.Echo strComputer

    getDiskSpace strComputer

    Sub getDiskSpace(strComputer)
        Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
        Set objSWbemServices = objSWbemLocator.ConnectServer(strComputer, _
                                                         "Root\CIMv2", _
                                                         strUser, _
                                                         strPassword, _
                                                         "MS_409", _
                                                         "ntlmdomain:" + strDomain)
        Set colDisks = objSWbemServices.ExecQuery _
            ("Select * from Win32_LogicalDisk Where DriveType = " & HARD_DISK & "")

        ForEach objDisk in colDisks

            IfNotIsNull(objDisk.FreeSpace) Then
                intVal = CDbl(objDisk.FreeSpace)
                strDeviceId = objDisk.DeviceID 
                intVal = CDbl(objDisk.FreeSpace / 1024 / 1024)
                intVal_2 = intVal* .001
                intVal_3 = FormatNumber(intVal_2,3)
                WScript.Echo strDeviceId, " ", intVal_3


    • Edited by barrywl Tuesday, March 13, 2018 4:50 PM update on progress
    Monday, March 12, 2018 7:38 PM

All replies

  • Hi,

    We are the MAP Toolkit Support Team. We support MAP Toolkit related  issues.

    It seems that your issue is related to Windows, So kindly Contact the respective team.

    Thank you

    MAP Toolkit  Support 

    Aditya Karanam

    Monday, April 2, 2018 3:47 PM