?
Solved

Run vb script to run on shutdown

Posted on 2014-04-21
12
Medium Priority
?
656 Views
Last Modified: 2014-04-28
Hi All,

I have a script that shutsdown the iscsi clients connected to it.

This script runs on a Win 2k8 R2 machine and I set it to run on logoff in group policy and all is good the remote machines turn off.

When I set it to run on shutdown in group policy, nothing happens, the remote machines don't shutdown, none of my pop ups show up from the vbscript.  It is the same exact file.... what gives??
0
Comment
Question by:adamc817
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 4
12 Comments
 
LVL 24

Expert Comment

by:DMTechGrooup
ID: 40013652
Did you copy the script to the right sysvol folder?

http://technet.microsoft.com/en-us/magazine/dd630947.aspx

Steps 3 & 4 under Assigning User Logon and Logoff Scripts
0
 

Author Comment

by:adamc817
ID: 40013672
Thanks!

I do have it the at the correct location:
C:\Windows\System32\GroupPolicy\Machine\Scripts\Shutdown

I have also added it to the shutdown properties.

I did as well make a batch file that first calls the wsf script then writes the time to a file.

If I run the batch file directly in a command line not shutting down everything works, both the script and a file is created.

If I shutdown, I only see a file created, which runs on the second line not the first....
0
 
LVL 24

Expert Comment

by:DMTechGrooup
ID: 40015327
Im thinking it could be a permissions issue..

Here is some talk on the subject..

http://stackoverflow.com/questions/18168002/windows-7-group-policy-editor-shutdown-batch-file-not-executing
0
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

 

Author Comment

by:adamc817
ID: 40016647
good idea, I redirected the output and I only get looking into it, should update tomorrow
0
 

Author Comment

by:adamc817
ID: 40018881
ok so the script is running but the command just times out

It seems that .Run command does not actually run my shutdown...

		Set objShell = WScript.CreateObject( "WScript.Shell" )
		eXec="cmd /c " shutdown /s /m  \\" & Host.HostName & " /t 0 " > """ & tempFile& """"
		objShell.Run eXec,FALSE,TRUE

Open in new window


again it runs in command line but not when shutting down the system, does LOCAL SYSTEM not have these permissions? To shutdown a remote node logged into the domain, I am running this from the DC.
0
 

Author Comment

by:adamc817
ID: 40019122
I am open to use another method, I am just trying to shut down a specific node on the domain when shutting down the DC... (this is not a typical network)
0
 

Author Comment

by:adamc817
ID: 40019133
oh, if I put the shutdown in a batch file, this does not work either.... surely it is the LOCAL SYSTEM user...
0
 
LVL 24

Expert Comment

by:DMTechGrooup
ID: 40019160
could try psshutdown

http://technet.microsoft.com/en-us/sysinternals/bb897541.aspx

You can specify the username/password to use.
0
 

Author Comment

by:adamc817
ID: 40021049
same issue as before, works in dos not in shutdown
0
 
LVL 24

Accepted Solution

by:
DMTechGrooup earned 2000 total points
ID: 40021757
Found this..

Also, Startup and Shutdown scripts run with System permissions on the local
computer, but the permissions of the computer object in the domain. A script
that works with your credentials may not work if the computer object lacks
permission. You may need to grant "Domain Computers" permissions.

See if adding Domain Computers to the local admin of the machine will make a difference.
0
 

Author Comment

by:adamc817
ID: 40023755
hi DMTechGrooup, i ummmm, don't know how to do this :), please explain further....

Thanks!
0
 

Author Comment

by:adamc817
ID: 40028173
got it, works!! WHO00 WHO
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
This tutorial will walk an individual through locating and launching the BEUtility application and how to execute it on the appropriate database. Log onto the server running the Backup Exec database. In a larger environment, this would generally be …
This tutorial will give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question