i = 0
For Each objInstance in objEnumerator
If blnForce Then
intStatus = objInstance.Win32ShutDown(CONST_FORCE_LOGOFF)
Else
intStatus = objInstance.Win32ShutDown(CONST_LOGOFF)
End If
IF intStatus = 0 Then
strMessage = "Logging off the current user on machine " & _
strServer & "..."
Else
strMessage = "Failed to log off the current user from machine " _
& strServer & "."
End If
Call WriteLine(strMessage,objOutputFile)
Next
If IsObject(objOutputFile) Then
objOutputFile.Close
Call Wscript.Echo ("Results are saved in file " & strOutputFile & ".")
End If
End Sub
'********************************************************************
'*
'* Sub PowerOff()
'*
'* Purpose: Powers off a machine.
'*
'* Input: strServer a machine name
'* strOutputFile an output file name
'* strUserName the current user's name
'* strPassword the current user's password
'* blnForce specifies whether to force the logoff
'* intTimer specifies the amount of time to perform the function
'*
'* Output: Results are either printed on screen or saved in strOutputFile.
'*
'********************************************************************
Private Sub PowerOff(strServer, strOutputFile, strUserName, strPassword, blnPowerOff, blnForce, intTimer)







