A
A
Andrey Strelkov2021-02-15 19:03:27
Windows
Andrey Strelkov, 2021-02-15 19:03:27

How to tell the operating system to wait for the logoff of the group policy script to complete - until the end?

Good afternoon, there is a task in launching a certain script by group policies on logout.
In principle, the policy is configured, and it launches a specific VBS script, there is one caveat, my script is the following

Dim WShell
Set WShell = CreateObject("WScript.Shell")
WShell.Run "application.exe", 0
Set WShell = Nothing


Those. I perform a silent start, but the group policy seems to be doing everything right, it waits for the script to execute, and guarantees that it will not turn it off, will not log out until the script is completed.
However, this does not apply to running other scripts within the original script, i.e. having reached the step WShell.Run "application.exe", 0 , it will of course launch it, but only immediately go to the next step,
and if there is nothing further, it calmly continues the procedure for shutting down or logging out of the system ... and did it manage to there application.exe to do its own thing, she is no longer interested

In my case, application.exe, of course, does not have time to do anything. Of course, you can put a pause, say, 10 seconds at the end of the initial script, but is there a more correct solution, when the initial script will execute all the steps sequentially, waiting for the execution of each line when to the end?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Bezrukov, 2021-02-15
@strelkov_av

WShell.Run "application.exe", 0, true
Check...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question