Discussion:
script to log off users from server
(too old to reply)
Sue
2009-03-29 03:30:09 UTC
Permalink
hello. Also thankyou Pegasus for your last script.
I need a script to log off users from my SBS 2003 server. I have told them
they have to do it, but sometimes they forget.
A little info about the server
users folders are redirected to the server.
Sue
2009-03-29 05:33:35 UTC
Permalink
I found psshutdown.exe and the command, just wondering if there is another
way.
Post by Sue
hello. Also thankyou Pegasus for your last script.
I need a script to log off users from my SBS 2003 server. I have told them
they have to do it, but sometimes they forget.
A little info about the server
users folders are redirected to the server.
Pegasus [MVP]
2009-03-29 07:01:54 UTC
Permalink
Post by Sue
hello. Also thankyou Pegasus for your last script.
I need a script to log off users from my SBS 2003 server. I have told them
they have to do it, but sometimes they forget.
A little info about the server
users folders are redirected to the server.
Have a look at the native shutdown.exe command.
Lanwench [MVP - Exchange]
2009-03-29 15:28:13 UTC
Permalink
Post by Pegasus [MVP]
Post by Sue
hello. Also thankyou Pegasus for your last script.
I need a script to log off users from my SBS 2003 server. I have
told them they have to do it, but sometimes they forget.
A little info about the server
users folders are redirected to the server.
Have a look at the native shutdown.exe command.
...but note that if users have open files, they'll lose changes.
As a wise man said, "There are seldom good technological solutions to
behavioral problems."
Pegasus [MVP]
2009-03-29 17:31:48 UTC
Permalink
"Lanwench [MVP - Exchange]"
Post by Lanwench [MVP - Exchange]
Post by Pegasus [MVP]
Post by Sue
hello. Also thankyou Pegasus for your last script.
I need a script to log off users from my SBS 2003 server. I have
told them they have to do it, but sometimes they forget.
A little info about the server
users folders are redirected to the server.
Have a look at the native shutdown.exe command.
...but note that if users have open files, they'll lose changes.
As a wise man said, "There are seldom good technological solutions to
behavioral problems."
Well said . . . but are you sure it wasn't a wise woman who said it? :-)
Al Dunbar
2009-03-29 21:17:40 UTC
Permalink
Post by Pegasus [MVP]
"Lanwench [MVP - Exchange]"
Post by Lanwench [MVP - Exchange]
Post by Pegasus [MVP]
Post by Sue
hello. Also thankyou Pegasus for your last script.
I need a script to log off users from my SBS 2003 server. I have
told them they have to do it, but sometimes they forget.
A little info about the server
users folders are redirected to the server.
Have a look at the native shutdown.exe command.
...but note that if users have open files, they'll lose changes.
As a wise man said, "There are seldom good technological solutions to
behavioral problems."
Well said . . . but are you sure it wasn't a wise woman who said it? :-)
ROFLOL!

/Al

PS: not funny because one might think that a "wise woman" was an oxymoron,
but because one wise woman (or wise wench, as it were) neglected to make
such an insightful point herself!
Lanwench [MVP - Exchange]
2009-03-30 00:53:13 UTC
Permalink
Post by Al Dunbar
Post by Pegasus [MVP]
"Lanwench [MVP - Exchange]"
Post by Lanwench [MVP - Exchange]
Post by Pegasus [MVP]
Post by Sue
hello. Also thankyou Pegasus for your last script.
I need a script to log off users from my SBS 2003 server. I have
told them they have to do it, but sometimes they forget.
A little info about the server
users folders are redirected to the server.
Have a look at the native shutdown.exe command.
...but note that if users have open files, they'll lose changes.
As a wise man said, "There are seldom good technological solutions
to behavioral problems."
Well said . . . but are you sure it wasn't a wise woman who said it? :-)
ROFLOL!
/Al
PS: not funny because one might think that a "wise woman" was an
oxymoron, but because one wise woman (or wise wench, as it were)
neglected to make such an insightful point herself!
Ptui. I'm just an idiot who can google real fast. ;-)
Lanwench [MVP - Exchange]
2009-03-30 00:52:48 UTC
Permalink
Post by Pegasus [MVP]
"Lanwench [MVP - Exchange]"
Post by Lanwench [MVP - Exchange]
Post by Pegasus [MVP]
Post by Sue
hello. Also thankyou Pegasus for your last script.
I need a script to log off users from my SBS 2003 server. I have
told them they have to do it, but sometimes they forget.
A little info about the server
users folders are redirected to the server.
Have a look at the native shutdown.exe command.
...but note that if users have open files, they'll lose changes.
As a wise man said, "There are seldom good technological solutions to
behavioral problems."
Well said . . . but are you sure it wasn't a wise woman who said it? :-)
Nope. It was the inimitable Mr. Ed Crowley of fame, myth and lore.
Revenger
2009-03-31 12:31:59 UTC
Permalink
Post by Sue
hello. Also thankyou Pegasus for your last script.
I need a script to log off users from my SBS 2003 server. I have told them
they have to do it, but sometimes they forget.
A little info about the server
users folders are redirected to the server.
Try this batch file ... I wrote it for a coleague of mine who had to
disconnect RDP sessions to make a backup:

echo off
FOR /F "usebackq delims== " %%i IN (`"query session | find "rdp-tcp#""`) DO
logoff %%i

You have to run this from the console session ... It will disconnect all
users except the one where the script is running from.
--
Pozdrav

Jednom su izmislili papir po imenu Chuck Norris, ali papir nije dopuštao da
itko sere po njemu !
Sue
2009-04-02 06:15:16 UTC
Permalink
I don't think that last script would work, becuase the users are going in
from the lan, not remote.
Post by Revenger
Post by Sue
hello. Also thankyou Pegasus for your last script.
I need a script to log off users from my SBS 2003 server. I have told them
they have to do it, but sometimes they forget.
A little info about the server
users folders are redirected to the server.
Try this batch file ... I wrote it for a coleague of mine who had to
echo off
FOR /F "usebackq delims== " %%i IN (`"query session | find "rdp-tcp#""`) DO
logoff %%i
You have to run this from the console session ... It will disconnect all
users except the one where the script is running from.
--
Pozdrav
Jednom su izmislili papir po imenu Chuck Norris, ali papir nije dopu¹tao
da
itko sere po njemu !
Revenger
2009-04-02 13:49:50 UTC
Permalink
Post by Sue
I don't think that last script would work, becuase the users are going in
from the lan, not remote.
You mean via file sharing?
If that is the case, try using net session with the script I sent ...

The command goes something like this: NET SESSION \\Computername /DELETE
--
Pozdrav

Jednom su izmislili papir po imenu Chuck Norris, ali papir nije dopuštao da
itko sere po njemu !
Sue
2009-04-02 20:10:06 UTC
Permalink
Will try it thankyou.
Post by Revenger
Post by Sue
I don't think that last script would work, becuase the users are going in
from the lan, not remote.
You mean via file sharing?
If that is the case, try using net session with the script I sent ...
The command goes something like this: NET SESSION \\Computername /DELETE
--
Pozdrav
Jednom su izmislili papir po imenu Chuck Norris, ali papir nije dopu¹tao
da
itko sere po njemu !
Mark D. MacLachlan
2009-07-01 03:40:11 UTC
Permalink
Post by Sue
I don't think that last script would work, becuase the users are
Post by Revenger
Post by Sue
hello. Also thankyou Pegasus for your last script.
I need a script to log off users from my SBS 2003 server. I have
told them they have to do it, but sometimes they forget.
A little info about the server
users folders are redirected to the server.
Try this batch file ... I wrote it for a coleague of mine who had to
echo off
FOR /F "usebackq delims== " %%i IN (`"query session | find
"rdp-tcp#""`) DO logoff %%i
You have to run this from the console session ... It will
disconnect all users except the one where the script is running
from.
-- Pozdrav
Jednom su izmislili papir po imenu Chuck Norris, ali papir nije
dopu9tao da itko sere po njemu !
You could give my script a try:
[code]
'=======================================================================
===
' ForceLogoff.vbs
' By Mark MacLachlan, The Spider's Parlor
' Usage- Double click and enter a machine name or IP address to force
logoff
'
' This code is Copyright (c) 2006 The Spider's Parlor.
'
' All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
' ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED To
' THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
' PARTICULAR PURPOSE.'
'
' IN NO EVENT SHALL THE SPIDER'S PARLOR AND/OR ITS RESPECTIVE
SUPPLIERS BE
' LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
' DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
' WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
' ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
' OF THIS CODE OR INFORMATION.
'
' COMMENT: Note that this script will wait for user input if a password
protected
' screen saver is enabled.
'
'=======================================================================
===
On Error Resume Next
Const FORCE = 4
mname = InputBox("Enter Machine Name", "Force Logoff of Machine")
If Len(mname) = 0 Then Wscript.Quit

if Msgbox("Are you sure you want to force logoff on machine " & mname,
vbYesNo, "Force Logoff of Machine") = vbYes then

Set OpSysSet =
GetObject("winmgmts:{impersonationLevel=impersonate,(RemoteShutdown)}//"
& mname).ExecQuery("select * from Win32_OperatingSystem where
Primary=true")
for each OpSys in OpSysSet
OpSys.Win32Shutdown FORCE
next
end If

[/code]

--

Loading...