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:\TimeLogger\TimeLogger.exe 'Logout'"), WaitUntilFinished
Set objShell = Nothing
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeremy WeisingerSenior Network Consultant / EngineerCommented:
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.
MoneyPlusAuthor Commented:
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?
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
You can do something like this:

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFileToWrite = objFSO.OpenTextFile("C:\TestLocalLog.txt",2,true)
objFileToWrite.WriteLine("Testing Script Run")

Open in new window

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Chris HInfrastructure ManagerCommented:
Try disabling execution policy
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force
in powershell maybe?
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
Try disabling execution policy ... ... in powershell maybe?
Aren't we talking about VBS and not Powershell?
Chris HInfrastructure ManagerCommented:
Duh...  Sorry

Not to change gears, but what's the result if you put the executable file on your NETLOGON share?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MoneyPlusAuthor Commented:
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:\TimeLogger\TimeLogger.exe 'Logout'"), WaitUntilFinished
 Set objShell = Nothing
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
The powershell equivalent is this:
Start-Process C:\TimeLogger\TimeLogger.exe -ArgumentList Logout -Wait

Open in new window

However, I would not recommend changing the execution policy.
MoneyPlusAuthor Commented:
Works perfect when I put the files on the net share
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.