I was wondering if any one knows how to write a script for Auto Shutdown in Kace. I have Wake-On-Lan set up as a trial and it seems to be working just fine but now I need a script for Auto Shutdown. I have one set up but it doesn't seem to work on a schedule when I set it and I am not able to shut my own computer down I can shut others down if I run it now, but it doesn't always work. Could someone please tell me what is wrong with my script.

Directory: %WINDIR%\System 32 File: cmd.exe Parameters: /C shutdown /s /c”Shutdown by KBOX” /t 90 /d U:00:00 Log: “DOS Command Issued Successfully.” To “status”
Not every computer has a C: Local Drive...
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
I don't see a call to shutdown.exe. How about a batch file (in a script) with simply your call to shutdown?
Answered 03/08/2011 by: GillySpy
Seventh Degree Black Belt

Please log in to comment
0
What OS is this? Could be a simple syntax thing- try using dashes instead of forward slashes. Is this an online script or offline script? If it's online, do the computers have an AMP connection? If offline, what's your script sync scheule set to in your agent settings; is it possible they don't have the script copied locally? Note that offline scripts run under the local system account via the agent, so permissions could be at play. I'd add some logging steps at each point in the script for debugging.

Not every computer has a C: Local Drive...
%WINDIR% variable should take care of that.

Alternatively, why not use the built in power management options?
Answered 03/08/2011 by: cblake
Red Belt

Please log in to comment
0
ORIGINAL: GillySpy

I don't see a call to shutdown.exe.  How about a batch file (in a script) with simply your call to shutdown?


He's calling shutdown with cmd.exe /c. It's there, he just didn't add the implied .exe to "shutdown".
Answered 03/08/2011 by: airwolf
Tenth Degree Black Belt

Please log in to comment
0
Try adding /f.
Answered 03/08/2011 by: airwolf
Tenth Degree Black Belt

Please log in to comment
0
I'm not sure how to do that...I am very new to KBOX and writing scripts. I am a student doing an Internship and we do not learn how to write these scripts in a Networking Degree for something like Kace.
Answered 03/08/2011 by: blentz31
Purple Belt

Please log in to comment
0
I am currently running Windows XP and there are many different models of Dell computers at our company. I believe it should be an offline command I used the one that was already added in Kace and it works once and a while but not very often. I am not able to log in using my name and shut down a computer under my name but if someone else logs on to the same computer with their name it will most likely shutdown using the script I had (one I posted on here). I just tried adding the /f and that didn't work. I also tried using slashes and dashes and that didn't work either. I am not real sure how to create a batch file for shutdown like someone else on here suggested. My Supervisor wants me to use Kace to shutdown the computers and not use the ones on the PCs. So I am kinda stuck with using Kace and figure this out one way or another. Also we will not be shutting down all pcs at night because some people log in at night through VPN so they need their pcs on at night. I hope this helps explain a little more.
Answered 03/09/2011 by: blentz31
Purple Belt

Please log in to comment
0
We use the below VBscript to do a nightly shutdown. The script has a windows pop-up that warns the user of the shutdown and gives them the option of canceling it. It then uses a WMI call to process the shutdown. If WMI is a problem in your environment, you could always sub-out the WMI call with a call to shutdown, with something like "shutdown /t 15 /s /f". This script has worked on both XP and Windows 7 desktops. We use the scripting features of the KBOX 1000 to run this nightly at 6pm on most campus PCs.


'ShutdownTimer.vbs - Shutdown Windows after n minutes.
'Requires Windows 98 or higher, and Windows Script Host 2 or greater.
'© Bill James - bill@billsway.com - rev 26/Oct/2003 15:21

Option Explicit
Dim ws, Title, ErrMsg
Set ws = CreateObject("Wscript.Shell")
Title = "Windows Shutdown Notification"
Dim oWMI, oOS, obj

On Error Resume Next
Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}!\\.\root\cimv2")
If Err Then
Call Cleanup
End If
On Error GoTo 0
For Each obj in oWMI.ExecQuery("Select * from Win32_OperatingSystem")
Set oOS = obj
Exit For
Next

ShutDownNow

Sub ShutDownNow()
Const EWX_LOGOFF = 0
Const EWX_SHUTDOWN = 1
Const EWX_REBOOT = 2
Const EWX_FORCE = 4
Const EWX_POWEROFF = 8

'Last chance to abort shutdown.
If ws.Popup("This computer is shutting down in 2 minutes (" & TimeValue(DateAdd("n", 1, Now())) & "). Please save your work and exit any programs running." & _
vbcrlf & vbcrlf & "Click Cancel to abort shutdown, click OK to shutdown now.",_
120, Title, 1 + 256 + 48 + 4096) = 2 Then
Call Cleanup
Else
oOS.Win32shutdown EWX_SHUTDOWN + EWX_FORCE
End If
End Sub

Sub Cleanup
Set ws = Nothing
WScript.Quit
End Sub
Answered 03/09/2011 by: sdickenson
Senior Yellow Belt

  • I don't 'read' vbs. Does this check to see if the computer is already off, and if so, ignores it?
Please log in to comment
Answer this question or Comment on this question for clarity