• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 708
  • Last Modified:

objComputer.?

.
I would like to have the timeand date also printed in txt file.
I cant seem to find a objcomputer.time&date. How do one actually find these properties or is it methods?
Its difficult to know what to use, is there a list somewhere to check what X do for obj.Computer.X?

For Each objComputer in colComputer
strComputer = objComputer.Name
TimeDate = objComputer.Time

Thanks very much! /D
0
Dabosa
Asked:
Dabosa
  • 2
1 Solution
 
sirbountyCommented:
As an example:
http://www.microsoft.com/technet/scriptcenter/resources/qanda/jan05/hey0127.mspx

strComputer = "."
 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_LocalTime")
 
For Each objItem in colItems
    Wscript.Echo "Month: " & objItem.Month
    Wscript.Echo "Day: " & objItem.Day
    Wscript.Echo "Year: " & objItem.Year
    Wscript.Echo "Hour: " & objItem.Hour
    Wscript.Echo "Minute: " & objItem.Minute
    Wscript.Echo "Second: " & objItem.Second
Next

Open in new window

0
 
sirbountyCommented:
With the other question's code...
 FilePath = "\\servername\folder\"
Const HKEY_CLASSES_ROOT = &H80000000
 
Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objTextFile, BIOSData, OSData, CSData, DTData, strComputer
 
If objFSO.FolderExists ("C:\Program Files\Adobe\Reader 9.0\Reader") Then 
  DoUpdate
Else
  DoMissing
End If
 
objTextFile.Close
 
Sub  DoUpdate()
  Set objTextFile = objFSO.OpenTextFile(FilePath & "Acrobat9Installed.txt",8)
  GetDetails()
  objTextFile.WriteLine strComputer & vbTab & DTData & vbtab & CSData & vbTab & BIOSData & vbTab & OSData
 
  Set objRegistry = GetObject("winmgmts:\\.\root\default:StdRegProv")
  strKeyPath = "SOFTWARE\Adobe\Acrobat\Exe"
  strValueName = ""
  strValue = """C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe"""
 
  objRegistry.SetStringValue HKEY_CLASSES_ROOT, strKeyPath, strValueName, strValue
End Sub
 
Sub DoMissing()
  Set objTextFile = objFSO.OpenTextFile(FilePath & "Acrobat9NOTInstalled.txt",8)
  GetDetails()
  objTextFile.WriteLine strComputer & & vbTab & DTData & vbtab & CSData & vbTab & BIOSData & vbTab & OSData
End Sub
 
Sub GetDetails()
  Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
  Set colBIOS = objWMIService.ExecQuery  ("SELECT * FROM Win32_BIOS")
 
  For Each objBIOS in colBIOS
    BIOSData = objBIOS.Manufacturer & vbtab & objBIOS.SerialNumber & vbtab & objBIOS.SMBIOSBIOSVersion 
  Next
 
  Set colData = objWMIService.ExecQuery ("SELECT * From Win32_LocalTime")
  For Each objItem in colData
    DTData = objItem.Month & objItem.Day & objItem.Year & vbTab & objItem.Hour & objItem.Minute & objItem.Second
  Next
 
  Set colSettings = objWMIService.ExecQuery  ("SELECT * FROM Win32_OperatingSystem")
  For Each objOperatingSystem in colSettings
    OSData = objOperatingSystem.Name & vbtab & objOperatingSystem.Version & vbtab & objOperatingSystem.ServicePackMajorVersion & vbtab & _
         objOperatingSystem.Manufacturer & vbtab & objOperatingSystem.WindowsDirectory & vbtab & objOperatingSystem.FreePhysicalMemory & vbtab & _
         objOperatingSystem.TotalVirtualMemorySize & vbtab & objOperatingSystem.FreeVirtualMemory 
  Next
 
  Set colComputer = objWMIService.ExecQuery ("SELECT * FROM Win32_ComputerSystem")
  For Each objComputer in colComputer
    strComputer = objComputer.Name
    CSData = objComputer.Username & vbtab & objComputer.Manufacturer & vbtab & objComputer.Model & vbtab &  objComputer.CurrentTimeZone
  Next
End Sub

Open in new window

0

Featured Post

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.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now