ITMS Administrator Group

 View Only
  • 1.  Get Outlook mail id using custom script

    Posted Jan 22, 2014 06:49 AM
    Using the below script i can pull the values to a txt file, Can some body me help me to fetch the output into CMDB instead of text file.
    I hope we need to change rest of bold thing.
     
    'Find all Outlook pst files on C and D Drives
    'Pat Fiannaca
     
    strComputer = "."
    on error resume next
    set wshnetwork=createobject("wscript.network")
    scomputername=wshnetwork.computername
    set wshnetwork=nothing
    Const OverwriteExisting = True
     
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
     
    Set colFiles = objWMIService.ExecQuery _
        ("Select * from CIM_DataFile Where Extension = 'ost' AND (Drive = 'C:' OR Drive = 'D:')")
     
    If colFiles.Count = 0 Then
        Wscript.Quit
    End If
     
     
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFolder = objFSO.CreateFolder("C:\pstlog")
    Set objTextFile = objFSO.CreateTextFile("c:\pstlog\pst_files_on_" & scomputername & ".txt " , True)
     
    For Each objFile in colFiles
        objTextFile.Write(objFile.Drive & objFile.Path & "")
        objTextFile.Write(objFile.FileName & "." & objFile.Extension & ", Size ")
        objTextFile.Write(objFile.FileSize /1024 & "kb" & vbCrLf)
    Next
     
    objTextFile.Close

     



  • 2.  RE: Get Outlook mail id using custom script

    Posted Jan 22, 2014 02:54 PM

    Please refer to the example custom inventory file that is attached to https://www-secure.symantec.com/connect/downloads/ns7-custom-inventory-scan-specified-files-cimdatafile-class and modify the main section to suit your needs.



  • 3.  RE: Get Outlook mail id using custom script
    Best Answer

    Posted Jan 26, 2014 02:23 PM
    I tried the below script its working for me to get the outlook e-mail id, location of the ost file and filesize.
     
    'Find all Outlook pst files on C and D Drives
    'Pat Fiannaca
     
    strComputer = "."
    on error resume next
    set wshnetwork=createobject("wscript.network")
    scomputername=wshnetwork.computername
    set wshnetwork=nothing
    Const OverwriteExisting = True
     
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
     
    Set colFiles = objWMIService.ExecQuery _
        ("Select * from CIM_DataFile Where Extension = 'ost' AND (Drive = 'C:' OR Drive = 'D:')")
     
    If colFiles.Count = 0 Then
        Wscript.Quit
    End If
     
     
     
    '===================================================================================================================
    'Create instance of Altiris NSE component
    dim nse
    set nse = WScript.CreateObject ("Altiris.AeXNSEvent")
    ' Set the header data of the NSE
    ' Please don't modify this GUID
     
    nse.To = "{1592B913-72F3-4C36-91D2-D4EDA21D2F96}"
    nse.Priority = 1
    'Create Inventory data block. Here assumption is that the data class with below guid is already configured on server
    dim objDCInstance
    set objDCInstance = nse.AddDataClass ("{89fc0788-90c2-4121-8df1-c1140083c6f6}")
    dim objDataClass
    set objDataClass = nse.AddDataBlock (objDCInstance)
    'Add a new row
     
    dim objDataRow
    set objDataRow = objDataClass.AddRow
     
     
    'Set columns
     
    For Each objFile in colFiles
       objDataRow.SetField 0, objFile.Path
       objDataRow.SetField 1, objFile.FileName
       objDataRow.SetField 2, 1024
    Next
     
    nse.SendQueued