MoneyPlus
asked on
Group policy Logon/Logoff VB script to run timelogger.exe file on users C: Drive
Good afternoon,
My developer has created an application called timelogger.exe This has been installed on all workstations and is working perfect. We have also created 2 VB scripts called login and logoff. The code is as follows
The login vbs works perfect and it writes the value login into the database. There is no problem with receiving logging in times from Logins. My issue is the logoff script is setup in a user group policy\scripts\logoff but this is not working. We are not receiving the users logout time in the database.
Questions I have are
1. Why is the Group logoff script not working, the group policy is being applied it was an existing GP so its working.
2. please do not comment on locations of the GP etc as I know what I am doing.
3. I need to know why the logoff script below cannot run the exe on the users C drive. It works manually by running the file. The file is below. I had some joy when It was a PowerShell script but not sure why as it's VB code!
It was running on logoff on Windows 7 machines when it was a PowerShell script in 2008 GPO. It would not work when you shut computers down. I thought logoff would still happen
Dim objShell
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run("C:\TimeLogge r\TimeLogg er.exe 'Logout'"), WaitUntilFinished
Set objShell = Nothing
My developer has created an application called timelogger.exe This has been installed on all workstations and is working perfect. We have also created 2 VB scripts called login and logoff. The code is as follows
The login vbs works perfect and it writes the value login into the database. There is no problem with receiving logging in times from Logins. My issue is the logoff script is setup in a user group policy\scripts\logoff but this is not working. We are not receiving the users logout time in the database.
Questions I have are
1. Why is the Group logoff script not working, the group policy is being applied it was an existing GP so its working.
2. please do not comment on locations of the GP etc as I know what I am doing.
3. I need to know why the logoff script below cannot run the exe on the users C drive. It works manually by running the file. The file is below. I had some joy when It was a PowerShell script but not sure why as it's VB code!
It was running on logoff on Windows 7 machines when it was a PowerShell script in 2008 GPO. It would not work when you shut computers down. I thought logoff would still happen
Dim objShell
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run("C:\TimeLogge
Set objShell = Nothing
Does the TimeLogger application require network connectivity? It could be that when you're logging off, it loses it's connection to the DB. You can test to see if the script is executing by writing to a local log file.
ASKER
Jeremy,
Yes it writes to a SQL Database on the network? That's what I thought any suggestions on how to write to a local log file?
Yes it writes to a SQL Database on the network? That's what I thought any suggestions on how to write to a local log file?
You can do something like this:
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CreateTextFile("C:\TestLocalLog.txt")
Set objFileToWrite = objFSO.OpenTextFile("C:\TestLocalLog.txt",2,true)
objFileToWrite.WriteLine("Testing Script Run")
objFileToWrite.Close
Try disabling execution policy
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force
in powershell maybe?
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force
in powershell maybe?
Try disabling execution policy ... ... in powershell maybe?Aren't we talking about VBS and not Powershell?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Were not using powershell scripts there VBS could you convert to powershell and add the new code for disabling execution policy?
Dim objShell
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run("C:\TimeLogge r\TimeLogg er.exe 'Logout'"), WaitUntilFinished
Set objShell = Nothing
Dim objShell
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run("C:\TimeLogge
Set objShell = Nothing
The powershell equivalent is this:
However, I would not recommend changing the execution policy.
Start-Process C:\TimeLogger\TimeLogger.exe -ArgumentList Logout -Wait
However, I would not recommend changing the execution policy.
ASKER
Works perfect when I put the files on the net share