Translate this site using Windows Live Translator:
How to tell *who* is using RMS in your environment quickly. - RMS: Protecting Your Assets. - Site Home - TechNet Blogs
Sign in
RMS: Protecting Your Assets.
The Protecting 'My' Asset Disclaimer: This is my 'un-official', 'in my spare time', 'use at your own risk', all things RMS (Rights Management Services), IRM (Information Rights Management), IPP (Information Protection Pla
Options
Blog Home
Share this
RSS for posts
Atom
RSS for comments
Search Blogs
Tags
ad rms
ad rns
adrms
adrns
Backup
Certificate
cname
Database
Disaster
DNS
http 500
ie7
IIS
ipp
irm
MSDRM
MSIPC
rights management
rights management services
rms
RMS 2008
RMS v1
RMS V2
SQL
wiki
Archive
Archives
June 2013
(1)
January 2013
(1)
September 2012
(1)
August 2012
(2)
July 2012
(1)
June 2012
(2)
May 2012
(6)
February 2012
(1)
November 2011
(2)
October 2011
(2)
September 2011
(1)
August 2011
(3)
April 2011
(1)
November 2010
(1)
October 2010
(1)
September 2010
(1)
June 2010
(1)
May 2010
(1)
April 2010
(1)
March 2010
(1)
February 2010
(1)
January 2010
(1)
December 2009
(4)
November 2009
(1)
October 2009
(4)
June 2009
(1)
May 2009
(6)
April 2009
(1)
March 2009
(2)
February 2009
(4)
January 2009
(3)
December 2008
(6)
November 2008
(1)
October 2008
(1)
September 2008
(3)
June 2008
(1)
May 2008
(1)
April 2008
(1)
March 2008
(3)
February 2008
(3)
January 2008
(1)
December 2007
(4)
November 2007
(2)
October 2007
(3)
September 2007
(4)
August 2007
(2)
July 2007
(3)
June 2007
(4)
May 2007
(5)
January 2007
(4)
December 2006
(13)
November 2006
(1)
How to tell *who* is using RMS in your environment quickly.
TechNet Blogs
>
RMS: Protecting Your Assets.
>
How to tell *who* is using RMS in your environment quickly.
How to tell *who* is using RMS in your environment quickly.
Jason Tyler
31 Dec 2007 9:32 AM
Comments
3
I've had several customers ask me for a quick way to get a list of all of the users that are using RMS. The admin UI, will tell you how many people are, but not 'who' is using it.
Here is a vbscript I wrote that should tell you (assuming you have access to the RMS SQL server, locally, or remotely)
Due to my severe laziness the error trapping isn't that great...but I really just needed a quick sample to use as a model, and usually let my customers do the heavy error trapping in their own apps. This way I can truly say "Use at your own risk"...which I am also saying to you. ;)
Enjoy!
-Jason
'+++++++++++++++++++++++++++++++++++++++++++++++++++
' rmsusers.vbs - A simple script to match up the SDDL sids in the RMS
' dbase to user accounts
'+++++++++++++++++++++++++++++++++++++++++++++++++++
Option Explicit
Dim strComputer, strRoot, strDbase, strSQL, strConn
Dim objRoot
Dim conn,ldpconn
Dim rs,rsUser
Dim objArgs
Set objArgs = Wscript.Arguments
If objArgs.Count = 0 Then
ShowUsage
Wscript.Quit
End if
If lcase(objArgs(0)) = "internal" Then
strComputer = "np:\\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query"
Else
strComputer = objArgs(0)
End If
Set objRoot = GetObject("
LDAP://RootDSE
")
strRoot = objRoot.Get("defaultnamingcontext")
Set objRoot = Nothing
Set conn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.RecordSet")
With rs
.CursorLocation=3
.CursorType=0
End With
With conn
strDbase = "master"
GetConn()
.open strConn
strSQL = "Select Name From SysDatabases Where" & _
" Name like 'DRMS_Config%'"
rs.Open strSQL,conn
End With
If rs.RecordCount > 0 Then
strDbase = rs.Fields("name").Value
Wscript.Echo "++++Found Database:" & strDbase & ".++++" & vbcrlf & vbcrlf
rs.close
conn.close
strSQL = "Select s_Sid from UD_WindowsAuthIdentities"
GetConn()
conn.open strConn
rs.open strSQL,conn
If rs.RecordCount > 0 Then
Wscript.Echo "There were " & rs.RecordCount & " users found."
Do until rs.EOF
ResolveName(rs.Fields("s_Sid").Value)
rs.MoveNext
Loop
Else
Wscript.Echo "No users found in UD_WindowsAuthIdentities Table"
Cleanup
Wscript.Quit
End If
Else
Wcript.Echo "Could not find RMS Configuration Dbase"
CleanUp
Wscript.Quit
End if
'**********************************************************
'GetConn - Probably not needed. I thought I'd be making more connections
'**********************************************************
Sub GetConn()
strConn = "Provider=SQLOLEDB;Data Source=" & strComputer & ";" & _
"Trusted_Connection=Yes;Initial Catalog=" & strDbase
End Sub
'**********************************************************
'Resolve Name - Will spit out the user names based on SDDL sid
'**********************************************************
Sub ResolveName (strSID)
Set ldpconn = CreateObject("ADODB.Connection")
With ldpconn
.Provider = "ADSDSOObject"
.Open "ADSProvider"
strSQL = "<GC://" & strRoot & ">;(&(objectclass=user)(objectSID=" & strSID &"));name,mail;subtree"
Set rsUser = .Execute(strSQL)
If rsUser.RecordCount > 0 Then
Wscript.Echo "**-" & rsUser.Fields("name").Value & _
"-" & rsUser.Fields("mail").Value
Else
Wscript.Echo "Unresolved: " & strSID
End If
rsUser.Close
ldpconn.Close
Set rsuser = nothing
Set ldpconn = nothing
End with
End Sub
'*************************************
'CleanUp - If we bail - try to clean up
'*************************************
Sub CleanUp
rs.close
set rs = Nothing
conn.close
set conn=nothing
End Sub
'*************************************
'ShowUsage - How to use the script
'*************************************
Sub ShowUsage
Wscript.Echo "Usage:>cscript rmsusers.vbs rms_sql_server"
Wscript.Echo "Usage:>cscript rmsuser.vbs rms_sql_server\instance"
Wscript.Echo "Usage:>cscript rmsuser.vbs internal"
End Sub
3 Comments
Comments
Comments
Loading...
Leave a Comment
Name
Comment
Please add 8 and 2 and type the answer here:
Post