How to manage Fast User Switching on Domain joined computers?
As a sysadmin with a lot of PC’s used by multiple users I was very happy to learn that Windows 7 still supports Fast User Switching (FUS), on domain joined computers (as introduced in Vista). So I set out on a search on how to manage this in a domain, because obviously when we enable this users will start switching between accounts without ever logging off. And with roaming profiles and limited resources on a PC, I can see a lot of problems occurring. I was surprised to find absolutely nothing about this subject. Nothing on Technet or on these Forums. No white papers. Nothing at all. What I expected was options like: Disconnect idle sessions after xx minutes, Terminate disconnected session after xx minutes, as available on Terminal server (or Remote Desktop Services as it is called today). And an option to limit the number of sessions on a computer. So my question is: Am I bad at searching or is Microsoft bad at giving us management options for FUS?Windows 7 rulez!
March 5th, 2010 4:09pm

Hello,I think you can only disable Fast User Switching to prevent the profiles from be corrupted.Thomas77
Free Windows Admin Tool Kit Click here and download it now
March 8th, 2010 4:39am

I know, FUS can be disabled but that is not what I am looking for. We want to use FUS, because it is a perfect solution, but we also want to be able to manage it Windows 7 rulez!
March 11th, 2010 7:32am

Ok, well just to give everyone an update:I discovered that Windows 7 has a command called query.exe. It wil give information about who is logged on to the PC, which session is active and how long not active sessions have been idle.With the that in mind, I wrote a script which is scheduled every 5 minutes on the Windows 7 PC. It checkes the idle time of the sessions and if above a certain numer of minutes will logoff the these sessions.If anyone is interrested in this script, just let me know. Windows 7 rulez!
Free Windows Admin Tool Kit Click here and download it now
March 15th, 2010 4:57am

Hi Joop Do you mind sending me the script. I am desperately looking for a option to get this done. Regards Nick
August 6th, 2010 4:30am

Nick, See the script below. ' Fast User Switching (FUS) Logoff on Idle On Error Resume Next ' -------------------- ' Constanten aanmaken: ' -------------------- Const OVERWRITE = 1 Const HIDDEN = 0 Const MINIMIZED = 1 Const WAITONRETURN = True Const ForReading = 1 Const EVENT_ERROR = 1 Const EVENT_WARNING = 2 Const EVENT_INFORMATION = 4 ' ------------------ ' Objecten aanmaken: ' ------------------ Dim ObjShell, ObjFile, strSystemRoot, Disconnected Dim result, FusLog, strFusLine, PosState, IdleTime, Id, User Set ObjShell = createobject("wscript.shell") Set ObjFile = createobject("scripting.filesystemobject") Set ObjEnv = ObjShell.Environment("PROCESS") strSystemRoot = ObjEnv("SystemRoot") 'C:\Windows If Language = "1043" Then Disconnected = "Verbroken" If Language = "1033" Then Disconnected = "Disc" 'Run query.exe ObjShell.Run "cmd /c query.exe user > c:\windows\temp\WZA-FUS.txt", HIDDEN, WAITONRETURN Set FusLog = ObjFile.OpenTextFile(strSystemRoot & "\temp\WZA-FUS.txt",ForReading) FusLog.ReadLine ' Skip Headers Do Until FusLog.AtEndOfLine strFusLine = FusLog.ReadLine PosState = Instr(strFusLine, Disconnected) If PosState <> 0 Then User = Trim(Left(strFusLine,22)) IdleTime = Trim(Mid(strFusLine, PosState+Len(Disconnected)+8 ,5)) Id = Trim(Mid(strFusLine, PosState-3 ,2)) 'Wscript.Echo User & " - " & Id & " - " & IdleTime If IdleTime <> "." Then If cInt(MaakMinuten(IdleTime)) > 60 Then UserLogoff(Id) End If End If Loop WScript.Quit Sub UserLogoff(Id) ObjShell.Run "cmd /c logoff " & Id, HIDDEN, WAITONRETURN WriteEvent EVENT_INFORMATION, "Gebruiker:" & User & " afgemeld na " & IdleTime & " minuten idle" End Sub '========================================================================== ' Name: WriteEvent ' Purpose: Writes an WSH entry to the Application eventlog ' Input: Type of event as integer message as string ' Return: None ' Calls: None '========================================================================== Function WriteEvent(eventtype, message) Dim objWshShell Set objWshShell = CreateObject("Wscript.Shell") If (eventtype = EVENT_ERROR) Or _ (eventtype = EVENT_WARNING) Or _ (eventtype = EVENT_INFORMATION) Then objWshShell.LogEvent eventtype, Left(message, 32717) Else objWshShell.LogEvent EVENT_ERROR, "Unknown event type parsed!" End If Set objWshShell = Nothing End Function Function MaakMinuten(hhmm) If Instr(hhmm, ":") <> 0 Then m = DatePart("n",hhmm) h = DatePart("h",hhmm) MaakMinuten = (60 * h) + m Else MaakMinuten = hhmm End If End Function Function Language Dim sComputer sComputer = "." Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & sComputer & "\root\cimv2") Set colOperatingSystems = oWMI.ExecQuery("Select * from Win32_OperatingSystem") For Each oOS in colOperatingSystems iOSLang = oOS.OSLanguage Next Language = iOSLang End Function Windows 7 rulez!
Free Windows Admin Tool Kit Click here and download it now
August 6th, 2010 4:39am

Now this look more of a visual basic script right?
August 6th, 2010 4:48pm

Now this look more of a visual basic script right? That's right.Windows 7 rulez!
Free Windows Admin Tool Kit Click here and download it now
August 7th, 2010 4:08am

I having this issue on line 105 character 1. It says it is an unexpected 'end'. For the error code it say 800A03F6. Can you help at all? I am not a Visual Basic type of guy.
August 9th, 2010 10:15am

You probably forgot to copy something at the end of the script. First Line is ' Fast User Switching (FUS) Logoff on Idle (don't forget to copy the the single quote!) Last line is End Function Fot the rest your on your own.Windows 7 rulez!
Free Windows Admin Tool Kit Click here and download it now
August 9th, 2010 10:24am

For those wishing to use a batch file, this has worked for me: @echo off For /f "tokens=1-7 delims=,: " %%a in ('query user ^| find "Disc"') do logoff %%b For /f "tokens=1-7 delims=,: " %%a in ('query user ^| find "Active"') do logoff %%c notes: this has to be in a cmd or bat file for the syntax to work as-is. This first logs off all the users that are 'disconnected' - i.e., with fast user switching turned on, users can be left logged in but will be 'disconnected' Then it logs off the active user. Also, it needs to run as admin (obviously.)
August 1st, 2012 5:58pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics