Users Guide

'*** and that all parameters were passed
If (LCase(Right(WScript.FullName, 11)) = "wscript.exe" ) Or _
(Wscript.Arguments.Count<1)Then
CallUsage()
WScript.Quit
End If
'*** Initialize variables
strNameSpace = "root/Dellomci"
strComputerName = WScript.Arguments(0)
strClassName = "Dell_Configuration"
strPropValue = "Configuration"
strMethod = "Shutdown"
'*** Retrieve the Dell_Configuration class
Set objInstance = GetObject("WinMgmts:{impersonationLevel=impersonate}//" &_
strComputerName&"/"&strNameSpace&":"&strClassName)
'*** Execute the Shutdown method
Set ObjOutParam = objInstance.ExecMethod_(strMethod)
'*** Let the user know whether the method returned success or not
'*** Note: if return value is 0, it does not mean the system has
'*** shutdown, it only means that the shutdown method was initiated
'*** successfully.
If objOutParam.ReturnValue = 0 Then
WScript.Echo"Methodcompletedsuccessfully."
else
WScript.Echo"Methodfailed."
End If
'*** Sub used to display the correct usage of the script
Sub Usage()
Dim strMessage
strMessage = "incorrect syntax. You should run: " & vbCRLF & _
"cscript.exe//nologoSampleShutdown.vbs<systemname>"
WScript.Echo strMessage
End Sub
('****************************************************
'*** Nombre: SampleShutdown.vbs
'*** Objetivo: apagar un cliente Dell™ OMCI.
'*** Uso: cscript.exe //nologo SampleShutdown.vbs <nombre_del_sistema>
'***
'***Estasecuenciadecomandosdeejemploseproporcionaúnicamentecomomuestraynoha
'***sidoprobabanitieneningunagarantíaporpartedeDell;Dellseexime
'*** de toda responsabilidad relacionada con esta secuencia de comandos. Dell no proporciona
'***asistenciatécnicarelacionadaconestetipodesecuenciasdecomandos.Paraobtenermás
'***informaciónacercadesecuenciasdecomandosdeWMI,consulteladocumentacióndeMicrosoft®
'*** sobre el tema.
'****************************************************
Opciónexplícita
'*** Declarar variables
Dim strNameSpace
Dim strComputerName
Dim strClassName
Dim strPropValue
Dim objInstance
Dim ObjOutParam
Dim strMethod
'***Comprobarqueseutilizóelarchivoejecutablecorrectoparaejecutarlasecuenciadecomandos
'***yqueseproporcionarontodoslosparámetros
If (LCase(Right(WScript.FullName, 11)) = "wscript.exe" ) Or _
(Wscript.Arguments.Count<1)Then
CallUsage()
WScript.Quit
End If
'*** Inicializar las variables
strNameSpace = "root/Dellomci"
strComputerName = WScript.Arguments(0)
strClassName = "Dell_Configuration"
strPropValue = "Configuration"
strMethod = "Shutdown"
'*** Recuperar la clase Dell_Configuration
Set objInstance = GetObject("WinMgmts:{impersonationLevel=impersonate}//" &_
strComputerName&"/"&strNameSpace&":"&strClassName)
'***EjecutarelmétodoShutdown(apagado)
Set ObjOutParam = objInstance.ExecMethod_(strMethod)
'***Informaralusuariosielmétodoseejecutósatisfactoriamente
'*** Nota: si el valor generado es 0, no significa que el sistema se ha
'***apagado,sinoqueseiniciócorrectamenteelmétodo
'*** correctamente.
If objOutParam.ReturnValue = 0 Then