Solved

Loggin User- and Computerinformation to database

Posted on 2007-11-15
20
502 Views
Last Modified: 2013-11-25
Does any of you guys out there have an idea on how to collect the following information and store it in a database (*.mdb prefered)?

The info I need to store is:
ComputerName
UserName
OSType, BuildVersion, ServicePack,
SerialNumber
Hardware, Make, Model
Memory, Processor, ProcessorSpeed

It is supposed to be used in a domain. My idea is to use it in a logon-script, but other suggestions are welcome.

Links and scripts are more than welcome.

Regards
Kasper K
0
Comment
Question by:Kasper Katzmann
  • 7
  • 5
  • 4
  • +2
20 Comments
 
LVL 6

Expert Comment

by:LectricX
ID: 20288894
You can do some of what you are after using a PIPE from the command line to a text file.

How to move that to a database, I'm not so sure about.. but this should get you started:

>  This part of the script creates a file with the title of the PC name and notes who last logged onto that pc
echo Running WhoIsOn Script...
SET pc=%computername%
SET un=%username%
Echo %un% is using %pc% (LoginTime: %date% - %time%) > \\networkdrive\PC-User\%pc%.txt
echo Complete!

>  This part of the script creates a file with the title of the username and notes which PC was last logged onto by that user
echo Running WhoIsOn2 Script...
SET pc=%computername%
SET un=%username%
Echo %un% is using %pc% (LoginTime: %date% - %time%) > \\networkdrive\User-PC\%un%.txt
echo Complete!

>  This part of the script creates a file with the title of the PC name and notes a bunch of system information about that pc.

echo Updating I-Comm Network Asset DB...Please Wait.
@ping 127.0.0.1 -n 5 > NUL
systeminfo > \\networkdrive\Asset-%ComputerName%.txt
echo Complete!
0
 
LVL 11

Expert Comment

by:bsharath
ID: 20288911
Hi,

I would be happy if someone has or creates such script...
I wanted to share with what i have...

Save this script in "Filename.vbs"
Create a txt file "Computers.txt"
Put in all computer names inside it.Export the computernames from the ADS OU.

Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objFile: Set objFile = objFSO.OpenTextFile("C:\Computers.txt")
Dim objOutput: Set objOutput = objFSO.CreateTextFile("C:\PCInfo.txt")
Dim objWMI
Do While Not objFile.AtEndOfStream
  intHDD1 = 0
  intHDD2 = 0
  strPC = objFile.ReadLine
  On Error Resume Next
  Set objWMI = GetObject("winmgmts:\\" & strPC & "\root\CIMV2")
  If Err.Number = 0 Then
    Set colItems = objWMI.ExecQuery("Select * From Win32_Processor")
    For Each objItem In colItems
      strProcessor = Replace(Replace(objItem.Name, "Intel", ""), "(R)", "") & "/"
    Next
    Set colItems = objWMI.ExecQuery("Select * From Win32_OperatingSystem")
    For Each objItem In colItems
      strRAM = FormatNumber(objItem.TotalVisibleMemorySize / 1024 / 1024, 2) & "GB Ram/"
    Next
   
    Set colItems = objWMI.ExecQuery("Select * From Win32_LogicalDisk")
      For Each objItem In colItems
        If Not IsNull(objItem.Size) Then
            isize = objItem.Size / 1024 / 1024 / 1024
            If UCase(objItem.DeviceID) = "C:" Or UCase(objItem.DeviceID) = "D:" Then
                intHDD1 = FormatNumber(intHDD1 + isize, 2)
            ElseIf UCase(objItem.DeviceID) = "E:" Or UCase(objItem.DeviceID) = "F:" Then
                intHDD2 = FormatNumber(intHDD2 + isize, 2)
            End If
        End If
      Next
    intHDD1 = intHDD1 & "GB/"
    intHDD2 = intHDD2 & "GB"

    Set colItems = objWMI.ExecQuery("Select * from Win32_FloppyDrive")
    If colItems.Count = 0 Then
      strFloppy = ""
    Else
      strFloppy = "/FDD/"
    End If
    Set colItems = objWMI.ExecQuery("Select * from Win32_CDROMDrive")
    If colItems.Count = 0 Then
      strCD = ""
    Else
      strCD = "/CDD/"
    End If
    Set colItems = objWMI.ExecQuery("Select * From Win32_NetworkAdapter")
    If colItems.Count > 0 Then
      strNIC = "/LAN"
    End If
    objOutput.WriteLine Replace(strPC & vbTab & strProcessor & strRAM & intHDD1 & intHDD2 & strFloppy & strCD & strNIC, "//", "/")
  Else
    objOutput.WriteLine strPC & " could not be contacted."
    On Error GoTo 0
  End If
  Set objWMI = Nothing
Loop

objFile.Close
objOutput.Close
Set objFile = Nothing
Set objOutput = Nothing
Set objWMI = Nothing
Set objFSO = Nothing

This gets the machines configuration..

Hope this helps...
0
 
LVL 11

Expert Comment

by:bsharath
ID: 20288933
See this like solution by Farhan
http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Q_22757221.html
Find all users logged in all computers in a file
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 3

Expert Comment

by:Aurora27
ID: 20295046
You should be able to use WMI objects to get system info? Check it out.

CT.
0
 
LVL 3

Expert Comment

by:Aurora27
ID: 20295092
Use this:

using System.Management.Instrumentation;


ManagementObjectSearcher searcher =
  new ManagementObjectSearcher("Select Name from Win32_CDROMDrive");


for more options, refer:
http://msdn2.microsoft.com/en-us/library/Aa394554.aspx

0
 
LVL 3

Expert Comment

by:Aurora27
ID: 20295100
Am sorry thot - it was in C# section..but u shud be able to use WMI in VB too..AFAIK.

CT.
0
 

Author Comment

by:Kasper Katzmann
ID: 20296913
I can't seem to get it to work :-( And just to confuse me further I've found the following code. It could vere well be exactly what I'm looking for, but... It is set up to work on a SQL database, but I don't have a SQL server. Is there a work-around? Maybe to make it work on an Access database?
'file 1
'**************************************************************
'*           Asset Checking                                   *
'*                                                            *
'*        Created By:                           *
'*        Create Date: 5/14/2004                              *
'*                                                            *
'*                                                            *
'**************************************************************
 
 
'**************************************************************
'*           Variable and Constant Declaration                *
'**************************************************************
 
Dim strVersion, oFS, SPVersion, IESPVersion
Dim BuildVersion, strSoftwareName, strSoftwarePath
Dim WshNetwork, WshShell, oFolder
Dim sLogFilePath
Dim sComputerName, sUserName, sRunLogs
Dim sRunLogPath, sRunLogFile, oFile, sLogonServer
Dim SOFTWARE_TEXT_FILE
Dim objFSR, objFSW, objReadF, objWriteF, strRecord
Dim objConnection, objRS
 
Const adOpenStatic = 3
Const adLockReadOnly = 1
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Const ODBC_CONN_STRING = "Provider=SQLOLEDB;Data Source=prctsqla;Initial Catalog=WKSInfo;Integrated Security=SSPI;"
Const REG_KEY =  "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\"
Const REG_KEY_VALUE = "CSDVersion"
Const IEREG_KEY = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\"
Const IEREG_KEY_VALUE = "MINORVERSION"
 
 
'**************************************************************
'*             Main Processing Section                        *
'**************************************************************
 
On Error Resume Next
 
'**************************************************************
'*               Initialize Script Variables                  *
'**************************************************************
InitializeVariables()
 
'**************************************************************
'*          Call routine to see if software path exists       *
'**************************************************************
UpdateDatabase
 
'**************************************************************
'*               Initialize Script Variables                  *
'**************************************************************
Sub InitializeVariables()
 
      On Error Resume Next
      
        Set oFS = CreateObject("Scripting.FileSystemObject")
      Set WshNetwork = WScript.CreateObject("Wscript.Network")
      Set WSHShell   = WScript.CreateObject("WScript.Shell")
 
      sComputerName = WshNetwork.ComputerName
If UCASE(Mid(sComputerName,1,4)) = "GULF" Then
 
      sUserName     = WshNetwork.Username
      sLogonServer  = WshShell.ExpandEnvironmentStrings("%LOGONSERVER%")
      
      sRunLogPath = "C:\Temp"
      
      If oFS.FolderExists(sRunLogPath) = False Then
          Set oFolder = oFS.CreateFolder(sRunLogPath)
        End If
 
      sLogFilePath = sRunLogPath & "\LogoffChecking.log"
      Set oFile = oFS.OpenTextFile(sLogFilePath, ForReading, True)
 
 
      '**************************************************************
      '*            Read the BuildVersion                           *
      '**************************************************************
 
      SPVersion = WSHShell.RegRead(REG_KEY & REG_KEY_VALUE)
      IESPVersion = WSHShell.RegRead(IEREG_KEY & IEREG_KEY_VALUE)
Else
      wscript.quit
End If
End Sub
 
 
      '**************************************************************
      '*            Read the Computers hardware                     *
      '**************************************************************
Function UpdateDatabase
 
   On Error Resume Next
 
Dim strSerialNumber, strUsername, strFullName,strDomain
Dim strBuildVersion, strMake, strModel, strMemory, strProcessor
Dim strOStype, strProcessorSP, strDisk, sMsg1, sMsg2, strInstallDate
 
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
 
Set colBIOS = objWMIService.ExecQuery _
("Select * from Win32_BIOS")
For Each objBIOS in colBIOS
strSerialNumber = objBIOS.SerialNumber
Next
 
strHardWare = WshShell.ExpandEnvironmentStrings("%WKSTYPE%")
If strHardWare = "%WKSTYPE%" Then
      strHardWare = ""
End If
 
Set objNetwork = WScript.CreateObject("WScript.Network")
strUsername = objNetwork.UserName
 
Set oSysInfo = CreateObject("ADSystemInfo")
sUserAdsPath = oSysInfo.UserName
Set oUser = GetObject("LDAP://" & sUserAdsPath)
strFullName = oUser.cn
strDomain = oSysInfo.DomainShortName
 
Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colSettings 
strComputerName = objComputer.Name
strMake = objComputer.Manufacturer
strModel = objComputer.Model
strMemory = objComputer.TotalPhysicalMemory / 1024000
Next
 
Set colSettings = objWMIService.ExecQuery _
    ("Select * from Win32_Processor")
For Each objProcessor in colSettings 
strProcessor = LTrim(objProcessor.Name)
strProcessorSP = LTrim(objProcessor.currentclockSpeed)
Next
 
Set colSettings = objWMIService.ExecQuery _
    ("Select * from Win32_DiskDrive")
For Each objDisk in colSettings 
strDisk = LTrim(objDisk.Size) / 1024000
Next
 
Set colOperatingSystems = objWMIService.ExecQuery _
    ("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
strOStype = objOperatingSystem.Caption
 
strBuildVersion = objOperatingSystem.Organization
Dim dtmInstallDate, dtmConvertedDate
Set dtmConvertedDate = CreateObject("WbemScripting.SWbemDateTime")
 
dtmConvertedDate.Value = objOperatingSystem.InstallDate
    dtmInstallDate = dtmConvertedDate.GetVarDate
Next
 
Set colInstalledPatches =  objWMIService.ExecQuery _
    ("Select * from Win32_QuickFixEngineering")
For Each objQuickFix in colInstalledPatches
   If sMsg2 = "File 1" Then
      sMsg2 =""
   End If
   If sMsg2 ="" Then
      sMsg2 = objQuickFix.HotFixID
   Else
    sMsg2 = sMsg2 & "; " & objQuickFix.HotFixID
   End If
Next
 
Set colInstalledPrinters =  objWMIService.ExecQuery _
    ("Select * from Win32_Printer")
For Each objPrinter in colInstalledPrinters
      If sMsg1 = "" Then
            sMsg1 = objPrinter.Name
      Else
          sMsg1 = sMsg1 & "; " & objPrinter.Name
      End If
Next
 
    UpdateDatabase = False
    
      Set objConnection = CreateObject("ADODB.Connection")
      set objRS         = CreateObject("ADODB.Recordset")
      objConnection.Open ODBC_CONN_STRING
 
 
      'strSQL = "Select * from WKSInfo where ComputerName = " & "'" & UCase(sComputerName) & "' OR SerialNumber = " & "'" & strSerialNumber & "'"
      strSQL = "Select * from WKSInfo where SerialNumber = " & "'" & strSerialNumber & "'"
 
      objRS.open strSQL, objConnection, adOpenStatic, adLockReadOnly
 
      If objRS.RecordCount = 0 Then
        'Insert a new row
         strSQL = "Insert INTO WKSInfo (ComputerName, UserName, FullName, OSType, BuildVersion, ServicePack, SerialNumber, Hardware, Make, Model, Memory, Processor, ProcessorSpeed, Printers, HotFixs, IEPatches, InstallDate, DateTime) " & _
                  "VALUES ( " & "'" & UCase(sComputerName) & "','" & _
                              UCase(sUserName) & "','" & _
                              strFullName & "','" & _
                              strOStype & "','" & _
                              strBuildVersion & "','" & _
                              SPVersion & "','" & _
                              strSerialNumber & "','" & _
                              strHardware  & "','" & _
                              strMake & "','" & _
                              strModel & "','" & _
                              strMemory & "','" & _
                              strProcessor & "','" & _
                              strProcessorSP & "','" & _
                              sMsg1 & "','" & _
                              sMsg2 & "','" & _
                              IESPVersion & "','" & _
                              dtmInstallDate & "','" & _
                              Now & "'" & ")"
        'msgbox strsql
         objConnection.Execute strSQL
         If Err.Number = 0 Then
            UpdateDatabase = True
         Else 
            sMsg = Err.Number & " " & Err.Description
            Err.Clear
            Call WriteLog(sLogFilePath, sComputerName, sUserName, BuildVersion, sMsg)
         End If
      Else
         'Do an update..
         strSQL = "UPDATE WKSInfo SET " & "ComputerName = '"     & UCase(sComputerName)     & "'," & _
                                     "UserName = '"        & UCase(sUserName) & "'," & _
                                     "FullName = '"        & strFullName & "'," & _
                                     "OSType = '"          & strOStype & "'," & _
                                     "BuildVersion = '"    & strBuildVersion     & "'," & _
                                     "ServicePack = '"    & SPVersion      & "'," & _
                                     "SerialNumber = '"    & strSerialNumber      & "'," & _
                                     "HardWare = '"        & strHardware  & "'," & _
                                     "Make = '"    & strMake      & "'," & _
                                     "Model = '"    & strModel      & "'," & _
                                     "Memory = '"    & strMemory      & "'," & _
                                     "Processor = '"    & strProcessor      & "'," & _
                                     "ProcessorSpeed = '" & strProcessorSP & "'," & _
                                     "Printers = '" & sMsg1 & "'," & _
                                     "HotFixs = '" & sMsg2 & "'," & _
                                     "IEPatches = '" & IESPVersion & "'," & _
                                      "InstallDate = '" & dtmInstallDate & "'," & _
                                     "DateTime = '"        & Now              & "' " & _
                                 "WHERE SerialNumber = '"    & strSerialNumber & "' "
                                    
        objConnection.Execute strSQL
        If Err.Number = 0 Then
           UpdateDatabase = True
        Else
            sMsg = Err.Number & " " & Err.Description
            Err.Clear
            Call WriteLog(sLogFilePath, sComputerName, sUserName, BuildVersion, sMsg)
        End If
      End If
'msgbox updatedatabase
End Function
'**************************************************************
'*  Log File Routine                                          *
'**************************************************************
Sub WriteLog(filepath, computer, user, bldversion, swname, sMsg)
      Dim oFSO, oFile
      Set oFSO = CreateObject("Scripting.FileSystemObject")
        Set oFile = oFSO.OpenTextFile(filepath, ForAppending)
      oFile.WriteLine(Now & "," & computer & "," & user & "," & bldversion & "," & swname & "," & sMsg)
      oFile.Close
End Sub

Open in new window

0
 
LVL 12

Accepted Solution

by:
chandru_sol earned 500 total points
ID: 20303724
Try this script..............

Make sure you create the MDB file before you run this script.........

If you want the file, let me know i will upload the same

regards
Chandru

Dim strComputerName     ' The Computer Name to be queried via WMI
Dim strWinMgt        ' The WMI management String
Dim objCon        ' A Connection Object for database connectivity
Dim objRS        ' A Recordset Object for database connectivity
Dim sProviderName    ' The OLE Provider Type
Dim iCursorType        ' The Cursor Type for the Recordset
Dim iLockType        ' The Lock Type for the Recordset
Dim sDataSource        ' The name and location of the database
Dim intRam        ' The amount of RAM in the computer.  
Dim CompSysSet        
Dim CompSys
 
strComputerName = "."
strWinMgt = "winmgmts://" & strComputerName &""
 
'********** Beginning of Main Code **********
  Set CompSysSet = GetObject(strWinMgt).ExecQuery("select * from Win32_ComputerSystem")
  For Each CompSys In CompSysSet
         strName = CompSys.Name
Next
 
      Call subConnectionOpen
 strCriteria = "ComputerName = '"& strName &"'"
 objRS.Find strCriteria
If objRS.EOF Then
      Call subGetComputerInfo
Else
      Call subDeleteRecord
      Call SubGetComputerInfo
End If 
      Call subConnectionClose
 
'********** End of Main Code **********
 
'********** Beginning of Sub routine to Open database **********
Sub subConnectionOpen
  Set objCon = CreateObject("ADODB.Connection")
  Set objRS = CreateObject("ADODB.Recordset")
  sProviderName                        = "Microsoft.Jet.OLEDB.4.0"
  iCursorType                            = 1
  iLockType                            = 3
  sDataSource                            = "c:\backup\pcinfo.mdb"
  objCon.Provider = sProviderName
  objCon.Properties("Data Source")     = sDataSource
  objCon.Open
  objRS.CursorType = iCursorType
  objRS.LockType = iLockType
  objRS.Source = "Computerinfo"
  objRS.ActiveConnection = objCon
  objRS.Open 
End Sub
'********** End of sub routine to Open database **********
 
'********** Beginning of Sub routine to Close database **********
 
Sub subConnectionClose
  Set objRS = Nothing
  Set objCon = Nothing
End Sub
 
'********** End of Sub routine to Close database **********
 
'********** Beginning of Sub routine to delete record **********
Sub subDeleteRecord
 
  objRS.Delete
  objRS.Update
End Sub
'********** End of Sub routine to delete record **********
 
'********** Beginning of Sub routine to get & write computer info **********
Sub subGetComputerInfo
 
' Get Model, Manufacturer, Computername and Memory  
  Set CompSysSet = GetObject(strWinMgt).ExecQuery("select * from Win32_ComputerSystem")
  For Each CompSys In CompSysSet
          strModel     = CompSys.Model
          ComputerName = CompSys.Name
          strVendor    = CompSys.Manufacturer
          intRAM       = Clng(CompSys.TotalPhysicalMemory/1048576 )
  Next
 
' Get BIOS info       
  Set CompSysSet = GetObject(strWinMgt).ExecQuery("select * from Win32_BIOS")
  For Each CompSys In CompSysSet
          strSerial = CompSys.SerialNumber
          strVersion = CompSys.Version
  Next
  
' Get CPU info
  Set CompSysSet = GetObject(strWinMgt).ExecQuery("select * from Win32_Processor")
  For Each CompSys In CompSysSet
          strCPU = CompSys.Name
'           StrSpeed = CompSys.CurrentClockSpeed
          StrSpeed = CompSys.MaxClockSpeed
  Next
  
' Get Monitor Info   
  Set CompSysSet = GetObject(strWinMgt).ExecQuery("select * from Win32_DesktopMonitor")
  For Each CompSys In CompSysSet
          strMonManufacturer = CompSys.MonitorManufacturer
          strMonModel = CompSys.Description
  Next
  
' Get Video Card Info
  
  Set CompSysSet = GetObject(strWinMgt).ExecQuery("select * from Win32_VideoController")
  For Each CompSys In CompSysSet
          strVidRAM = CompSys.AdapterRAM/1024 
          strVidCard = CompSys.Description
          strVidMode = CompSys.VideoModeDescription
  Next
  
' Get OS Info 
  Set CompSysSet = GetObject(strWinMgt).ExecQuery("select * from Win32_OperatingSystem")
  For Each CompSys In CompSysSet  
          strOS = CompSys.Caption
          strSP = CompSys.CSDVersion
  Next
     
' Get Asset Tag Info  
  Set CompSysSet = GetObject(strWinMgt).ExecQuery("select * from Win32_SystemEnclosure")
  For Each CompSys In CompSysSet  
          strAsset = CompSys.SMBIOSAssetTag
   Next
   
' Get Disk Information for C drive
'
  Set DiskSet = GetObject(strWinMgt).ExecQuery("select FreeSpace,Size,Name from Win32_LogicalDisk where DeviceID = 'C:' and DriveType=3")
  For Each Disk In DiskSet
Rem strDisplayDiskInfo = strDisplayDiskInfo & "Drive " & Disk.Name & " Free Space: " & Clng(Disk.FreeSpace/1000000) & " MB  Total Size: " & Clng(Disk.Size/1000000) & " MB"& vbCrlf
          strCDriveLetter = Left(disk.name,2)
          strCFreeSpace = Disk.FreeSpace/2^30
          strCTotalSpace =  Disk.Size/2^30
  Next
 
' Get Disk Information for D drive
'
  Set DiskSet = GetObject(strWinMgt).ExecQuery("select FreeSpace,Size,Name from Win32_LogicalDisk where DeviceID = 'D:' and DriveType=3")
  For Each Disk In DiskSet
Rem strDisplayDiskInfo = strDisplayDiskInfo & "Drive " & Disk.Name & " Free Space: " & Clng(Disk.FreeSpace/1000000) & " MB  Total Size: " & Clng(Disk.Size/1000000) & " MB"& vbCrlf
          strDDriveLetter = Left(disk.name,2)
          strDFreeSpace = Disk.FreeSpace/2^30
          strDTotalSpace =  Disk.Size/2^30
  Next
 
' Get Network Card Info
  Set CompSysSet = GetObject(strWinMgt).ExecQuery("select * from Win32_NetworkAdapterConfiguration where IPEnabled = 'TRUE'")
  For Each CompSys In CompSysSet  
          strMAC = CompSys.MACAddress
          strNICModel = CompSys.Description
   Next
 
' Get User Info
  Set CompSysSet = GetObject(strWinMgt).ExecQuery("select * from Win32_ComputerSystem")
  For Each CompSys In CompSysSet  
          strUser = CompSys.UserName           
   Next
 
' Get CD Info
  Set CompSysSet = GetObject(strWinMgt).ExecQuery("select * from Win32_CDROMDrive")
  For Each CompSys In CompSysSet  
          strCD = CompSys.Drive
          strCDDescription = CompSys.Name 
   Next
 
  objRS.AddNew
  objRS("ComputerName") = strName
  objRS("Model") = strModel
  objRS("Vendor") = strVendor
  objRS("Serial") = strSerial
  objRS("Version") = strVersion
  objRS("CPU") = strCPU
  objRS("Speed") = strSpeed
  objRS("MonitorManufacturer") = strMonManufacturer
  objRS("MonitorModel") = strMonModel
  objRS("VideoRAM") =  strVidRAM/1024
  objRS("VideoCard") = strVidCard
  objRS("VideoMode") = strVidMode
  objRS("OS") = strOS
  objRS("SP") = strSP
  objRS("Asset") = strAsset
  objRS("CDrive") = strCDriveLetter
  objRS("CFreeSpace") = strCFreeSpace
  objRS("CTotalSpace") = strCTotalSpace
  objRS("DDrive") = strDDriveLetter
  objRS("DFreeSpace") = strDFreeSpace
  objRS("DTotalSpace") = strDTotalSpace
  objRS("CD") = strCD 
  objRS("CDDescription") = strCDDescription
  objRS("RAM") = intRAM
  objRS("NetworkCard") = strNICModel
  objRS("MAC") = strMAC 
  objRS("User") = strUser
  objRS("Date") = Date()
  objRS("Time") = Time()
  objRS.Update
  objRS.Close
 
End Sub

Open in new window

0
 
LVL 3

Expert Comment

by:Aurora27
ID: 20307006
Author, it clearly says either using Shell functions or WMI will help you. You may ort the SQL code to Access or use the links given. You may NOT get the code as you want from the net - You will have to understand and modify it.

CT.
0
 
LVL 11

Expert Comment

by:bsharath
ID: 20311366
Chandru looks to be great...
When i try i gt this...
C:\>PCinfo.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

C:\PCinfo.vbs(50, 3) Microsoft JET Database Engine: Invalid SQL statement; expec
ted 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.
0
 

Author Comment

by:Kasper Katzmann
ID: 20311414
Is there a way to run the script in silent mode?
0
 
LVL 12

Expert Comment

by:chandru_sol
ID: 20311695
The script should run in silent mode. Make sure you default script is wscript.exe

Sharath,

You need to create the msaccess file before you run the script

regards
Chandru
0
 

Author Comment

by:Kasper Katzmann
ID: 20312091
> The script should run in silent mode. Make sure you default script is wscript.exe

How does I verify this? And if it is not wscript.exe, how does I change it?

regards
Kasper
0
 
LVL 11

Expert Comment

by:bsharath
ID: 20312109
Chandru...
I created the file but still get the same...
0
 
LVL 12

Expert Comment

by:chandru_sol
ID: 20312115
cscript /h:wscript

regards
Chanrdu
0
 
LVL 12

Expert Comment

by:chandru_sol
ID: 20312129
Sharath

How did you create the file?

regards
Chandru
0
 
LVL 11

Expert Comment

by:bsharath
ID: 20312177
Opened an access file and saved it
0
 
LVL 12

Expert Comment

by:chandru_sol
ID: 20312197
You should create the table also....
0
 
LVL 11

Expert Comment

by:bsharath
ID: 20312219
I get this now chandru...

C:\>PCinfo.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

C:\PCinfo.vbs(202, 6) Microsoft VBScript compilation error: Syntax error
0
 
LVL 11

Expert Comment

by:bsharath
ID: 20312247
Chandru can you explain a bit about the table please...
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question