Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Troubles Converting XML file to SQL DB

Status
Not open for further replies.

kjohnson530

IS-IT--Management
Mar 26, 2006
28
0
0
US
I'm very new to working with XML and I'm trying to do a inventory of our physical assets without spending any money.

I came across a product from Microsoft called GPInventory which pull data about remote systems using wmi scripting I believe. Anyway the product offers the opportunity to store the results in an XML document which I'm hoping to use as a conduit to my SQL 2000 DB.
Below is my part of my xml doc, my schema file and my script to import it. Could someone explain to me what i'm doing wrong (WSH error code is 80004005)

XML--
Code:
<ComputerList>
<Computer Name="BENT-915" QueryState="Queried" Username="">
<ManagedObject Name="WMI: Logged on user" Query="select UserName from Win32_ComputerSystem">
<Instance>
<Attribute Name="UserName" Value="" />
</Instance>
</ManagedObject>
<ManagedObject Name="WMI: Processor Name" Query="select Name from Win32_Processor">
<Instance>
<Attribute Name="Name" Value=" Intel(R) Pentium(R) 4 CPU 1.80GHz" />
</Instance>
</ManagedObject>
<ManagedObject Name="WMI: Processor Speed" Query="select CurrentClockSpeed from Win32_Processor">
<Instance>
<Attribute Name="CurrentClockSpeed" Value="1794" />
</Instance>
</ManagedObject>
<ManagedObject Name="WMI: Computer Memory" Query="select TotalPhysicalMemory from Win32_ComputerSystem">
<Instance>
<Attribute Name="TotalPhysicalMemory" Value="670056448" />
</Instance>
</ManagedObject>
<ManagedObject Name="WMI: Computer Manufacturer" Query="select Manufacturer from Win32_ComputerSystem">
<Instance>
<Attribute Name="Manufacturer" Value="Dell Computer Corporation" />
</Instance>
</ManagedObject>
<ManagedObject Name="WMI: Computer Model" Query="select Model from Win32_ComputerSystem">
<Instance>
<Attribute Name="Model" Value="OptiPlex GX400 " />
</Instance>
</ManagedObject>
<ManagedObject Name="WMI: Display Adapter" Query="select Caption from Win32_DisplayConfiguration">
<Instance>
<Attribute Name="Caption" Value="16MB ATI Rage 128 Ultra" />
</Instance>
</ManagedObject>
</Computer>
</script>
Schema---
Code:
<?xml version="1.0" ?>
<Schema xmlns="urn:schemas-microsoft-com:xml-data" 
xmlns:dt="urn:schemas-microsoft-com:xml:datatypes" 
xmlns:sql="urn:schemas-microsoft-com:xml-sql" > 

<ElementType name="UserName" dt:type="string" />
<ElementType name="Name" dt:type="string" />
<ElementType name="CurrentClockSpeed" dt:type="string" />
<ElementType name="TotalPhysicalMemory" dt:type="string" />
<ElementType name="Manufacturer" dt:type="string" />
<ElementType name="Model" dt:type="string" />
<ElementType name="Caption" dt:type="string" />


<ElementType name="ComputerList" sql:is-constant="1">
<element type="ManagedObject" />
</ElementType>

<ElementType name="ManagedObject" sql:relation="tblSystem">

<element type="UserName" sql:field="UserName" />
<element type="Name" sql:field="ProcName" />
<element type="CurrentClockSpeed" sql:field="ProcSpeed" />
<element type="TotalPhysicalMemory" sql:field="AmtMemory" />
<element type="Manufacturer" sql:field="builtby" />
<element type="Model" sql:field="Model" />
<element type="Caption" sql:field="VideoCard" />
</ElementType>

</Schema>
Script---

Code:
set objBL = CreateObject("SQLXMLBulkLoad.SQLXMLBulkLoad")
objBL.ConnectionString = "provider=SQLOLEDB.1;data source=Intranet;database=asset;uid=kjohnson;pwd=notrealpassword"
objBL.ErrorLogFile = "c:\error.log"
objBL.Execute "c:\map3.xml", "c:\Bent.xml"
set objBL=Nothing

Any help would be greatly appreciated.
 
This may not be ALL of your problem, but your first line (in the XML file) is <ComputerList> and your last line is </script>

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top