Running the “publish” and “stats” Commands for SiteMinder on Windows 2008 r2

Posted on

Recently I wanted to run the SiteMinder “publish” and “stats” commands to export the details of the current Policy Server statistics.  The commands have the format:

  • smpolicysrv -publish <name of XML file>
  • smpolicysrv -stats

where <name of XML file> is the file where you want to export the Policy Server statistics.

The publish command kicks out the following data:

  • Policy Servers
  • Policy/Key Stores
  • User Directories
  • Agents
  • Custom Modules

while the stats command exports a subset of that data into the smps.log file.

The Policy Server Administration Guide contains the following details:

Note: On Windows systems, do not run the smpolicysrv command from a remote desktop or Terminal Services window. The smpolicysrv command depends on inter-process communications that do not work if you run the smpolicysrv process from a remote desktop or Terminal Services window

Important! Before running a SiteMinder utility or executable on Windows Server 2008, open the command line window with administrator permissions. Open the command line window this way, even if your account has administrator privileges. For more information, see the release notes for your SiteMinder component.

However, this does not seem to work.  Since the Policy Server service by default is running as System, you get the message “The specified server is not currently running” when trying to run the command.  You can start the service as a different user, but that was not the direction I wanted to take.  So, the next step was to try and get a CMD window which was running as System so that I could execute the command.  After trying various methods (runas, using “at” to launch a CMD window, etc.) those failed to produce the result I need.  Changes in Windows 2008 prevented some of the hacks that worked in previous versions of the OS.

The answer was to use psexec from Sysinternals (now Microsoft) which allows you to run things from the command line as system. The tool is part of the PsTools suite at the following URL:

http://technet.microsoft.com/en-us/sysinternals/bb896649

Once psexec was installed in a directory in the Windows PATH, I completed the following steps to publish the Policy Server statistics:

  1. Open regedit and set the HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Netegrity\SiteMinder\CurrentVersion\Publish key to the file location and name for the XML file
  2. Open a CMD prompt (I used the one is C:\Windows\SysWOW64\cmd.exe (right-click and select Run as administrator)
  3. Enter the following command: psexec -s “<SiteMinder Home>\bin\smpolicysrv” “-publish”

where <SiteMinder Home> is the install location of the Policy Server.  You will now get the published XML file at the location and name specified in step 1 above.

2 thoughts on “Running the “publish” and “stats” Commands for SiteMinder on Windows 2008 r2

  1. Thanks for the info. I also found another way to do this without using psexec

    From the command prompt you can type:

    at smpolicysrv -publish (where is some time in the future as in 1 minute later).

    For instance, if the time is 7:41 you can type at 7:42 smpolicysrv -publish

    this will run the command at 7:42

    Now, after this is done, not only will it run the command but it creates a scheduled task which you can then run at will or setup a schedule to run.

    The psexec is also a good approach it just depends on where or not you want to script it or how often you would like to run it.

    john

    • Sorry but does not looks like it picked up my full command.

      should be:

      at [time] smpolicysrv -publish (where [time] is some time in the future as in 1 minute later).

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>