Jump to content

Shutdown Script


Go to solution Solved by spudw2k,

Recommended Posts

Well crap.

Is there a way to get it to?  Or better, if no on is logged in, just shutdown?

I don't know how its done....

TD

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

Well I think all is for not.  I want to use LanSweeper to "deploy" this like an install.  I have to set the creds as currently logged on (which will run it as the person who is logged in, so they get the GUI).  However if no one is logged in, LanSweeper fails the entire process (because, well, there are no creds).

Unless there is a way in AutoIT to launch the GUI under whoever is logged in, then I can use system creds in LanSweeper.  I am guessing I can't get that lucky tho.

Link to comment
Share on other sites

What i ended up doing, for anyone in the same boat.  I created a 2nd script that contains:

If ProcessExists("logonui.exe") Then ; Check if the Notepad process is running.
    Shutdown(BitOR($SD_SHUTDOWN, $SD_POWERDOWN))
Else
    ShellExecute('<PATH>\owexec.exe', '-c localhost -k <PATH>\Shutdown.exe')
EndIf

This will check if it the login screen it up, if it is, just shuts it down.  If not it runs the other script (owexec.exe runs it as the current user so the GUI shows up).

Back a$$ way of doing it, but it works.

Thanks for all your help!!!

Link to comment
Share on other sites

  • 2 months later...

esullivan? So what is the final script you ended up with? And how does it look? Can it be set to reboot the client instead of shutdown?? It looks like a great option for rebooting clients or servers ...

Edited by charlesg7
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...