![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| Vista x64 ultimate | Remote logoff shutdown I'm not sure if this is the right place, however I am trying remotely logoff the current user from my vista x64 ultimate machine upstairs to my vista x64 home premium machine downstairs. I can easily restart or shutdown using cmd> shutdown /r /f /p /m \\PC or /s respectively However you cannot use -l with -m so I can only turn the computer off to keep the kids from playing video games all day. I remember in XP you could use the Computer Manager to connect to \\PC(or what ever it happens to be) and then right click to find shutdown properties and a logoff option. This seems to be gone in vista although I can use Computer Manager to connect to \\PC from my upstairs computer \\Nick-PC and see the users on \\PC, but with no logoff option. I have also tried cmd> logoff "session#" /server:"name" logoff 2 /server:\\PC This also did not work even when instead of typing in 1,2,or 3 for whomever was logged on session id using their loggon name logoff nick server:\\PC also did nothing if nick was theoretically the current logged on user. Any ideas for how to logoff the user without having to shutdown or restart the computer? This is more of a annoyance to keep people on task then restarting which waists a lot of time. |
My System Specs![]() |
| | #2 (permalink) |
| Vista x64 ultimate | Re: Remote logoff shutdown Const cLogoff = 0 Const cShutdown = 1 Const cReboot = 2 Const cForceLogoff = 4 Const cForceShutdown = 5 Const cForceReboot = 6 Const cPowerOff = 8 Const cForcePowerOff = 12 strComputer = "PC" Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colOperatingSystems = objWMIService.ExecQuery ("SELECT * FROM Win32_OperatingSystem") For Each objOperatingSystem in colOperatingSystems ObjOperatingSystem.Win32Shutdown(0) Next Seems to work for me it's a little abrupt, but I'm sure I can do more tinkering. I did however have to enable rpc through the vista firewall to make this work. I had no idea what WMI or RPC was before this, ah the powers of Google. |
My System Specs![]() |
| | #3 (permalink) |
| Windows Vista Enterprise x64 SP2 | Re: Remote logoff shutdown You could do it using Computer Management. Open Computer Management on your machine and connect to Bob's computer, then right-click on Bob's computer and select Properties. Switch to the Advanced tab, and click Settings under Startup And Recovery options. Now go to Shutdown and under Action click Log Off Current User and then OK. Of course some things are easier to do using a script: strComputer = "" Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colOperatingSystems = objWMIService.ExecQuery ("SELECT * FROM Win32_OperatingSystem") For Each objOperatingSystem in colOperatingSystems ObjOperatingSystem.Win32Shutdown(0) Next You could do it using Computer Management. Open Computer Management on your machine and connect to Bob's computer, then right-click on Bob's computer and select Properties. Switch to the Advanced tab, and click Settings under Startup And Recovery options. Now go to Shutdown and under Action click Log Off Current User and then OK. Of course some things are easier to do using a script: strComputer = "" Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colOperatingSystems = objWMIService.ExecQuery ("SELECT * FROM Win32_OperatingSystem") For Each objOperatingSystem in colOperatingSystems ObjOperatingSystem.Win32Shutdown(0) Next |
My System Specs![]() |
| | #4 (permalink) |
| Vista x64 ultimate | Re: Remote logoff shutdown That's the exact thing I found on some website, however in vista you cannot use computer management like that stated. The only way to use computer management like that is in xp or similar. The script I posted as my fix is basically that script copied and pasted saved in a .vbs the problem I had though was enabling it to run through the firewall on the target computer which I disabled rpc's block and now it works. on a second note I wonder if you could instead of log off rather switch users so that they don't lose anything. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Set pc to hibernate/shutdown/logoff etc after certain time | General Discussion | |||
| LOGOFF Forces Shutdown & Ree-boot | Vista performance & maintenance | |||
| Detect logoff or shutdown | VB Script | |||
| Shutdown after logoff | Vista General | |||
| save settings on shutdown or logoff | Vista hardware & devices | |||