10 pts.
 Drive and Directory search – Lotus Notes
I need to know how to find all of the hard drives on a PC, determine if they are local or network.  Then I need to be able to search all folder levels of each drive for .nsf files.  Does anyone know the best way to do this?

Software/Hardware used:
Windows - Lotus Notes 7.0.3
ASKED: June 15, 2010  9:24 PM
UPDATED: June 22, 2010  10:14 PM

Answer Wiki:
You are in luck, I had to do this when we went from Exchange to Notes. Copy to a notepad file and save as a VBS Add to your login script, so it runs when they sign in. FYI: systems will run slow, as a full scan is taking place. Result of the scan is emailed to you, so create a mail rule to drop them into a folder. You will need to update the IP information and the SMTP name If you don't VBScript, have another person review it. Run script at your own risk, provided AS IS. Always run on a test box before testing on live systems. On Error Resume next Set fso = CreateObject("Scripting.FileSystemObject") Set objComputer = CreateObject("Shell.LocalMachine") strComputer = "." Set objWMIService = GetObject("winmgmts:" & strComputer & "rootCIMV2") Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_LogicalDisk",,48) Set IPConfigSet = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE") 'Check for logfile on remote system Check4File 'Check to see if this is an internal Address CheckIP 'loop through Drives and scan for PST files when description is Local Fisked Disk For Each objItem in colItems If objItem.Description ="Local Fixed Disk" Then objStartFolder= objItem.DeviceID&"" Set objFolder = FSO.GetFolder(objStartFolder) Set colFiles = objFolder.Files For Each objFile in colFiles If UCASE(Right(objFile.Name,4)) = UCase(".nsf") Then fileinfo = objStartFolder&objFile.Name & " " & objfile.Size UpdateLogFile(fileinfo) End if Next ShowSubfolders FSO.GetFolder(objStartFolder) End If Next 'Create Check File to idwentify that script completed CreateCheckFile 'Email Results EmailFiles objComputer.MachineName,"C:"&objComputer.MachineName&".log" WScript.Sleep 5000 'Delete Copied Files DeleteFiles 'Clear Memory ClearMemory 'Quit WScript.Quit '***************************************Start Sub and Function Processes******************************** Sub Check4File If Not FSO.FileExists("C:"&objComputer.MachineName&".log") Then FSO.CreateTextFile("C:"&objComputer.MachineName&".log") else ClearMemory WScript.Quit End If End Sub Sub CheckIP Internal = "No" For Each IPConfig in IPConfigSet If Not IsNull(IPConfig.IPAddress) Then For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress) If InStr(IPConfig.IPAddress(i),"xx.x") Or InStr(IPConfig.IPAddress(i),"xx.x") Or InStr(IPConfig.IPAddress(i),"xx.x") Then Internal = "Yes" End if Next End If Next If Internal = "No" Then If Not FSO.FileExists("C:OffNetwork.log") Then FSO.CreateTextFile("C:OffNetwork.log") End If ClearMemory WScript.Quit End if End Sub Sub UpdateLogFile(Path) Set logfile = FSO.OpenTextFile("C:"&objComputer.MachineName&".log",8) logfile.WriteLine Path&vbCrLf logfile.Close End Sub Sub ShowSubFolders(Folder) For Each Subfolder in Folder.SubFolders Set objFolder = FSO.GetFolder(Subfolder.Path) Set colFiles = objFolder.Files For Each objFile in colFiles If UCASE(Right(objFile.Name,4)) = UCase(".pst") Then fileinfo=Subfolder.Path&""&objFile.Name & " " & objfile.Size UpdateLogFile(fileinfo) End if Next ShowSubFolders Subfolder Next End Sub Sub CreateCheckFile FSO.CreateTextFile("C:PSTTask.log") End Sub Sub Emailfiles(System,Attachme) Set objEmail = CreateObject("CDO.Message") objEmail.From = "email@" objEmail.To = "email@" objEmail.Subject = "PSTScan File" objEmail.Textbody = "Here is the file attachment for "& System objEmail.AddAttachment Attachme objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "emailserver" objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 objEmail.Configuration.Fields.Update objEmail.Send End Sub Sub DeleteFiles fso.DeleteFile("C:"&objComputer.MachineName&".log") FSO.DeleteFile("C:PSTScan.vbs") End Sub Sub ClearMemory Set fso = Nothing Set objComputer =Nothing Set objWMIService = Nothing Set colItems = Nothing Set objFolder = Nothing Set colFiles = Nothing Set logfile = Nothing End Sub '****************************************End Sub and Function Processes*********************************
Last Wiki Answer Submitted:  June 22, 2010  10:14 pm  by  Justty   415 pts.
All Answer Wiki Contributors:  Justty   415 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _