i’m looking for action script/ command that logs off the user immediately.
I tried
dos shutdown /l /f
But that doesn’t work.
I’ve found this on the forum:
override wait
runas=currentuser
wait logoff
but my actions has failed then.
The full script:
if {not exists members whose ( it as string contains name of current user) of local group "Administrators"}
dos net localgroup Administrators {name of current user} /ADD
I takes too long to do it… Is there a quicker way? I’ve send the action at 8:39 and at 10:01 it finished it. The computer was showing online in IBM and had a last report time after 8:39…
I need something that does it immediately. Any idea perhaps?
I found a vbs online a while back that we use and it is fairly instantaneous. However, we only push and run it from BF, it is not a BF utility or anything. PM me if you would like it. Thank you
@AlanM provided an alternate solution to this issue HERE.
override wait
runas=currentuser
wait logoff {session id of current user}
Alan explains it better, but apparently, because of how the BES Client executes the code as the Current User, it is still spawned in a new session, so the user isn’t logged off unless the users Session ID is used to log them off.
You could just paste the contents of the VBS file into a forum post.
You can keep the forum from messing it up by selecting it all and then clicking the </> button.
Either way if you just paste it in and save it, I can fix it.
@TimRice : That is very interesting about permissions but separate console from @AlanM 's post. Definitely makes sense, but I can see how it could cause issues as well.
I’ve answered on the original post from AlanM, so if you’re interested and if you want to share your knowledge (please, it would help me a lot ), please answer on the original post. Thanks!
You should have added that message here instead of there. @AlanM was already mentioned in this thread so he would see it. Now you have confusingly split up the thread.
' Logoff current user on any WMI enabled computer on the network
' Check command line parameters
Select Case WScript.Arguments.Count
Case 0
' Default is local computer if none specified
strComputer = "."
Case 1
Select Case WScript.Arguments(0)
' "?", "-?" or "/?" invoke online help
Case "?"
Syntax
Case "-?"
Syntax
Case "/?"
Syntax
Case Else
strComputer = WScript.Arguments(0)
End Select
Case Else
' More than 1 argument is not allowed
Syntax
End Select
' Define some constants that can be used in this script;
' logoff = 0 (no forced close of applications) or 5 (forced);
' 5 works OK in Windows 2000, but may result in power off in XP
Const EWX_LOGOFF = 0
Const EWX_SHUTDOWN = 1
Const EWX_REBOOT = 2
Const EWX_FORCE = 4
Const EWX_POWEROFF = 8
' Connect to computer
Set OpSysSet = GetObject("winmgmts:{(Shutdown)}//" & strComputer & "/root/cimv2").ExecQuery _
("select * from Win32_OperatingSystem where Primary=true")
' Actual logoff
for each OpSys in OpSysSet
OpSys.Win32Shutdown EWX_LOGOFF
next
' Done
WScript.Quit(0)
Sub Syntax
msg = vbCrLf & "Logoff.vbs, Version 1.00" & vbCrLf & _
"Logoff the current user of any WMI enabled computer on the network." & _
vbCrLf & vbCrLf & "Usage: CSCRIPT LOGOFF.VBS [ computer_name ]" & _
vbCrLf & vbCrLf & _
"Where: " & Chr(34) & "computer_name" & Chr(34) & _
" is the name of the computer to be logged off" & vbCrLf & _
" (without leading backslashes); default is " & _
Chr(34) & "." & Chr(34) & vbCrLf & _
" (the local computer)." & vbCrLf & vbCrLf & _
"Written by Rob van der Woude" & vbCrLf & _
"http://www.robvanderwoude.com" & vbCrLf & vbCrLf & _
"Based on posts by Alex Angelopoulos on www.developersdex.com" & _
vbCrLf & _
"and Michael Harris on microsoft.public.scripting.vbscript" & vbCrLf
Wscript.Echo(msg)
Wscript.Quit(1)
End Sub
I adjusted your post a bit to put the code in a preformatted text block. If you edit your post you will see that every line of the code was just indented by 4 spaces which is what tells the forum software to treat the code this way. I just selected all of the text and clicked the </> button in the toolbar. (6th one over)