Ir ao conteúdo
  • Cadastre-se

Shutdown Programados desligamento


lagespablo

Posts recomendados

Bom dia, pessoal!

Estou com um pequeno probleminha! (como sempre) :D

Trabalho em um local onde aplico manutenção em laboratórios de informatica, e estamos sofrendo com o excesso de luz gasto pelos computadores a noite. Pois quando os alunos saim das salas de aula, esquecem de desligar os computares. E ficam ate o outro dia ligadas.

Alguém tem algum programa que posso usar para dar shutdown automático (em horários fixos) nas maquinas.

Obs.: o programa tem que funcionar tanto com usuário administrador quanto usuário convidado, (ou seja), qualquer usuário.

Nao posso mexer no servidor, pois somente a matriz tem acesso.

Link para o comentário
Compartilhar em outros sites

estou tentando fazer isso!! mas nao esta rodando!

olha ele ai!

StartIP = "192.168.0.170"

EndIP = "192.168.0.180"

TempFilename = "C:\Log do dia "&DataLog&".txt"

LF = chr(10)

const ForReading = 1, ForWriting = 2, ForAppending = 3

currentIP = StartIP

j = 2

'Inicia o LOG

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set Arquivo = objFSO.CreateTextFile(Tempfilename)

Set WSHShell = WScript.CreateObject("WScript.Shell")

Do

Strhost = currentIP

if Ping(strHost) = True then

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & _

strHost & "\root\cimv2")

Set colSettings = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")

For Each objComputer in colSettings

StrTerminal = objcomputer.name

StrUsuario = objcomputer.username

Next

'Executa o ShutDown

WSHShell.Run "shutdown -m \\" & strHost , 1, false

'Grava Log

arquivo.writeline "IP " & strHost & " - "&StrTerminal&" - "&Strusuario&" - comando de desligar as - " & Time()

Else

arquivo.writeline "Terminal " & strHost & " não pode ser encontrado, terminal desligado"

end if

xx = currentIP

currentIP = newIP(xx)

j = j+1

Loop Until currentIP = EndIP

Arquivo.close()

'--------------------------------

'Função Ping via WMI

'--------------------------------

Function Ping(strHost)

dim objPing, objRetStatus

set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery _

("select * from Win32_PingStatus where address = '" & strHost & "'")

for each objRetStatus in objPing

if IsNull(objRetStatus.StatusCode) or objRetStatus.StatusCode<>0 then

Ping = False

'WScript.Echo "Status code is " & objRetStatus.StatusCode

else

Ping = True

'Wscript.Echo "Bytes = " & vbTab & objRetStatus.BufferSize

'Wscript.Echo "Time (ms) = " & vbTab & objRetStatus.ResponseTime

'Wscript.Echo "TTL (s) = " & vbTab & objRetStatus.ResponseTimeToLive

end if

next

End Function

'------------

'function for increasing the IP number

'------------

function newip(xx)

dim n,n1,n2,n3,n4,v1,v2,v3,v4

n = 1

n0 = n

while mid (xx,n,1) <> "."

n = n+1

wend

n1 = n

n = n+1

while mid (xx,n,1) <> "."

n = n+1

wend

n2 = n

n = n+1

while mid (xx,n,1) <> "."

n = n+1

wend

n3 = n

n4 = len(xx)

v1 = mid (xx,n0,n1-1)

v2 = mid (xx,n1+1,n2-n1-1)

v3 = mid (xx,n2+1,n3-n2-1)

v4 = mid (xx,n3+1,n4-n3)

v4 = v4+1

if v4 > 255 then

v3 = v3+1

v4 = 0

end if

if v3 > 255 then

v2 = v2+1

v3 = 0

v4 = 0

end if

if v2 > 255 then

v1 = v1+1

v2 = 0

v3 = 0

v4 = 0

end if

return = (v1 & "." & v2 & "." & v3 & "." & v4)

newIP = return

end function

'------------

'function for validating the IP address

'------------

function ValidIP(xx)

dim n,n0,n1,n2,n3,n4,v1,v2,v3,v4,s,s1,s2,s3,s4

n = 1

n0 = n

s = 1

return = "valid"

s1 = InStr(s, xx, ".", 1)

s2 = InStr(s1+1, xx, ".", 1)

s3 = InStr(s2+1, xx, ".", 1)

s4 = len(xx)+1

if s1-s < 1 then

return = "invalid"

elseif s1-s > 3 then

return = "invalid"

elseif s2-s1 < 1 then

return = "invalid"

elseif s2-s1 > 4 then

return = "invalid"

elseif s3-s2 < 1 then

return = "invalid"

elseif s3-s2 > 4 then

return = "invalid"

elseif s4-s3 < 1 then

return = "invalid"

elseif s4-s3 > 4 then

return = "invalid"

else

while mid (xx,n,1) <> "."

n = n+1

wend

n1 = n

n = n+1

while mid (xx,n,1) <> "."

n = n+1

wend

n2 = n

n = n+1

while mid (xx,n,1) <> "."

n = n+1

wend

n3 = n

n4 = len(xx)

v1 = mid (xx,n0,n1-1)

v2 = mid (xx,n1+1,n2-n1-1)

v3 = mid (xx,n2+1,n3-n2-1)

v4 = mid (xx,n3+1,n4-n3)

if v4 > 255 then

return = "invalid"

end if

if v3 > 255 then

return = "invalid"

end if

if v2 > 255 then

return = "invalid"

end if

if v1 > 255 then

return = "invalid"

end if

end if

ValidIP = return

end function

[]s,

Link para o comentário
Compartilhar em outros sites

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...

 

GRÁTIS: ebook Redes Wi-Fi – 2ª Edição

EBOOK GRÁTIS!

CLIQUE AQUI E BAIXE AGORA MESMO!