#129533 - 2004-12-27 01:15 PM
Re: Asset Inventory to Access Database
|
basad
Fresh Scripter
Registered: 2004-12-18
Posts: 11
|
I'm trying to run this script on my machine and it fails to update my Access 2000 database.
I can see that the script has gets a hold of the mdb file and starts to create the ldf file but finally machine information is not recorded even though it is successfully queried. Any help?
John
|
Top
|
|
|
|
#129535 - 2004-12-28 05:25 AM
Re: Asset Inventory to Access Database
|
basad
Fresh Scripter
Registered: 2004-12-18
Posts: 11
|
Thanks doc, I have solved the problem. I don't know why but by changing providers .
This:$CNstring = "provider=microsoft.jet.oledb.4.0;data source=$DBpath;persist security info=false"
To this: $CNstring="Driver={Microsoft Access Driver (*.mdb)}; DBQ=$DBpath"
Regards,
|
Top
|
|
|
|
#129536 - 2005-01-03 01:33 PM
Re: Asset Inventory to Access Database
|
willem05
Lurker
Registered: 2001-03-07
Posts: 4
Loc: Haaksbergen
|
Hi,
I was just reading the code etc. . Thought it was great. I did a simple copy/paste and used it. Now I noticed that several fields in the database are not updated. Fields like DISKNAME, APPLICATIONS, INSTALLDATE etc. There are more fields NOT updated than that are... Is it my OS ?
I use kix4.22.0.0 and my laptop has XPSP2. I used the SQL-version on a SQL2000 server. Created 1 table called COMPUTERS...
Thanx for helping..
Gr,
Willem
Hi,
Little update... Make sure the fields in your Table are big eneough
That is surely a showstopper. Nothing said here....
Edited by willem05 (2005-01-03 01:51 PM)
|
Top
|
|
|
|
#207958 - 2013-10-30 12:40 PM
Re: Asset Inventory to Access Database
[Re: willem05]
|
backfight
Getting the hang of it
Registered: 2007-01-22
Posts: 61
Loc: Germany
|
Hey there,
when i run the script (writing in the mdb file) i get in some cases the value "0" for Memory. How can i fix that? Not all PC´s returns "0", but some.
Greets Backfight
|
Top
|
|
|
|
#207959 - 2013-10-30 01:31 PM
Re: Asset Inventory to Access Database
[Re: backfight]
|
Glenn Barnas
KiX Supporter
Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
|
Try this:$SysMemory = val(WMIQuery("TotalPhysicalMemory","Win32_LogicalMemoryConfiguration"))/1024
If $SysMemory = 0
$SysMemory = Memory()
EndIf Be sure to download and insert the Memory UDF. The one I wrote a few years ago was discussed quite a bit and found to be the most consistent and accurate in its reporting. I haven't used it in a while, but just tested it on Windows 8 and Server 2012 before responding to your post and it reported accurate values. Download the latest version from the Kixtart UDF Library on my web site.
Note that this UDF returns System RAM, not Installed RAM Modules (the amount of RAM available to the system, not including shared Video or BIOS Cache). In my Server 2012 test, there is 4G RAM physically installed - 4x1G modules. The RAM reported was 4032, which is 64MB shy of the full amount. This is the memory "hole" for the BIOS. On my workstation, with 4G RAM, it reports 3327MB, the result of my video card sharing a 768MB block of RAM. If you are looking for total Installed RAM, you can fudge the result a bit with the following code. This assumes that you know the smallest RAM module installed in the hardware you are interrogating. For example, if you've determined that the smallest RAM module is 512MB for the majority of your systems, then set $MSize to 512. The result will be pretty accurate, but could be up to 512MB short, particularly with systems using shared video RAM. $MSize = 512 ; Smallest RAM module in service
$M = Memory() ; get available RAM in MBytes
$Ma = $M / $MSize ; Divide by smallest module size
If $M Mod $MSize $Ma = $Ma + 1 EndIf ; If a fractional module is detected, add another full module
$Ma = $Ma * $MSize ; calc installed RAM by multiplying modules * ModuleSize
' Reported: ' $M ?
' Adjusted: ' $Ma ?
'Difference: ' 4096 - $Ma ?
With the code above (knowing that all of my systems have either 1 or 4G modules), both computers properly report 4096MB installed.
Glenn
_________________________
Actually I am a Rocket Scientist!
|
Top
|
|
|
|
#207970 - 2013-10-31 11:27 AM
Re: Asset Inventory to Access Database
[Re: Glenn Barnas]
|
backfight
Getting the hang of it
Registered: 2007-01-22
Posts: 61
Loc: Germany
|
Hi Glenn, i have updated my script with your Memory UDF and your Code below. Now the entry in the mdb says that my pc has 3035MB Ram. The truth is that my pc has 2x4 GB Ram
How to read the dimms? and add. them?
Greetz Backfight
Edited by backfight (2013-10-31 12:06 PM)
|
Top
|
|
|
|
#207994 - 2013-11-04 10:05 AM
Re: Asset Inventory to Access Database
[Re: Glenn Barnas]
|
backfight
Getting the hang of it
Registered: 2007-01-22
Posts: 61
Loc: Germany
|
Hi there, it works!!! Thanks a lot!
May you have an idea to get the correct CPU Names? In my mdb the description is like this: "x64 Family 6 Model 23 Stepping 10"
Greetz Backfight
|
Top
|
|
|
|
#208007 - 2013-11-06 08:48 AM
Re: Asset Inventory to Access Database
[Re: Mart]
|
backfight
Getting the hang of it
Registered: 2007-01-22
Posts: 61
Loc: Germany
|
Hi, thanks for your reply. Can you help me to intigrate the code?
Now i use this code:
$CPUDescription = WMIQuery("description","Win32_Processor")
Do i have to "Dim" $wmiColl, $wmiObj and $wmiObj.Name?
Sorry i´m new in scripting.
Greetz Backfight
EDIT:
Think this is the right intigration:
$wmiColl = GetObject("WinMgmts:root/cimv2").ExecQuery("Select * FROM Win32_Processor ")
For Each $wmiObj in $wmiColl
$CPUDescription = $wmiObj.Name
Next
Sleep 5
Works for me :-)
Edited by backfight (2013-11-06 09:09 AM)
|
Top
|
|
|
|
#208008 - 2013-11-06 09:57 AM
Re: Asset Inventory to Access Database
[Re: backfight]
|
backfight
Getting the hang of it
Registered: 2007-01-22
Posts: 61
Loc: Germany
|
Hi again,
the only thing i missed in the script is to list the connectet monitors.
i´ve found a script but it´s hard to intigrate it.
; Return monitor info.
Break ON
$=SetOption("Explicit","ON")
$=SetOption("WrapAtEOL","ON")
$=SetOption("ASCII","ON")
GLOBAL $VERBOSE
$VERBOSE=1 ; Set to "0" to disable debug info
Dim $KEY_DISPLAY
Dim $iIndexPri,$iIndexSub
Dim $sMonitor,$sDevice
$KEY_DISPLAY="HKLM\SYSTEM\CurrentControlSet\Enum\Display"
; Iterate through possible displays.
Log("Starting scan for monitor info...")
$iIndexPri=0
$sMonitor=EnumKey($KEY_DISPLAY,$iIndexPri)
While Not @ERROR
$sMonitor=$KEY_DISPLAY+"\"+$sMonitor
Log("--------------------------------------------")
Log("Primary key is '"+$sMonitor+"'")
$iIndexSub=0
$sDevice=EnumKey($sMonitor,$iIndexSub)
while Not @ERROR
$sDevice=$sMonitor+"\"+$sDevice
Log(" Secondary key is '"+$sDevice+"'")
If KeyExist($sDevice+"\Control")
Log(" Control found - device assumed to be active")
If Instr(ReadValue($sDevice,"HardwareID"),"Monitor\")=1
Log(" Device type is monitor.")
ParseEDID(ReadValue($sDevice+"\Device Parameters","EDID"))
Else
Log(" Device type is not monitor.")
EndIf
Else
Log(" Control not found - device assumed to be inactive")
EndIf
$iIndexSub=$iIndexSub+1
$sDevice=EnumKey($sMonitor,$iIndexSub)
Loop
$iIndexPri=$iIndexPri+1
$sMonitor=EnumKey($KEY_DISPLAY,$iIndexPri)
Loop
Log("Completed scan for monitor info.")
Exit 0
Function ParseEDID($sEDID)
Dim $iOffset, $sBlock
If $sEDID=""
Log(" No EDID information associated with device")
Exit 0
EndIf
; Check for valid EDID data
If SubStr($sEDID,1,16)="00ffffffffffff00"
Log(" EDID signature is valid")
Else
Log(" EDID signature is invalid: "+SubStr($sEDID,1,16))
Exit 0
EndIf
Log(" "+$sEDID)
Log(" EDID Version number is "
+Execute("Exit &"+SubStr($sEDID,(&12+1)*2-1,2))
+"."
+Execute("Exit &"+SubStr($sEDID,(&13+1)*2-1,2)))
; Look for serial number and model number in descriptor blocks.
For $iOffset=54 To 108 Step 18
$sBlock=SubStr($sEDID,$iOffset*2+1,18*2)
Select
Case Left($sBlock,8)="000000fc"
" Model: "
Bin2Str(SubStr($sBlock,9)) ?
Case Left($sBlock,8)="000000fe"
" Other info: "
Bin2Str(SubStr($sBlock,9)) ?
Case Left($sBlock,8)="000000ff"
"EDID 1.3 Serial number: "
Bin2Str(SubStr($sBlock,9)) ?
Case "Unknown type"
Log(" Unknown type: "+Left($sBlock,8))
EndSelect
Next
"EDID 1.2 Serial number: "+Execute("Exit &"+SubStr($sEDID,(&1C+1)*2-1,8))+@CRLF
" Week of manufacture: "+Execute("Exit &"+SubStr($sEDID,(&10+1)*2-1,2))+@CRLF
" Year of manufacture: "+(1990+Execute("Exit &"+SubStr($sEDID,(&11+1)*2-1,2)))+@CRLF
EndFunction
Function Bin2Str($s)
Dim $c
While $s
$c=Execute("Exit &"+Left($s,2))
; Truncate string at CR
If $c=10 Exit 0 EndIf
iF $c $Bin2Str=$Bin2Str+Chr($c) EndIf
$s=SubStr($s,3)
Loop
Exit 0
EndFunction
Function Log($s)
If $VERBOSE @DATE+" "+@TIME+" "+$s+@CRLF EndIf
Exit 0
EndFunction
the lgofile looks like this:
2013/01/10 12:29:52 Starting scan for monitor info...
2013/01/10 12:29:52 --------------------------------------------
2013/01/10 12:29:52 Primary key is 'HKLM\SYSTEM\CurrentControlSet\Enum\Display\ACR0027'
2013/01/10 12:29:52 Secondary key is 'HKLM\SYSTEM\CurrentControlSet\Enum\Display\ACR0027\4&6cb7ad2&0&UID16843008'
2013/01/10 12:29:52 Control not found - device assumed to be inactive
2013/01/10 12:29:52 Secondary key is 'HKLM\SYSTEM\CurrentControlSet\Enum\Display\ACR0027\4&6cb7ad2&0&UID50529024'
2013/01/10 12:29:52 Control not found - device assumed to be inactive
2013/01/10 12:29:52 --------------------------------------------
2013/01/10 12:29:52 Primary key is 'HKLM\SYSTEM\CurrentControlSet\Enum\Display\Default_Monitor'
2013/01/10 12:29:52 Secondary key is 'HKLM\SYSTEM\CurrentControlSet\Enum\Display\Default_Monitor\4&6cb7ad2&0&12345678&00&02'
2013/01/10 12:29:52 Control not found - device assumed to be inactive
2013/01/10 12:29:52 Secondary key is 'HKLM\SYSTEM\CurrentControlSet\Enum\Display\Default_Monitor\4&6cb7ad2&0&UID16843008'
2013/01/10 12:29:52 Control not found - device assumed to be inactive
2013/01/10 12:29:52 --------------------------------------------
2013/01/10 12:29:52 Primary key is 'HKLM\SYSTEM\CurrentControlSet\Enum\Display\SAM0831'
2013/01/10 12:29:52 Secondary key is 'HKLM\SYSTEM\CurrentControlSet\Enum\Display\SAM0831\4&6cb7ad2&0&UID16843008'
2013/01/10 12:29:52 Control found - device assumed to be active
2013/01/10 12:29:52 Device type is monitor.
2013/01/10 12:29:52 EDID signature is valid
2013/01/10 12:29:52 00ffffffffffff004c2d3108343332302f1601030e301b782a90c1a259559c270e5054bfef80714f8100814081809500950fa940b300023a801871382d40582c4500dd0c1100001e000000fd00384b1e5111000a202020202020000000fc00534d533232413230302f343630000000ff0048344d434230343437320a2020000f
2013/01/10 12:29:52 EDID Version number is 1.3
2013/01/10 12:29:52 Unknown type: 023a8018
2013/01/10 12:29:52 Unknown type: 000000fd
Model: SMS22A200/460
EDID 1.3 Serial number: H4MCB04472
EDID 1.2 Serial number: 1498782759
Week of manufacture: 47
Year of manufacture: 2012
2013/01/10 12:29:52 --------------------------------------------
2013/01/10 12:29:52 Primary key is 'HKLM\SYSTEM\CurrentControlSet\Enum\Display\SAM0832'
2013/01/10 12:29:52 Secondary key is 'HKLM\SYSTEM\CurrentControlSet\Enum\Display\SAM0832\4&6cb7ad2&0&UID50529024'
2013/01/10 12:29:52 Control found - device assumed to be active
2013/01/10 12:29:52 Device type is monitor.
2013/01/10 12:29:52 EDID signature is valid
2013/01/10 12:29:52 00ffffffffffff004c2d3208343332302f16010380301b782a92c1a259559e270e5054bfef80714f8100814081809500b300a940950f023a801871382d40582c4500dd0c1100001e000000fd00384b1e5111000a202020202020000000fc00534d533232413230302f343630000000ff0048344d434230343435370a20200194
2013/01/10 12:29:52 EDID Version number is 1.3
2013/01/10 12:29:52 Unknown type: 023a8018
2013/01/10 12:29:52 Unknown type: 000000fd
Model: SMS22A200/460
EDID 1.3 Serial number: H4MCB04457
EDID 1.2 Serial number: 1498783271
Week of manufacture: 47
Year of manufacture: 2012
2013/01/10 12:29:52 Completed scan for monitor info.
but i only need "model", "SN" and "manufactur"
can anybody help me?
Backfight
|
Top
|
|
|
|
#208018 - 2013-11-07 05:57 PM
Re: Asset Inventory to Access Database
[Re: backfight]
|
ShaneEP
MM club member
Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
|
You can try the Win32_DesktopMonitor query. Not sure if it will get all the info you are after.
$wmiColl = GetObject("WinMgmts:root/cimv2").ExecQuery("Select * FROM Win32_DesktopMonitor")
For Each $wmiObj in $wmiColl
$MonitorDescription = $wmiObj.Name
Next
|
Top
|
|
|
|
#208020 - 2013-11-08 09:13 AM
Re: Asset Inventory to Access Database
[Re: ShaneEP]
|
backfight
Getting the hang of it
Registered: 2007-01-22
Posts: 61
Loc: Germany
|
Hey,
sorry but i only get "Standard" results. Like "Standard PNP Monitor"
Can you help me to intigrate my code and select only manufactor type and sn?
backfight
|
Top
|
|
|
|
#208025 - 2013-11-08 09:36 AM
Re: Asset Inventory to Access Database
[Re: NTDOC]
|
backfight
Getting the hang of it
Registered: 2007-01-22
Posts: 61
Loc: Germany
|
Hi NTDOC, the code i posted before is nearly perfekt. But i have problems to filter only that information i need and intigrate it.
backfight
Edited by backfight (2013-11-08 09:37 AM)
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 369 anonymous users online.
|
|
|