
그래서 여기 이것은 멍청한 놈이 보낸 것입니다. 양해해주십시오.
그래서 매일 오후 4시 15분에 내 도메인에 연결된 컴퓨터를 자동으로 종료하고 싶습니다. 이제 저는 여기저기 기웃거리다가 shutdown.exe를 사용하는 작업 스케줄러를 통해 이 작업을 수행할 수 있다는 것을 알게 되었습니다.
지금까지는 괜찮았지만 현재 해당 클라이언트에 로그인되어 있는 사용자에게 시스템이 5분 안에 종료된다는 귀여운 메시지를 표시하고 싶다면 어떻게 해야 할까요? 내 스누핑 내용에 따르면 이는 VB를 사용하여 가능합니다. 문제는 그것이 무엇인지 말 그대로 전혀 모른다는 것입니다. 누군가 그것이 무엇에 관한 것인지 설명할 만큼 친절할 수 있습니까?
여기까지 오셨다면 감사합니다 :)
답변1
VB는 (Visual Basic Script)의 약어입니다. 아래는 작업을 수행하기 위해 VB를 실행하는 코드입니다.코드 참조
1단계) 텍스트 편집기를 다운로드하여 코드를 입력하세요.여기를 클릭하세요
2단계) 아래 코드를 복사하여 텍스트 편집기에 붙여넣으세요.
3단계) 클릭파일그 다음에다른 이름으로 저장-아직 저장을 클릭하지 마세요
4단계) 다음이 있는지 확인하세요.형식으로 저장로 설정모든 유형
5단계) 전화파일 이름 원격종료.vbs-.vbs를 잊지 마세요!
6단계) 클릭파일그 다음에폴더를여세요그런 다음 클릭탐침
7단계) 방금 생성한 스크립트를 두 번 클릭하세요!
8 단계) 스크립트가 당신을 묻는 경우"어떤 컴퓨터에서 작업을 수행합니까?"제어하려는 네트워크의 컴퓨터 이름을 입력하세요.
9 단계) 다음 질문에 2를 답하세요
10단계) VBScript로 코딩하는 방법을 배울 수 있는 웹사이트를 찾으세요.여기서 시작하세요
아래는 메모장에 들어갈 코드입니다 ++
strComputer=InputBox("Perform action on what computer?","Enter Computer
Name",strComputer)
'if no computername is specified (blank), then quit
If strComputer = "" Then WScript.Quit
strComputer = UCase(strComputer)
RestartMode = InputBox("I would like to perform the following action on " &
strComputer & ":" & vbcrlf & vbcrlf _
& "0 - Restart " & strComputer & vbcrlf _
& "1 - Logoff " & strComputer & vbcrlf _
& "2 - Shutdown " & strComputer & vbcrlf _
& "3 - Do nothing " & vbcrlf _
& vbcrlf,"Restart action",RestartMode)
If RestartMode = "" Then
wscript.quit
ElseIf RestartMode < 0 or Restartmode > 3 Then
wscript.echo "You must select a valid option between 0 and 3. Script will now
exit."
wscript.quit
End If
'You could also remove the above lines and declare your variables like this:
' strComputer = "computername"
' RestartMode = 1
'0 = restart, 1 = logoff, 2 = shutdown, 3 = do nothing
'also, with a little work, you could easily make command-line arguments for this
Call RestartAction
Sub RestartAction
Dim OpSysSet, OpSys
Set OpSysSet = GetObject("winmgmts:{(Shutdown)}//"_
& strComputer & "/root/cimv2").ExecQuery("select * from Win32_OperatingSystem"_
& " where Primary=true")
'set PC to reboot
If RestartMode = 0 Then
For each OpSys in OpSysSet
opSys.Reboot()
Next
'set PC to logoff
ElseIf RestartMode = 1 Then
Const EWX_LOGOFF = 0
For each OpSys in OpSysSet
opSys.win32shutdown EWX_LOGOFF
Next
'set PC to shutdown
ElseIf RestartMode = 2 Then
For each OpSys in OpSysSet
opSys.Shutdown()
Next
'set PC to do nothing
ElseIf RestartMode = 3 Then
End If
End Sub