Managed Desktop Wallpaper Idea
I had an idea while I was walking to the hospital to get a diet coke that I need to get down here...
The idea is to create a web handler (.ashx) that you would set as the active desktop wallpaper on the desktop of your systems that you manage. The handler would use windows integrated authentication to obtain a WindowsPrincipal for the logged in user. The logged in user has rights to browse the WMI classes on their own box, so this should work okay. As long as the user is logged on to the domain, and the web server is on the domain, this would work. The handler would use the Request.ServerVariables to get the IP number of the requesting box, then formulate a WMI query to go out and grab the WMI classes that you want from the user's box. It uses impersonation (as them) to do this. Then you'd go and build a JPEG or PNG out of the pieces of the WMI classes you fetched to display stats about the box to the user. This would be a way to make customized wallpaper showing the system's NetBIOS name, the logged in user name, or other stuff to the user on each system. Once you built the image, you'd base 64 encode it and spit it out to the "browser."
Here is some junky proof-of-concept code that the impersonation doesn't really work on yet...
The idea is to create a web handler (.ashx) that you would set as the active desktop wallpaper on the desktop of your systems that you manage. The handler would use windows integrated authentication to obtain a WindowsPrincipal for the logged in user. The logged in user has rights to browse the WMI classes on their own box, so this should work okay. As long as the user is logged on to the domain, and the web server is on the domain, this would work. The handler would use the Request.ServerVariables to get the IP number of the requesting box, then formulate a WMI query to go out and grab the WMI classes that you want from the user's box. It uses impersonation (as them) to do this. Then you'd go and build a JPEG or PNG out of the pieces of the WMI classes you fetched to display stats about the box to the user. This would be a way to make customized wallpaper showing the system's NetBIOS name, the logged in user name, or other stuff to the user on each system. Once you built the image, you'd base 64 encode it and spit it out to the "browser."
Here is some junky proof-of-concept code that the impersonation doesn't really work on yet...
string ipnum = Request.ServerVariables("REMOTE_ADDR"); ConnectionOptions conn = new ConnectionOptions(); conn.Impersonation = ImpersonationLevel.Impersonate; ManagementPath mp = new ManagementPath("\\\\" + ipnum + "\\root\\cimv2"); ManagementScope ms = new ManagementScope(mp, conn); ObjectQuery wmquery = new ObjectQuery("select * from Win32_OperatingSystem"); ManagementObjectSearcher searcher = new ManagementObjectSearcher(ms,wmquery); ManagementObjectCollection rc = searcher.Get(); foreach (ManagementObject mo in rc) { //build an image based on the info in the result and then return it... string infostring = "OS:" + mo["Caption"].ToString(); //etc... stuff to build the image }

0 Comments:
Post a Comment
<< Home