Users Guide
If strPropValue <> 3 Then
objInstance.Properties_.Item(strPropName).Value=3
objInstance.Put_
'***Ifanyerrorsoccurred,lettheuserknow
IfErr.Number<>0Then
WScript.Echo"SettingPXEonnextrebootfailed."
EndIf
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//nologoSampleForcePXE.vbs<systemname>"
WScript.Echo strMessage
End Sub
('****************************************************
'*** Nombre: SampleForcePXE.vbs
'*** Objetivo: forzar a un cliente Dell OMCI a iniciar en PXE en el siguiente reinicio.
'*** Uso: cscript.exe //nologo SampleForcePXE.vbs <nombre_del_sistema>
'***
'***Estasecuenciadecomandosdeejemploseproporcionaúnicamentecomomuestraynohasido
'***probabanitieneningunagarantíaporpartedeDell;Dellseeximedetoda
'*** responsabilidad relacionada con esta secuencia de comandos. Dell no proporciona asistencia
'***técnicarelacionadaconestetipodesecuenciasdecomandos.Paraobtenermásinformaciónsobresecuencias
'***decomandosdeWMI,consulteladocumentacióncorrespondientedeMicrosoft.
'****************************************************
Opciónexplícita
'*** Declarar variables
Dim strNameSpace
Dim strComputerName
Dim strClassName
Dim strKeyValue
Dim objInstance
Dim strPropName
Dim strPropValue
'***Comprobarqueseutilizóelarchivoejecutablecorrectoparaejecutarlasecuenciadecomandos
'***yqueseproporcionarontodoslosparámetros
If (LCase(Right(WScript.FullName, 11)) = "wscript.exe" ) Or _
(Wscript.Arguments.Count<1)Then
CallUsage()
WScript.Quit
End If
'*** Inicializar las variables
strNameSpace = "root/Dellomci"
strComputerName = WScript.Arguments(0)
strClassName = "Dell_Configuration"
strKeyValue = "Configuration"
strPropName = "ForcePXEOnNextBoot"
'*** Recuperar la instancia de la clase Dell_Configuration (debe haber
'*** solo 1 instancia).
Set objInstance = GetObject("WinMgmts:{impersonationLevel=impersonate}//" &_
strComputerName&"/"&strNameSpace&":"&strClassName&"="&_
Chr(34)&strKeyValue&Chr(34))
strPropValue = objInstance.Properties_.Item(strPropName).Value
'*** Establecer el nuevo valor para la propiedad y guardar la instancia, pero solo
'*** si el valor actual no es actualmente 3 ('Activado')
If strPropValue <> 3 Then
objInstance.Properties_.Item(strPropName).Value=3
objInstance.Put_
'***Sisepresentaalgúnerror,informaralusuario
IfErr.Number<>0Then
WScript.Echo"FallóelestablecimientodePXEparaelsiguientereinicio."
EndIf
End If
'*** Subrutina que se utiliza para mostrar el uso correcto de la secuencia de comandos
Sub Usage()
Dim strMessage
strMessage = "Sintaxis incorrecta. Debe ejecutar: " & vbCRLF & _
"cscript.exe//nologoSampleForcePXE.vbs<nombre_del_sistema>"
WScript.Echo strMessage
End Sub)
ActivacióndeEncendidoenLAN










