Hi Lonkero,

sorry for my incomplete question. I´m a fresh scripter and need help to get code intigrated.
Yes i wanna code my self.

My Code is nearly the same as posted at the beginning of this posting:

 Code:
;*** CREATE AN ACCESS DATABASE WITH A TABLE NAMED COMPUTERS****
;*** CREATE THE FOLLOWING FIELDS: COMPUTERNAME, DOMAIN
;*** OSNAME, MANUFACTURER, OSVERSION, OSBUILD, OSTYPE, LANGUAGE
;*** SERVICEPACK, BOOTDEVICE, SYSTEMDEVICE, WINDIR, SYSDIR, INSTALLDATE
;*** LASTBOOTTIME, OSSERIAL, SYSMANUFACTURER, SYSMODEL, SYSSERIAL, SYSBIOSVER
;*** SYSBIOSDATE, CPUMANUFACTURER, CPUDESCRIPTION, CPUSPEED, MAXCLOCK, FAMILY
;*** STEPPING, DEVICEID, SYSMEMORY, DISKNAMES, VOLNAMES, DISKNAMES, DISKSIZE
;*** FILESYS, FREESPACE, VIDEOCARD, VIDEORES, PRINTERS, NICCARD, MODIFYDATETIME
;*** APPLICATIONS, SERVICES, USERNAME

DIM $DBpath
;*** CONFIGURE DATABASE PATH***
$DBpath = "\\server\...\IT-Inventar.mdb"

CLS
AT (1,1) "Asset Audit Script Processing..."
SLEEP 2
CLS

BREAK ON CLS

;**** DECLARE VARIABLES ***

DIM $CNstring, $CMDtxt, $cn, $cmd, $rs
DIM $ModifyDateTime, $computername, $username, $osname
DIM $OSType, $ServicePack
DIM $InstallDate, $LastBoottime
DIM $OSSerial, $SysManufacturer, $SysModel, $SysSerial
DIM $CPUDescription, $CPUSpeed
DIM $SysMemory, $DiskSize
DIM $FreeSpace, $VideoCard, $VideoRes, $ptr, $NicCard, $nic

DIM $Privilegien, $IP, $MAC, $Uhrzeit, $MonitorDescription, $MonHersteller


If Exist("$DBpath") = 0
? "IT Assets Database Not Found. Aborting..."
Sleep 1
Goto end
EndIf

;*** CONFIGURE DATABASE CONNECTION STRING ***
$CNstring="Driver={Microsoft Access Driver (*.mdb)}; DBQ=$DBpath"
$CMDtxt = "select * from COMPUTERS where computername = '@WKSTA'"
$cn = CreateObject ("ADODB.Connection")
$cmd = CreateObject ("ADODB.Command")
$rs = CreateObject ("ADODB.RecordSet")

$cn.connectionstring = $CNstring
$cn.Open
$cmd.activeconnection = $cn
$rs.cursortype = 3
$rs.locktype = 3
$rs.activecommand = $cmd

$cmd.commandtext = $CMDtxt $rs.Open ($cmd)

;*** COLLECT WORKSTAION ASSET INFORMATION

$MAC = @ADDRESS
$Uhrzeit = @time
$Privilegien = @PRIV
$IP = @IPADDRESS0
$ModifyDateTime = @DATE + " " + @TIME
$computername = @WKSTA
$username = @userid
$osname = WMIQuery("Caption","Win32_OperatingSystem")
$OSType = WMIQuery("BuildType","Win32_OperatingSystem")
$ServicePack = WMIQuery("CSDVersion","Win32_OperatingSystem")
$InstallDate = WMIQuery("InstallDate","Win32_OperatingSystem")
$LastBoottime = @date
$OSSerial = WMIQuery("SerialNumber","Win32_OperatingSystem")
$SysManufacturer = WMIQuery("Manufacturer","Win32_ComputerSystem")
$SysModel = WMIQuery("Model","Win32_ComputerSystem")
$SysSerial = WMIQuery("SerialNumber","Win32_BIOS")
$wmiColl = GetObject("WinMgmts:root/cimv2").ExecQuery("Select * FROM Win32_Processor ")
For Each $wmiObj in $wmiColl
$CPUDescription = $wmiObj.Name	
Next
Sleep 5
$CPUSpeed = WMIQuery("CurrentClockSpeed","Win32_Processor")

;;FUNCTION		Memory() 
;; 
;;AUTHOR		Glenn Barnas
;; 
;;ACTION		Returns the amount of Available Physical RAM in a local or remote system 
;; 
;;SYNTAX		Memory([system]) 
;; 
;;VERSION		4.0 
;; 
;;DATE			v1.0 - 2004/02/04
;; 
;;DATE REVISED		v2.0 - 2005/02/25 - updated to allow larger memory sizes (x86)
;;			v3.0 - 2007/10/05 - rewrite to support x64 systems, tighten code
;;			v4.0 - 2013/11/02 - rewrite to detect large memory blocks on post-Vista platforms
;; 
;;PARAMETERS		System - OPTIONAL - name of system to query. Default is local system
;;
;;REMARKS		Returns Physical RAM size available to the O/S using registry memory allocation map
;;			Returns @ERROR on registry read failure, or 13 / "Data is Invalid" if reg is empty
;;			DOES NOT return physical hardware ram value! Some systems allocate RAM to BIOS cache 
;;			or video adapters and this memory is not reported. This can be adjusted for using
;;			the second example below.
;; 
;;RETURNS		Integer - Available Physical RAM (in Megabytes) 
;; 
;;DEPENDENCIES		None 
;; 
;;TESTED WITH		WinXP, Vista, Win7, Win8
;;			Windows Server 2000, 2003, 2008, 2012
;;			Tested with up to 16G of RAM 
;; 
;;EXAMPLES		$RAM = Memory('ThatPC')		; Get the available RAM from a remote computer
;;			
;;			; Adjust for BIOS/Video ram to estimate total physical RAM by using the smallest
;;			; deployed DIMM module as an increment. Use "1024" for full GB increments.
;;			; If the GB flag is used, this method must be adjusted to define MSize in GB values
;;			; (e.g. 0.5 instead of 512). 
;;			$MSize = 512			; Size of smallest RAM module (DIMM)
;;			
;;			$Mem = Memory()			; get reported memory
;;			$Ma  = $Mem / $MSize		; determine number of modules installed
;;			
;;			; If a fractional module is detected, add another full module
;;			; this accounts for a fractional module used for BIOS cache or video RAM
;;			If $Mem Mod $MSize $Ma = $Ma + 1 EndIf
;;			
;;			; $Mem now holds a value based more closely on installer rather than available RAM
;;			$Mem = $Ma * $MSize		; Memory is #_modules * Mod_Size
;;			
;; 
;
Function Memory(Optional $_System, Optional $_fGB)

  Dim $_MemMap				; Physical Memory Map
  Dim $_Start, $_End, $_Step		; for/next start & step increment
  Dim $_Sum				; running sum of memory from map
  Dim $_Idx				; temporary index var
  Dim $_iMem				; Memory region size index
  Dim $_Error				; Error placeholder

  ; Insure $_System has "\\System\" format if it is specified 
  If $_System <> ''
    $_System = '\\' + Join(Split($_System, '\'), '', 3) + '\'
  EndIf

  ; Get the memory value from the registry 
  $_Idx = $_System + 'HKLM\hardware\resourcemap\system resources\physical memory'
  $_MemMap = ReadValue($_Idx, '.Translated')

  ; Check for invalid read and Return 
  If Len($_MemMap) = 0 Or @ERROR
    $Memory = 0				; return 0 Mbytes 
    $_Error = IIf(@ERROR, @ERROR, 13) 	; Return "Data is Invalid" if no error but data is blank 
    Exit $_Error
  EndIf

  ; determine system's O/S type based on architecture
  $_Idx = $_System + 'HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'
  If ReadValue($_Idx, 'PROCESSOR_ARCHITECTURE') = 'AMD64'
    $_Step  = 40	; Define the step size based on the O/S Architecture
    $_Start = 33	; Offset where memory descriptor blocks start
    $_Sum   = 0.0	; no unreported base memory to account for
    $_iMem  = 10	; Memory size index
  Else
    $_Step  = 32	; Define the step size based on the O/S Architecture
    $_Start = 41	; Offset where memory descriptor blocks start
    $_Sum   = 737280.0	; account for base memory not identified in memory map - x86 only
    $_iMem  = 2		; Memory size index
  EndIf
  $_End = Len($_MemMap) - 8

  For $_Idx = $_Start to $_End Step $_Step
    $_Block = SubStr($_MemMap, $_Idx, $_Step)

    If SubStr($_Block, $_iMem, 1) > 3
      $_Sum = $_Sum + CDbl(Val('&' + SubStr($_Block, $_Step - 1, 2))) * 4294967296.0
                    + CDbl(Val('&' + SubStr($_Block, $_Step - 3, 2))) * 16777216.0
                    + CDbl(Val('&' + SubStr($_Block, $_Step - 5, 2))) * 65536.0
                    + CDbl(Val('&' + SubStr($_Block, $_Step - 7, 2))) * 256.0
                    + CDbl(Val('&' + SubStr($_Block, $_Step - 9, 2)))
    Else
      $_Sum = $_Sum + CDbl(Val('&' + SubStr($_Block, $_Step - 1, 2))) * 16777216.0
                    + CDbl(Val('&' + SubStr($_Block, $_Step - 3, 2))) * 65536.0
                    + CDbl(Val('&' + SubStr($_Block, $_Step - 5, 2))) * 256.0
                    + CDbl(Val('&' + SubStr($_Block, $_Step - 7, 2)))
    EndIf
  Next

  ; Sum is in Bytes - return the total as megabytes
  $Memory = CInt($_Sum / 1048576)
  Exit 0

EndFunction

;***Continue COLLECT WORKSTAION ASSET INFORMATION
$SysMemory = val(WMIQuery("TotalPhysicalMemory","Win32_LogicalMemoryConfiguration"))/1024
If $SysMemory = 0
  $SysMemory = Memory()
EndIf
$DiskSize = WMIQuery("size","Win32_LogicalDisk")
$FreeSpace = WMIQuery("freespace","Win32_LogicalDisk")
$VideoCard = WMIQuery("Description","Win32_VideoController")
$VideoRes = WMIQuery("VideoModeDescription","Win32_VideoController")
for each $nic in Split(WMIQuery("ProductName","Win32_NetworkAdapter"),"|")
if instr($nic,"miniport")=0 and instr($nic,"RAS")=0 and instr($nic,"Parallel")=0
$NicCard = $nic
$wmiColl = GetObject("WinMgmts:root/cimv2").ExecQuery("Select * FROM Win32_DesktopMonitor")
For Each $wmiObj in $wmiColl
$MonitorDescription = $wmiObj.Name
$MonHersteller = $wmiObj.MonitorManufacturer
Next
$Applications = WMIQuery("Caption","Win32_Product")
$Services = WMIQuery("Caption","Win32_Service")
endif
next

FUNCTION WMIQuery($what,$where,)
dim $strQuery, $objEnumerator, $value
$strQuery = "Select $what From $where"
$SystemSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//@WKSTA")
$objEnumerator = $SystemSet.ExecQuery($strQuery)
For Each $objInstance in $objEnumerator
If @Error = 0 and $objInstance <> ""
$=execute("$$value = $$objInstance.$what")
$WMIQuery="$value"+"|"+"$WMIQuery"
EndIf
Next
$WMIQuery=left($WMIQuery,len($WMIQuery)-1)
exit @error
ENDFUNCTION

;*** ADD RECORDS TO THE DATABASE ***
If $rs.eof = -1 ; addnew is only needed if a record for this workstation was not found.
$rs.addnew
EndIf
$rs.fields.item("MonHersteller").value = $MonHersteller
$rs.fields.item("MonitorDescription").value = $MonitorDescription
$rs.fields.item("IP").value = $IP
$rs.fields.item("Uhrzeit").value = $Uhrzeit
$rs.fields.item("MAC").value = $MAC
$rs.fields.item("PRIVILEGIEN").value = $Privilegien
$rs.fields.item("COMPUTERNAME").value = $computername
$rs.fields.item("OSNAME").value = $osname
$rs.fields.item("OSTYPE").value = $OSType
$rs.fields.item("SERVICEPACK").value = $ServicePack
$rs.fields.item("INSTALLDATE").value = $InstallDate
$rs.fields.item("LASTBOOTTIME").value = $LastBoottime
$rs.fields.item("OSSERIAL").value = $OSSerial
$rs.fields.item("SYSMANUFACTURER").value = $SysManufacturer
$rs.fields.item("SYSMODEL").value = $SysModel
$rs.fields.item("SYSSERIAL").value = $SysSerial
$rs.fields.item("CPUDESCRIPTION").value = $CPUDescription
$rs.fields.item("CPUSPEED").value = $CPUSpeed
$rs.fields.item("SYSMEMORY").value = $SysMemory
$rs.fields.item("DISKSIZE").value = $DiskSize
$rs.fields.item("FREESPACE").value = $FreeSpace
$rs.fields.item("VIDEOCARD").value = $VideoCard
$rs.fields.item("VIDEORES").value = $VideoRes
$rs.fields.item("NICCARD").value = $NicCard
$rs.fields.item("MODIFYDATETIME").value = $ModifyDateTime
$rs.fields.item("APPLICATIONS").value = $Applications
$rs.fields.item("SERVICES").value = $Services
$rs.fields.item("USERNAME").value = $Username

$rs.update

$rs.Close 


Now i found the code posted by allen:
Link: http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=201729#Post201729
 Code:
 Dim $RegArray, $RegView, $Value,$Product,$Key, $rc, $Array2,$guid
  $RegView=setoption("WOW64AlternateRegView","On")
  $RegArray = SearchReg("HKLM\Software\Microsoft","DigitalProductID",2)
  if @onwow64
    $Array2 = SearchReg("HKLM\Software\WOW6432NODE\Microsoft","DigitalProductID",2)
    $RegArray=ArrayAdd($RegArray,$Array2)
  endif
  If ubound($RegArray)<0
      ? 'No matching items found'
  Else
    For Each $Value In $RegArray
      If $Value
        $Product = ReadValue(Join(Split($value,'<=>DigitalProductId'),''),'ProductName')
        If $product=""
          $guid="{" + split(split($value,"{")[1],"}")[0] + "}"
          if instr($value,"WOW6432Node")
            $product=readvalue("HKLM\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\" + $guid,"DisplayName")
          else
            $product=readvalue("HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\" + $guid,"DisplayName")
          endif
        endif
        If $Product
          $Key = Get_Product_Key(ReadValue(Join(Split($value,'<=>DigitalProductId'),''), 'DigitalProductID'))
            ? $Product + ': ' + $Key 
        EndIf
      EndIf
    Next
  EndIf
  $RegView=setoption("WOW64AlternateRegView",$RegView)

function Get_Product_Key($sproductid)
  Dim $aiKeyChars[24], $ilByte, $i, $iLOffset, $iUOffset, $bProductKey[15], $c, $nCur, $sCDKey
  For Each $c In Split("B C D F G H J K M P Q R T V W X Y 2 3 4 6 7 8 9")
    $aiKeyChars[$i]=Asc($c)
    $i=$i+1
  Next
  if len($sProductID)=2544
    $iLOffset=809
    $iUOffset=823
  else
    $iLOffset=53
    $iUOffset=67
  endif
  For $i = $iLOffset*2-1 To $iUOffset*2-1 Step 2
    $bProductKey[($i-($iLOffset*2-1))/2]=Execute("Exit &"+SubStr($sProductId,$i,2))
  Next
  For $ilByte = 24 To 0 Step -1
    $nCur = 0
    For $i=14 To 0 Step -1
      $nCur = $nCur * 256 ^ $bProductKey[$i] ; NOTE THE XOR! 
      $bProductKey[$i] = Int($nCur / 24)
      $nCur = $nCur Mod 24
    Next
    $sCDKey = Chr($aiKeyChars[$nCur]) + $sCDKey
    If $ilByte Mod 5 = 0 And $ilByte <> 0 $sCDKey = "-" + $sCDKey EndIf
  Next
  $Get_Product_Key=$sCDKey
EndFunction
 

Function SearchReg($Key,$Str,$SrcIn)
  Dim $Idx,$vName,$Value,$num,$SubKey,$fArr,$mbr
  $SearchReg = ''
  $num = 0
  $Idx = 0
  $vName = EnumValue($Key,$Idx)
  Do
    $mbr = ''
    If $SrcIn & 1
    $Value = ReadValue($Key,$vName)
     If InStr($Value,$Str)
       $mbr = $Key + "<=>" + IIf($vName,$vName,'<Default>')
     EndIf
    EndIf
    If ($SrcIn & 2) And InStr($vName,$Str)
      $mbr = $Key + "<=>" + $vName
    EndIf
    If $mbr
      ReDim Preserve $SearchReg[$num]
      $SearchReg[$num] = $mbr
      $num = $num + 1
    EndIf
    $Idx = $Idx + 1
    $vName = EnumValue($Key,$Idx)
  Until @Error
  $Idx = 0
  $SubKey = EnumKey($Key,$Idx)
  While $SubKey
    If ($SrcIn & 4) And InStr($SubKey,$Str)
      ReDim Preserve $SearchReg[$num]
      $SearchReg[$num] = $Key + '\' + $SubKey + "<=><KeyName>"
      $num = $num + 1
    EndIf
    $fArr = SearchReg($Key + "\" + $SubKey,$Str,$SrcIn)
    If @Error = 0
      For Each $mbr In $fArr
        ReDim Preserve $SearchReg[$num]
        $SearchReg[$num] = $mbr
        $num = $num + 1
      Next
    EndIf
    $Idx = $Idx + 1
    $SubKey = EnumKey($Key,$Idx)
  Loop
  Exit VarType($SearchReg) = 8
EndFunction
 

Function ArrayAdd($Array1, $Array2)
 ;Returns a new $Array1 
 Dim $n,$i
 $n = UBound($Array1) + 1
 REDIM PRESERVE $Array1[$n+UBound($Array2)]
 For $i = 0 to UBound($Array2)
   $Array1[$n+$i] = $Array2[$i]
 Next
 $ArrayAdd = $Array1
EndFunction


Got this code above running but only writing the result in txt files:

 Code:
 
break on
cls
dim $result
 
$result=setoption('explicit','on')
$result=setoption('novarsinstrings','on')
$result=setoption('nomacrosinstrings','on')
 
dim $verzeichnis, $datei, $dimm, $computer

$verzeichnis = '\\server\...\MSKeys\'
$datei = @Hostname+"_Keys.txt"
 
if not exist($verzeichnis)
? 'Kann Verzeichnis '+$verzeichnis+' nicht finden'
exit 1
endif
 
$result=RedirectOutput ($verzeichnis+$datei ,1)
if @error
? 'Error '+@error+' - '+@serror
endif

;****MS CD Keys auslesen

Dim $RegArray, $RegView, $Value,$Product,$Key, $rc, $Array2,$guid
  $RegView=setoption("WOW64AlternateRegView","On")
  $RegArray = SearchReg("HKLM\Software\Microsoft","DigitalProductID",2)
  if @onwow64
    $Array2 = SearchReg("HKLM\Software\WOW6432NODE\Microsoft","DigitalProductID",2)
    $RegArray=ArrayAdd($RegArray,$Array2)
  endif
  If ubound($RegArray)<0
      ? 'No matching items found'
  Else
    For Each $Value In $RegArray
      If $Value
        $Product = ReadValue(Join(Split($value,'<=>DigitalProductId'),''),'ProductName')
        If $product=""
          $guid="{" + split(split($value,"{")[1],"}")[0] + "}"
          if instr($value,"WOW6432Node")
            $product=readvalue("HKLM\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\" + $guid,"DisplayName")
          else
            $product=readvalue("HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\" + $guid,"DisplayName")
          endif
        endif
        If $Product
          $Key = Get_Product_Key(ReadValue(Join(Split($value,'<=>DigitalProductId'),''), 'DigitalProductID'))
            ? $Product + ': ' + $Key 
        EndIf
      EndIf
    Next
  EndIf
  $RegView=setoption("WOW64AlternateRegView",$RegView)
   
  function Get_Product_Key($sproductid)
  Dim $aiKeyChars[24], $ilByte, $i, $iLOffset, $iUOffset, $bProductKey[15], $c, $nCur, $sCDKey
  For Each $c In Split("B C D F G H J K M P Q R T V W X Y 2 3 4 6 7 8 9")
    $aiKeyChars[$i]=Asc($c)
    $i=$i+1
  Next
  if len($sProductID)=2544
    $iLOffset=809
    $iUOffset=823
  else
    $iLOffset=53
    $iUOffset=67
  endif
  For $i = $iLOffset*2-1 To $iUOffset*2-1 Step 2
    $bProductKey[($i-($iLOffset*2-1))/2]=Execute("Exit &"+SubStr($sProductId,$i,2))
  Next
  For $ilByte = 24 To 0 Step -1
    $nCur = 0
    For $i=14 To 0 Step -1
      $nCur = $nCur * 256 ^ $bProductKey[$i] ; NOTE THE XOR! 
      $bProductKey[$i] = Int($nCur / 24)
      $nCur = $nCur Mod 24
    Next
    $sCDKey = Chr($aiKeyChars[$nCur]) + $sCDKey
    If $ilByte Mod 5 = 0 And $ilByte <> 0 $sCDKey = "-" + $sCDKey EndIf
  Next
  $Get_Product_Key=$sCDKey
  EndFunction

Function SearchReg($Key,$Str,$SrcIn)
  Dim $Idx,$vName,$Value,$num,$SubKey,$fArr,$mbr
  $SearchReg = ''
  $num = 0
  $Idx = 0
  $vName = EnumValue($Key,$Idx)
  Do
    $mbr = ''
    If $SrcIn & 1
    $Value = ReadValue($Key,$vName)
     If InStr($Value,$Str)
       $mbr = $Key + "<=>" + IIf($vName,$vName,'<Default>')
     EndIf
    EndIf
    If ($SrcIn & 2) And InStr($vName,$Str)
      $mbr = $Key + "<=>" + $vName
    EndIf
    If $mbr
      ReDim Preserve $SearchReg[$num]
      $SearchReg[$num] = $mbr
      $num = $num + 1
    EndIf
    $Idx = $Idx + 1
    $vName = EnumValue($Key,$Idx)
  Until @Error
  $Idx = 0
  $SubKey = EnumKey($Key,$Idx)
  While $SubKey
    If ($SrcIn & 4) And InStr($SubKey,$Str)
      ReDim Preserve $SearchReg[$num]
      $SearchReg[$num] = $Key + '\' + $SubKey + "<=><KeyName>"
      $num = $num + 1
    EndIf
    $fArr = SearchReg($Key + "\" + $SubKey,$Str,$SrcIn)
    If @Error = 0
      For Each $mbr In $fArr
        ReDim Preserve $SearchReg[$num]
        $SearchReg[$num] = $mbr
        $num = $num + 1
      Next
    EndIf
    $Idx = $Idx + 1
    $SubKey = EnumKey($Key,$Idx)
  Loop
  Exit VarType($SearchReg) = 8
EndFunction
 
Function ArrayAdd($Array1, $Array2)
 ;Returns a new $Array1 
 Dim $n,$i
 $n = UBound($Array1) + 1
 REDIM PRESERVE $Array1[$n+UBound($Array2)]
 For $i = 0 to UBound($Array2)
   $Array1[$n+$i] = $Array2[$i]
 Next
 $ArrayAdd = $Array1
 EndFunction

 ;****MS CD Keys auslesen ENDE


Now i need help to get this results in my mdb database in seperate rows and not in txt files. And thats my problem. I can´t get to this point because i´m fresh in scripting.

can you help me?

Best wishes
Backfight