Month: October 2011

Identifying Windows Live Messenger Logins

Posted on Updated on

We have implemented Microsoft Lync in our environment and are preparing to “federate” our domain.  When this happens, users whom have set up a Windows Live ID using their company email address, will no longer be able to use Messenger.  I created the following script which will get the login email address from Messenger as well as the last login time then output the information to a text file on a file share.

'==========================================================================
' AUTHOR: Nick Moseley, https://t3chn1ck.wordpress.com
' DATE  : 10/20/2011
'==========================================================================
Option Explicit
Const ForAppending = 8
On Error Resume Next

Dim oShell, oFSO, oUserDir, colSubFolders
Dim strProfileFolder, strAppFolder
Set oShell = CreateObject ("wscript.shell")
Set oFSO = CreateObject ("Scripting.FileSystemObject")

If oFSO.FolderExists ("c:\users") Then
	strProfileFolder = "c:\users"
	strAppFolder = "\AppData\Local\Microsoft\Messenger"
Else
	strProfileFolder = "c:\Documents and Settings"
	strAppFolder = "\Local Settings\Application Data\Microsoft\Messenger"
End If

Set oUserDir = oFSO.GetFolder (strProfileFolder)
Set colSubFolders = oUserDir.SubFolders

' Open log file
Dim sFileName, oLogFile
sFileName = "\\engsvr01\pstlogs\SCCM\" & oshell.ExpandEnvironmentStrings("%COMPUTERNAME%") & ".txt"
If not oFSO.FileExists (sFileName) Then
	oFSO.CreateTextFile sFileName
End If

Set oLogFile = oFSO.OpenTextFile (sFileName, ForAppending, True)
oLogFile.WriteLine "====Started: " & Date & "===="
oLogFile.WriteLine " " 

' For User folders, check for Windows
Dim oFldr, oFldr2, oWLMfolders, colWLMusers, oConfigFile, sFolderPath
For Each oFldr In colSubFolders
	sFolderPath = strProfileFolder & "\" & oFldr.Name & strAppFolder
	
	' if the Messenger folder exists, then do the following
	If oFSO.FolderExists (sFolderPath) Then
		Set oWLMfolders = oFSO.GetFolder (sFolderPath)
		Set colWLMusers = oWLMfolders.SubFolders
		
		' if the subfolders contains the config.cache file, then it was signed into on WLM
		For Each oFldr2 In colWLMusers
			oLogFile.WriteLine "User: " & oFldr.Name 
			oLogFile.WriteLine "Email: " & oFldr2.Name
			
			If oFSO.FileExists (sFolderPath & "\" & oFldr2.Name & "\config.cache.xml") Then
				' Set oConfigFile to get file's timestamp
				Set oConfigFile = oFSO.GetFile (sFolderPath & "\" & oFldr2.Name & "\config.cache.xml")
				'oLogFile.WriteLine "User: " & oFldr.Name 
				'oLogFile.WriteLine "Email: " & oFldr2.Name
				oLogFile.WriteLine "Last signin: " & oConfigFile.DateLastModified
			Else
				oLogFile.WriteLine "Last signin: UNKNOWN" 
			End If
			
			oLogFile.WriteLine " " 
		Next
	End If
Next 

' end logging
oLogFile.WriteLine "====Ended===="
oLogFile.WriteLine " " 
WScript.Quit (oLogFile.Close)

Since not all computers will have used Messenger, let alone a person having logged into Messenger, create a collection that will be limited to just computers that have recently executed “msnmsgr.exe”.  You can use the below query to determine those systems for your collection.

select distinct SMS_R_System.Name
from  SMS_R_System
inner join SMS_G_System_CCM_RECENTLY_USED_APPS
on SMS_G_System_CCM_RECENTLY_USED_APPS.ResourceID = SMS_R_System.ResourceId
where SMS_G_System_CCM_RECENTLY_USED_APPS.ExplorerFileName = "msnmsgr.exe"
order by SMS_R_System.Name

A Hard Lesson on Distribution Points

Posted on Updated on

What appeared to be a very strange and significant issue occurred recently.  On a remote server that only has the DP and SMP roles assigned to it, I removed the SMP role from the server.  Upon completion of the SMP being removed, the entire directory containing the server’s installed SCCM site files (e.g. E:\SMS) was mysteriously deleted.  This directory contained subfolders \bin, \data, \logs, \MP, and \scripts, which all would contain critical operational files.  Or so I thought.

Unfortunately, I reacted in the situation, believing this meant that the DP would no longer be functional, so I took immediate action.  To remedy what I believed to be a problem of a non-functional remote site, I removed the DP and the site system.  Not long afterwards, I readded the site and DP role…but that same installation directory (e.g. E:\SMS) never reappeared.  I came to a dead-end in all of my troubleshooting, research, and questions in various forums; so I contacted Microsoft support.  In a brief conversation with support, they informed me that distribution points do not require any installation files to operate.  And sure enough, as soon as I added a new package to the DP on the remote server, the files showed up. 

To say the least, I’m slightly embarrassed that there was never a problem and everything was as it should have been.  This was a hard learned lesson about DPs; I hope this blog post helps others to prevent the same mistake that I made.

Hotfix for Windows 7 Extremely Slow Boot Performance

Posted on Updated on

When our company first implemented Windows 7, the performance was quite good and we were impressed.  However, now that Win7 has been in our organization for the last 1 1/2 years, we’re beginning to see a significant performance degradation in boot times.  What was a 1 minute boot time can now be anywhere from 4 to 10 minutes for Windows to get to Ctrl-Alt-Del screen.

In performing analysis on extremely slow boot/login times, I identified both the cause and a Win7 hotfix to correct the issue.  If you are having a similar problem, check out KB2505348 – High CPU usage or a lengthy startup process occurs during WMI repository verification when a large WMI repository exists in Windows 7 or in Windows Server 2008 R2.

One has to chuckle at Microsoft’s titled description on the issue as “lengthy startup process” which in the real world means “so slow that you never want ever EVER shut off your computer because every time you do, you consider making a switch to Linux”.

** Update 10/2/12: there is a newer version for Windows 7 SP1 at http://support.microsoft.com/kb/2617858 **