Quantcast
Channel: Symantec Connect
Viewing all articles
Browse latest Browse all 26913

Custom Inventory - VBScript

$
0
0
ソリューションが必要です

Hi there,

Hope you well and able to assist :)

I have a VBScript collecting data from a text file, it searches for the keyword m_HbaName and should then return the value to the right.

However, there are two entries and it only returns the last one of the two.

____________________________________________________________________________________________

SCRIPT:

------------------------------------------------------------------------------------------------------------------------------------------------------------------

Set oShell = WScript.CreateObject("WSCript.shell") 
 
dim filesys, newfolder, newfolderpath
newfolderpath = "C:\CustInv" 
set filesys=CreateObject("Scripting.FileSystemObject") 
If Not filesys.FolderExists(newfolderpath) Then 
  Set newfolder = filesys.CreateFolder(newfolderpath) 
End If
 
oShell.run "cmd /c type c:\cnaboardmgmt.log >c:\CustInv\wwnoutput.txt", 0, True
 
 
Const ForReading = 1
dim wwn, strkey1
Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.Pattern = "m_HbaName"
 
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\CustInv\wwnoutput.txt", ForReading)
 
 
Do Until objFile.AtEndOfStream
    strSearchString = objFile.ReadLine
    Set colMatches = objRegEx.Execute(strSearchString)  
    If colMatches.Count > 0 Then
        For Each strMatch in colMatches
strkey1 = Mid(strSearchString, 19, 23)       
        Next
    End If
Loop
 
objFile.Close
 
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
 
'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 ("{9778a2d0-8538-484d-b7da-d15b03f66335}")
 
dim objDataClass
set objDataClass = nse.AddDataBlock (objDCInstance)
 
 
'Add a new row
dim objDataRow
set objDataRow = objDataClass.AddRow
 
'Set columns
objDataRow.SetField 0,strkey1
 
 
 
 
nse.SendQueued
______________________________________________________________________________________
 
File i need data from, i highlighted that which i need:
------------------------------------------------------------------------------------------------------------------------------------------------------
Board           : 0
Is Init         : 0
m_DevId         : f10b
m_SubDeviceId   : f126
m_SubVendorId   : 10df
m_drvFeatureList: 557
m_drvInfoVer    : 4
m_drvType       : 3
m_HbaName       : 10:00:00:00:c9:d3:30:78
m_DefaultWWPN   : 00:00:00:00:00:00:00:00
Is IBM          : 0
SLI mode        : 3
PCI Func. #     : 0
VPD Port# (V4)  : 0
VPD SN (SN)     : FC15211031
VPD Model (V2)  : LPe1205-M
 
Board           : 1
Is Init         : 0
m_DevId         : f10b
m_SubDeviceId   : f126
m_SubVendorId   : 10df
m_drvFeatureList: 557
m_drvInfoVer    : 4
m_drvType       : 3
m_HbaName       : 10:00:00:00:c9:d3:30:79
m_DefaultWWPN   : 00:00:00:00:00:00:00:00
Is IBM          : 0
SLI mode        : 3
PCI Func. #     : 1
VPD Port# (V4)  : 1
VPD SN (SN)     : FC15211031
VPD Model (V2)  : LPe1205-M

______________________________________________________________________________________

Result in DB:

------------------------------------------------------------------------------------------------------------------------------------------------------

 

_id        _ResourceGuid                                                    WWN
5          13887A05-A8D8-4DAB-8BBC-1F2591CC94AF        10:00:00:00:c9:d3:30:79
_________________________________________________________________________________________
 
What i need:
------------------------------------------------------------------------------------------------------------------------------------------------------------
_ResourceGuid                                                WWN1                                    WWN2
13887A05-A8D8-4DAB-8BBC-1F2591CC94AF   10:00:00:00:c9:d3:30:79           10:00:00:00:c9:d3:30:78
_________________________________________________________________________________________
 
 
Hope this all makes sense and that someone can point me in the right direction.
 
Thank you all in advance.
Eugene

 


Viewing all articles
Browse latest Browse all 26913

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>