MIF file is not inventoried if it contains some quotes or backslash characters in the value.
Example :
Following MIF File could not be collected :
Start Component
Name = "TEST Inventory"
Description = "TEST Inventory"
Start Group
Name = "TEST"
ID = 1
Class = ""
Description = "TEST"
Start Attribute
Name = "Path"
ID = 1
Description = "Path"
Type = String(64)
Value = ""C:\Program Files\CA\DSM\bin""
End Attribute
End Group
End Component
Process amm2iw32.exe used to convert MIF file to MNV file is returning the error :
Error in line 18
parse error
Or sometimes the MNV file contains wrong value :
000101[TEST Inventory]
000201[TEST Inventory|TEST]
00010500Path|C:Program FilesCADSM in
If MIF File contains some quotes or backslash characters in the value, process amm2iw32.exe is failing to analyze the MIF file. These characters must be protected by adding a backslash character before every quote and backslash characters.
The solution is to add a backslash character before every quote and backslash characters.
This could be done with the function Slash_Quotes :
FUNCTION Slash_Quote(sString AS STRING) AS STRING
DIM i as integer
DIM sBuf as STRING
sBuf=""
FOR i=1 TO Len(sString)
IF Mid(sString,i,1)="\" THEN
sBuf=sBuf+"\\"
ELSE
IF Mid(sString,i,1)="""" THEN
sBuf=sBuf+"\"""
ELSE
sBuf=sBuf+Mid(sString,i,1)
END IF
END IF
NEXT i
Slash_Quote=sBuf
END FUNCTION
Example of usage of this function :
DIM sMIFFile, sPath, SName AS STRING
DIM iIDGroup AS INTEGER
sMIFFile = ComputerPath+"test_script.mif"
CreateMIFfile(sMIFFile,"Test Inventory","Test Inventory")
iIDGroup = CreateMIFGroup(sMIFFile,"Test Inventory","Test Inventory","")
sPath="C:\Program Files\CA\DSM\bin"
sName="This is a ""Test""."
CreateMifString(sMifFile,iIDGroup,"Path",Slash_Quote(sPath),"Path")
CreateMifString(sMifFile,iIDGroup,"Name",Slash_Quote(sName),"Name")