Jump to content

Recommended Posts

Posted

Hi All,

 

SLT here has requested infromation on how much student laptops are being used. What they want is a breakdown, laptop trolley by laptop trolley, of the amount of time they are in use throughout the school week.

Is anyone else doing this? If so, how do you do it?

 

Cheers,

Stu

Posted

Standard "Mickey Mouse" request.

 

Startup script -> Write computer name and time to file on a fileshare.

Shutdown script -> Write computer name and time to file on a fileshare.

 

Depending on the type of data they want, you can manipulate the data in excel to produce graphs etc.

Posted

even add a bit more info

 

Option Explicit
Dim objFSO, objFolder, objShell, objTextFile, objFile
Dim strDirectory, strFile, strText
Dim Message, result
Dim Title, Text1, Text2, mydatestring, mytimestring, WshNetwork, wshShell, strComputerName


Set WshNetwork = WScript.CreateObject("WScript.Network")
Set wshShell = WScript.CreateObject( "WScript.Shell" )

myDateString = Date()
mytimestring = Time()
strComputerName = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )

strDirectory = "\\server\someshare$\logondata"
strFile = "\netbook usage.csv"
'strText = ""

' Define dialog box variables.
Message = "Why are you using this PC/Laptop"           
Title = "PC Usage Survey"
Text1 = "User input canceled"
Text2 = "You entered:" & vbCrLf

' Ready to use the InputBox function ' InputBox(prompt, title, default, xpos, ypos) ' prompt:    The text shown in the dialog box
' title:     The title of the dialog box ' default:   Default value shown in the text box ' xpos/ypos: Upper left position of the dialog box 
' If a parameter is omitted, VBScript uses a default value.

result = InputBox(Message, Title, "", 100, 100)

' Evaluate the user input.
'If result = "" Then    ' Canceled by the user
'    WScript.Echo Text1
'Else 
'    WScript.Echo Text2 & result
'End If

'writeout bits
'
' Create the File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")

' Check that the strDirectory folder exists
If objFSO.FolderExists(strDirectory) Then
  Set objFolder = objFSO.GetFolder(strDirectory)
Else
  Set objFolder = objFSO.CreateFolder(strDirectory)
  WScript.Echo "Just created " & strDirectory
End If

If objFSO.FileExists(strDirectory & strFile) Then
  Set objFolder = objFSO.GetFolder(strDirectory)
Else
  Set objFile = objFSO.CreateTextFile(strDirectory & strFile)
  Wscript.Echo "Just created " & strDirectory & strFile
End If 

set objFile = nothing
set objFolder = nothing
' OpenTextFile Method needs a Const value
' ForAppending = 8 ForReading = 1, ForWriting = 2
Const ForAppending = 8

Set objTextFile = objFSO.OpenTextFile _
(strDirectory & strFile, ForAppending, True)

' Writes result every time you run this VBScript
objTextFile.WriteLine("Pcname," & strComputerName & "," & "Username," & WshNetwork.UserName &"," &"Date," & myDateString &"," & "Time," & myTimeString & "," & "Reason," & Result)
objTextFile.Close

 

asks em why |(granted they can just close it and write a null string but still asks

 

output

 

Pcname,server,Username,me,Date,07/03/2012,Time,10:08:53,Reason,why not

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...