Hi All,
Getting an error when running this script but don't quite know where to go.
I orginally was using it as a plain vbs file, but after discovering SCCM doesnt run these properly I converted it to a wsf file. However, it know doesnt work and comes up with the error:
Could not locate automation class named "Wscript.Shell".
Was wondering if anybody has any ideas?
<job id="main">
<script language="VBScript">
Const wshYes = 6
Const wshNo = 7
Const wshYesNoDialog = 4
Const wshQuestionMark = 32
Set objShell = CreateObject("Wscript.Shell")
intReturn = objShell.Popup("System maintainence shutdown, are you sure you wish to shutdown? If no response within 5 minutes system will automatically shutdown", _
300, "System maintainence shutdown", wshYesNoDialog + wshQuestionMark)
If intReturn = wshYes Then
Set WSHShell = WScript.CreateObject("WScript. Shell")
WSHShell.Run "%windir%system32shutdown.exe -s -t 360"
ElseIf intReturn = wshNo Then
Wscript.Echo "Shutdown Cancelled."
Else
Set WSHShell = WScript.CreateObject("WScript. Shell")
WSHShell.Run "%windir%system32shutdown.exe -s -t 360"
End If
</script>
</job>
Shutdown Script
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Shutdown Script
Hi All,
Getting an error when running this script but don't quite know where to go.
I orginally was using it as a plain vbs file, but after discovering SCCM doesnt run these properly I converted it to a wsf file. However, it know doesnt work and comes up with the error:
Could not locate automation class named "Wscript.Shell".
Was wondering if anybody has any ideas?
<job id="main">
<script language="VBScript">
Const wshYes = 6
Const wshNo = 7
Const wshYesNoDialog = 4
Const wshQuestionMark = 32
Set objShell = CreateObject("Wscript.Shell")
intReturn = objShell.Popup("System maintainence shutdown, are you sure you wish to shutdown? If no response within 5 minutes system will automatically shutdown", _
300, "System maintainence shutdown", wshYesNoDialog + wshQuestionMark)
If intReturn = wshYes Then
Set WSHShell = WScript.CreateObject("WScript. Shell")
WSHShell.Run "%windir%system32shutdown.exe -s -t 360"
ElseIf intReturn = wshNo Then
Wscript.Echo "Shutdown Cancelled."
Else
Set WSHShell = WScript.CreateObject("WScript. Shell")
WSHShell.Run "%windir%system32shutdown.exe -s -t 360"
End If
</script>
</job>
Getting an error when running this script but don't quite know where to go.
I orginally was using it as a plain vbs file, but after discovering SCCM doesnt run these properly I converted it to a wsf file. However, it know doesnt work and comes up with the error:
Could not locate automation class named "Wscript.Shell".
Was wondering if anybody has any ideas?
<job id="main">
<script language="VBScript">
Const wshYes = 6
Const wshNo = 7
Const wshYesNoDialog = 4
Const wshQuestionMark = 32
Set objShell = CreateObject("Wscript.Shell")
intReturn = objShell.Popup("System maintainence shutdown, are you sure you wish to shutdown? If no response within 5 minutes system will automatically shutdown", _
300, "System maintainence shutdown", wshYesNoDialog + wshQuestionMark)
If intReturn = wshYes Then
Set WSHShell = WScript.CreateObject("WScript. Shell")
WSHShell.Run "%windir%system32shutdown.exe -s -t 360"
ElseIf intReturn = wshNo Then
Wscript.Echo "Shutdown Cancelled."
Else
Set WSHShell = WScript.CreateObject("WScript. Shell")
WSHShell.Run "%windir%system32shutdown.exe -s -t 360"
End If
</script>
</job>
Shutdown Script
Sorry but that cannot be done by a script remotely.
SCCM cannot instantiate certain objects. The shell cannot be remoted.
There are third party products that you can use to accomplish this. You can also write a custom shutdown service.
SCCM cannot instantiate certain objects. The shell cannot be remoted.
There are third party products that you can use to accomplish this. You can also write a custom shutdown service.