A quick a dirty script to identify RMS content, and it’s owner.

I wrote this script a while back that shows a quick way to scan all documents in a folder, and see if it is rights protected, then display the file name, and the owner. It's not pretty, but it gets the job done.

I had someone ask me for it, and it took a while to find it so now I'm posting it here. As usual..do some error checking, indenting, and clean-up work. 🙂

strFolder = "C:\RMSTest"  '*** Specify a folder here, or use an InputBox ****
Set fso = CreateObject("Scripting.FileSystemObject")
Set objFolder = fso.GetFolder(strFolder)
Set objFiles = objFolder.Files
For each oFile in objFiles
 Set oStream = oFile.OpenAsTextStream
 Do While Not oStream.AtEndOfStream
  strString = oStream.ReadLine
  imid = instr(1,strString,"<OWNER>")
  ilen = instr(1,strString,"</OWNER>") - instr(1,strString,"<OWNER>")
  If instr(1,strString,"<OWNER>") then
   strString = mid(strString,imid,ilen)
   imid = instr(1,strString,"<NAME>")
   ilen = instr(1,strString,"</NAME>") - instr(1,strString,"<NAME>")
   strOwner = mid(strString,imid,ilen)
   strOwner = right(strOwner,len(strOwner)-6)
   exit Do
   strOwner = "Not RMS Protected"
  End If
Wscript.Echo oFile.Name & ": " & strOwner


Comments (1)

  1. Anonymous says:

    I’m wondering is it possible to create RMS-protected email using VBA?

    Could you please share some samples of doing that?

Skip to main content