• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 859
  • Last Modified:

Run vb script to run on shutdown

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
adamc817
Asked:
adamc817
  • 8
  • 4
1 Solution
 
DMTechGrooupCommented:
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
 
adamc817Author Commented:
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
 
DMTechGrooupCommented:
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
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

 
adamc817Author Commented:
good idea, I redirected the output and I only get looking into it, should update tomorrow
0
 
adamc817Author Commented:
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
 
adamc817Author Commented:
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
 
adamc817Author Commented:
oh, if I put the shutdown in a batch file, this does not work either.... surely it is the LOCAL SYSTEM user...
0
 
DMTechGrooupCommented:
could try psshutdown

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

You can specify the username/password to use.
0
 
adamc817Author Commented:
same issue as before, works in dos not in shutdown
0
 
DMTechGrooupCommented:
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
 
adamc817Author Commented:
hi DMTechGrooup, i ummmm, don't know how to do this :), please explain further....

Thanks!
0
 
adamc817Author Commented:
got it, works!! WHO00 WHO
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

  • 8
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now