Discussion Locked

script to close a file on shutdown?

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have never written a script for Windows itself. I am somewhat familiar with VB script. What I want to do is have Windows end the process "WISPTIS.exe" before shutting down. I've noticed that if I don't end this process my computer won't shut down properly. a quick search shows that this file is used by Adobe Acrobat (which I do have installed).
So I either need a script to have it end before shutting the computer down, or find out if it's really necessary to keep this file.
Thanks!
Tink

3 replies

by bfilmfan

To reboot the local machine from a VBScript script, you can use the following code. For the code to work, Windows Management Instrumentation (WMI) must be installed on the machine you're rebooting.

Set OpSysSet =
GetObject("winmgmts:{(Shutdown)}//./root/cimv2").ExecQuery_
("select * from Win32_OperatingSystem where Primary=true")

for each OpSys in OpSysSet
OpSys.Reboot()
next
(The GetObject line wraps to two lines here because of space constraints.) To shut down the machine, change the OpSys.Reboot() line to OpSys.Shutdown().

You could also try the suggestions here:

http://www.microsoft.com/technet/scriptcenter/guide/sas_cpm_evqo.mspx

You can also close a particular process with this script:

Option Explicit

Dim objProcesses, objProcess

Set objProcesses = GetObject("WinMgmts:root/CIMV2").ExecQuery( _
"SELECT * FROM Win32_Process WHERE Name=WISPTIS.EXE'")

For Each objProcess In objProcesses
objProcess.Terminate
Next

Enjoy!

by tink!

cool, thanks for the script now for the million dollar question: How do I utilise it? (where do I put it?)

by bfilmfan

Group Policy can be used to assign Logoff, Startup, and Shutdown scripts. The Logoff script setting in Group Policy is ?User Configuration?, ?Windows Settings?, ?Scripts (Logon/Logoff)?, ?Logoff?. Similar to the Logon script setting, it applies to all users in the domain, site, or organizational unit that the GPO is assigned to. Startup and Shutdown scripts are in ?Computer Configuration?, ?Windows Settings?, ?Scripts (Startup/Shutdown)?. These scripts are applied to any computer in the domain, site, or organizational unit that the Group Policy is applied to.

This discussion is closed to new replies.