Skip to content

Commit c94cf82

Browse files
committed
c.e. shutdown scripts
1 parent bbf15ba commit c94cf82

File tree

5 files changed

+85
-85
lines changed

5 files changed

+85
-85
lines changed
Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
Const EVENT_SUCCESS = 0
2-
Set objShell = Wscript.CreateObject("Wscript.Shell")
3-
objShell.LogEvent EVENT_SUCCESS, "Log-off via script"
4-
5-
6-
Const LOGOFF = 0
7-
Const SHUTDOWN = 1
8-
Const REBOOT = 2
9-
Const POWEROFF = 8
10-
11-
Const LOGOFF_FORCE = 4
12-
Const SHUTDOWN_FORCE = 5
13-
Const REBOOT_FORCE = 6
14-
Const POWEROFF_FORCE = 12
15-
16-
strComputer = "."
17-
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate,(Shutdown)}!\\" & strComputer & "\root\cimv2")
18-
Set colOperatingSystems = objWMIService.ExecQuery ("SELECT * FROM Win32_OperatingSystem")
19-
For Each objOperatingSystem in colOperatingSystems
20-
ObjOperatingSystem.Win32Shutdown(LOGOFF)
21-
Next
1+
Const EVENT_SUCCESS = 0
2+
Set objShell = Wscript.CreateObject("Wscript.Shell")
3+
objShell.LogEvent EVENT_SUCCESS, "Logging off via script"
4+
5+
6+
Const LOGOFF = 0
7+
Const SHUTDOWN = 1
8+
Const REBOOT = 2
9+
Const POWEROFF = 8
10+
11+
Const LOGOFF_FORCE = 4
12+
Const SHUTDOWN_FORCE = 5
13+
Const REBOOT_FORCE = 6
14+
Const POWEROFF_FORCE = 12
15+
16+
strComputer = "."
17+
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate,(Shutdown)}!\\" & strComputer & "\root\cimv2")
18+
Set colOperatingSystems = objWMIService.ExecQuery ("SELECT * FROM Win32_OperatingSystem")
19+
For Each objOperatingSystem in colOperatingSystems
20+
ObjOperatingSystem.Win32Shutdown(LOGOFF)
21+
Next
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
Const EVENT_SUCCESS = 0
2-
Set objShell = Wscript.CreateObject("Wscript.Shell")
3-
objShell.LogEvent EVENT_SUCCESS, "Shutdown via script"
4-
5-
6-
strComputer = "."
7-
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate,(Shutdown)}!\\" & strComputer & "\root\cimv2")
8-
Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
9-
For Each objOperatingSystem in colOperatingSystems
10-
ObjOperatingSystem.Shutdown()
11-
Next
1+
Const EVENT_SUCCESS = 0
2+
Set objShell = Wscript.CreateObject("Wscript.Shell")
3+
objShell.LogEvent EVENT_SUCCESS, "Shutdown via script"
4+
5+
6+
strComputer = "."
7+
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate,(Shutdown)}!\\" & strComputer & "\root\cimv2")
8+
Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
9+
For Each objOperatingSystem in colOperatingSystems
10+
ObjOperatingSystem.Shutdown()
11+
Next
Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
Const EVENT_SUCCESS = 0
2-
Set objShell = Wscript.CreateObject("Wscript.Shell")
3-
objShell.LogEvent EVENT_SUCCESS, "Power-off via script"
4-
5-
6-
Const LOGOFF = 0
7-
Const SHUTDOWN = 1
8-
Const REBOOT = 2
9-
Const POWEROFF = 8
10-
11-
Const LOGOFF_FORCE = 4
12-
Const SHUTDOWN_FORCE = 5
13-
Const REBOOT_FORCE = 6
14-
Const POWEROFF_FORCE = 12
15-
16-
strComputer = "."
17-
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate,(Shutdown)}!\\" & strComputer & "\root\cimv2")
18-
Set colOperatingSystems = objWMIService.ExecQuery ("SELECT * FROM Win32_OperatingSystem")
19-
For Each objOperatingSystem in colOperatingSystems
20-
ObjOperatingSystem.Win32Shutdown(POWEROFF)
21-
Next
1+
Const EVENT_SUCCESS = 0
2+
Set objShell = Wscript.CreateObject("Wscript.Shell")
3+
objShell.LogEvent EVENT_SUCCESS, "Shutdown via script"
4+
5+
6+
Const LOGOFF = 0
7+
Const SHUTDOWN = 1
8+
Const REBOOT = 2
9+
Const POWEROFF = 8
10+
11+
Const LOGOFF_FORCE = 4
12+
Const SHUTDOWN_FORCE = 5
13+
Const REBOOT_FORCE = 6
14+
Const POWEROFF_FORCE = 12
15+
16+
strComputer = "."
17+
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate,(Shutdown)}!\\" & strComputer & "\root\cimv2")
18+
Set colOperatingSystems = objWMIService.ExecQuery ("SELECT * FROM Win32_OperatingSystem")
19+
For Each objOperatingSystem in colOperatingSystems
20+
ObjOperatingSystem.Win32Shutdown(POWEROFF)
21+
Next
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
Const EVENT_SUCCESS = 0
2-
Set objShell = Wscript.CreateObject("Wscript.Shell")
3-
objShell.LogEvent EVENT_SUCCESS, "Shutdown via script"
4-
5-
6-
strComputer = "."
7-
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate,(Shutdown)}!\\" & strComputer & "\root\cimv2")
8-
Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
9-
For Each objOperatingSystem in colOperatingSystems
10-
ObjOperatingSystem.Reboot()
11-
Next
1+
Const EVENT_SUCCESS = 0
2+
Set objShell = Wscript.CreateObject("Wscript.Shell")
3+
objShell.LogEvent EVENT_SUCCESS, "Restart via script"
4+
5+
6+
strComputer = "."
7+
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate,(Shutdown)}!\\" & strComputer & "\root\cimv2")
8+
Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
9+
For Each objOperatingSystem in colOperatingSystems
10+
ObjOperatingSystem.Reboot()
11+
Next
Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
Const EVENT_SUCCESS = 0
2-
Set objShell = Wscript.CreateObject("Wscript.Shell")
3-
objShell.LogEvent EVENT_SUCCESS, "Reboot via script"
4-
5-
6-
Const LOGOFF = 0
7-
Const SHUTDOWN = 1
8-
Const REBOOT = 2
9-
Const POWEROFF = 8
10-
11-
Const LOGOFF_FORCE = 4
12-
Const SHUTDOWN_FORCE = 5
13-
Const REBOOT_FORCE = 6
14-
Const POWEROFF_FORCE = 12
15-
16-
strComputer = "."
17-
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate,(Shutdown)}!\\" & strComputer & "\root\cimv2")
18-
Set colOperatingSystems = objWMIService.ExecQuery ("SELECT * FROM Win32_OperatingSystem")
19-
For Each objOperatingSystem in colOperatingSystems
20-
ObjOperatingSystem.Win32Shutdown(REBOOT)
21-
Next
1+
Const EVENT_SUCCESS = 0
2+
Set objShell = Wscript.CreateObject("Wscript.Shell")
3+
objShell.LogEvent EVENT_SUCCESS, "Restart via script"
4+
5+
6+
Const LOGOFF = 0
7+
Const SHUTDOWN = 1
8+
Const REBOOT = 2
9+
Const POWEROFF = 8
10+
11+
Const LOGOFF_FORCE = 4
12+
Const SHUTDOWN_FORCE = 5
13+
Const REBOOT_FORCE = 6
14+
Const POWEROFF_FORCE = 12
15+
16+
strComputer = "."
17+
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate,(Shutdown)}!\\" & strComputer & "\root\cimv2")
18+
Set colOperatingSystems = objWMIService.ExecQuery ("SELECT * FROM Win32_OperatingSystem")
19+
For Each objOperatingSystem in colOperatingSystems
20+
ObjOperatingSystem.Win32Shutdown(REBOOT)
21+
Next

0 commit comments

Comments
 (0)