File tree Expand file tree Collapse file tree 5 files changed +85
-85
lines changed
Expand file tree Collapse file tree 5 files changed +85
-85
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments