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
- 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:
Once psexec was installed in a directory in the Windows PATH, I completed the following steps to publish the Policy Server statistics:
- 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
- Open a CMD prompt (I used the one is C:\Windows\SysWOW64\cmd.exe (right-click and select Run as administrator)
- 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.