Unlocking a computer with Administrator
I work at the IT department at a business and recently we upgraded some of the computer to windows 7. For safety reasons, the computers must be Locked when they are inactive for 30 minutes. We also don't want to have fast switch user enable. Now on XP, the Administrator could unlock the computer. Is there a way to get that option on Windows 7 ? Thanks, Andre
February 9th, 2011 12:50pm

We have the same situation. To avoid problems with roaming profiles, we disabled FUS(Fast user switching). To unlock a locked PC, we imlemented a wmi-call Win32Shutdown(4) in c# in our Admin-App and use this to unlock the pc from an admin-workstation. Greetings, Th0u
Free Windows Admin Tool Kit Click here and download it now
February 10th, 2011 5:48am

Thanks for your reply. Which Admin-App do you use ? Do you want to share the code if that's not too much to ask ? Thanks again, Andre
February 10th, 2011 4:27pm

Hello Andre, the app is selfcoded. For the logoff, you can use basically the scripts provided here http://msdn.microsoft.com/en-us/library/aa394058(v=vs.85).aspx or this c#-code-snipped private void RemoteWin32Shutdown(string host, int Flags) { ManagementBaseObject inParams, outParams; int result; ManagementScope scope = new ManagementScope("\\\\" + host + "\\root\\cimv2"); scope.Options.EnablePrivileges = true; try { scope.Connect(); ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_OperatingSystem"); ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query); ManagementObjectCollection queryCollection = searcher.Get(); foreach (ManagementObject obj in queryCollection) { inParams = obj.GetMethodParameters("Win32Shutdown"); inParams["Flags"] = (int)Flags; inParams["Reserved"] = 0; outParams = obj.InvokeMethod("Win32Shutdown", inParams, null); result = Convert.ToInt32(outParams["returnValue"]); } } catch (Exception e) { MessageBox.Show("WMI-Error" + e.Message); } }
Free Windows Admin Tool Kit Click here and download it now
February 14th, 2011 10:17am

Thanks. I ended up using Powershell. Here's what I'm using: (Get-WmiObject -Class Win32_OperatingSystem -ComputerName xxx.xxx.xxx.xx).InvokeMethod("Win32Shutdown",0) Thanks anyway, I will try using the app.
February 14th, 2011 11:06am

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

Other recent topics Other recent topics