Network Management Software
loginscript.vbs
Copy Right ZeroConnect
Contact ZeroConnect for more details at rainmakerpsi@yahoo.com
'Systems Managment
'Created by ZeroConnect
'4/23/03
'This is a WMI VBS script designed to inventory end-user computers.
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer
& "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor")
For Each objItem in colItems
'this displays the property to the screen
'For Testing only, this line is not being used.
'Wscript.Echo "Maximum Clock Speed: " & objItem.MaxClockSpeed
'Make sure we can use our Network objects.
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set oDrives = WshNetwork.EnumNetworkDrives
Set oPrinters = WshNetwork.EnumPrinterConnections
'this appends the data to the file.
Const ForAppending = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
("c:\status.txt", 8, True)
Set colServices = GetObject("winmgmts:")
objTextFile.WriteLine("Domain: " & WshNetwork.UserDomain)
objTextFile.WriteLine("User Name: " & WshNetwork.UserName)
objTextFile.WriteLine("Computer Name: " & WshNetwork.ComputerName)
objTextFile.WriteLine("Computer speed in MHZ: " & objItem.MaxClockSpeed)
objTextFile.WriteLine("CPU Manufacturer: " & objItem.Manufacturer)
objTextFile.WriteLine("CPU Details: " & objItem.Description)
'Get our Date to Write to the file
strComputer = "."
Set objSWbemServices = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer
& "\root\cimv2")
Set colTimeZone = objSWbemServices.ExecQuery _
("SELECT * FROM Win32_TimeZone")
For Each objTimeZone in colTimeZone
strBias = objTimeZone.Bias
Next
dtmCurrentDate = Date
dtmTargetDate = Year(dtmCurrentDate)
dtmMonth = Month(dtmCurrentDate)
If Len(dtmMonth) = 1 Then
dtmMonth = "0" & dtmMonth
End If
dtmTargetDate = dtmTargetDate & dtmMonth
dtmDay = Day(dtmCurrentDate)
If Len(dtmDay) = 1 Then
dtmDay = "0" & dtmDay
End If
objTextFile.WriteLine("Date: " & dtmCurrentDate)
objTextFile.WriteLine("")
objTextFile.Close
Next
|