Issue with ActiveX script running from SQL Agent

  • Seeking some help here please.

    I have a very strange problem on a production server SQL2005 server.

    I have a SQL Agent job that has a single step that is some activex code for disk space monitoring. There is more code to it but I have narrowed the issue down to a piece of code I can run for debugging the issue.

    The following code stalls out on the BOLD line of code and progresses no further. At this point, I have to stop the job as it will never finish. This same code works on other SQL2005 servers as well as SQL2008/SQL2012 instances.

    Set oShell = CreateObject("WScript.Shell")

    Set WshNetwork = CreateObject("WScript.Network")

    strComputer = WshNetwork.ComputerName

    Set objWMIService = GetObject( "winmgmts" & chr(58) & "//" & strComputer & "/root/cimv2" )

    Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalDisk where DriveType=3",,48)

    Set WshNetwork = nothing

    Set objWMIService = nothing

    Set colItems = nothing

    Set oShell = nothing

    Some trouble shooting I have done so far:

    I can create a VBscript .vbs file and execute it via XP_CMDSHELL without issue.

    I can run it manually on the server logged in under the same domain account that both SQLAgent and SQLServer instances are running as without issue.

    I can also run it manually on the server using my own domain login without issue.

    This is a stand alone server so no clustering or anything fancy that might get in the way.

    A reboot of the server also did not help.

    There is no console/echo code to hang up the script either.

    I have some DB connection code (not shown here) that writes to a table so I know the strComputer is being calculated correctly.

    Windows Admins as a last effort did a WMI rebuild which also did not help.

    For reference:

    select @@version

    Microsoft SQL Server 2005 - 9.00.4035.00 (X64)

    Note: I do not have admin access to this box as that team is separated from the DBA team due to security regulations and requirements, however, they have been as helpful as possible.

    Any advise would be greatly appreciated.

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply