Drive and Directory search – Lotus Notes

10 pts.
Tags:
.NSF files
Lotus
Lotus Notes 7.0.3
Lotus Notes directories
LotusScript
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

Thanks. We'll let you know when a new response is added.

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 & “\root\CIMV2″)
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*********************************

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following