Compartilhar via


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
  Else
   strOwner = "Not RMS Protected"
  End If
 Loop
Wscript.Echo oFile.Name & ": " & strOwner
Next

-Jason

Comments

  • Anonymous
    January 01, 2003
    I'm wondering is it possible to create RMS-protected email using VBA? Could you please share some samples of doing that?