作成 2010.01.08
更新 2010.01.08
更新 2010.01.08
VBScript でログオフするサンプル
このサンプルを実行するとログオフします。
Option Explicit
Dim ret, objSystemSet, objSystem
ret = MsgBox ("ログオフしますか?", 1 ,"Windowsのログオフ")
If ret = 1 Then
Set objSystemSet = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}").InstancesOf("Win32_OperatingSystem")
For Each objSystem In objSystemSet
objSystem.Win32Shutdown 0
Next
End If
参考