%@ LANGUAGE="VBSCRIPT"%>
<%Response.Expires = 0%>
Set Reboot Page
<%
Dim objTaskContext
Dim objAS
Dim rc
Dim strStatus
Dim objLocMgr
Dim varReplacementStrings
Dim strRebootErrorText
Dim strShuttingDownText
Const REBOOT_ERROR_TEXT = "&H4002000E"
Const SHUTTINGDOWN_TEXT = "&H40020011"
On Error Resume Next
Err.Clear
Set objLocMgr = Server.CreateObject("ServerAppliance.LocalizationManager")
If Err.number = 0 Then
strRebootErrorText = objLocMgr.GetString("salocaluimsg.dll",REBOOT_ERROR_TEXT,varReplacementStrings)
strShuttingDownText = objLocMgr.GetString("salocaluimsg.dll",SHUTTINGDOWN_TEXT,varReplacementStrings)
Set objLocMgr = Nothing
End If
If strRebootErrorText = "" Then
strRebootErrorText = "Encountered problem in rebooting. The change has been canceled."
End If
Err.Clear
Const strMethodName = "ShutdownAppliance"
Set objTaskContext = CreateObject("Taskctx.TaskContext")
If Err.Number <> 0 Then
strStatus = strRebootErrorText
else
Set objAS = CreateObject("Appsrvcs.ApplianceServices")
If Err.Number <> 0 Then
strStatus = strRebootErrorText
Set objTaskContext = Nothing
else
objTaskContext.SetParameter "Method Name", strMethodName
objTaskContext.SetParameter "SleepDuration", 1000
objTaskContext.SetParameter "PowerOff", "0"
If Err.Number <> 0 Then
strStatus = strRebootErrorText
Set objAS = Nothing
Set objTaskContext = Nothing
else
objAS.Initialize()
If Err.Number <> 0 Then
strStatus = strRebootErrorText
Set objAS = Nothing
Set objTaskContext = Nothing
else
rc = objAS.ExecuteTaskAsync("ApplianceShutdownTask", objTaskContext)
If Err.Number <> 0 Then
strStatus = strRebootErrorText
else
strStatus = "Success"
End If
Set objAS = Nothing
Set objTaskContext = Nothing
End If
End If
End If
End If
%>
<%=strStatus%>
<%=strShuttingDownText%>