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