In my current job there isn’t much need for admin style scripts and jazzy exchange stuff… However I like using PowerShell too much, so I’ve chosen to adapt what little I do know and try to use it with the Business Objects SDK and other business intelligence software…
I’ve written the below mini script to pull back all the Web Intelligence objects on the CMS and wrapped it as a reusable function… Thus starting my business objects module nicely.
Function Get-Webi() { ############################################################################ #.SYNOPSIS # Gets list of Webi objects from business objects CMS #.PARAMETER Cms # The server name of your business objects Central Management Server Node #.PARAMETER Username # Enterprise username required to access business objects #.PARAMETER Password # Enterprise password required to access business objects ############################################################################ Param ( [string]$CMS, [string]$Username, [string]$Password ) $objSessionMgr = New-Object -com ("CrystalEnterprise.SessionMgr") $objEnterpriseSession = $objSessionMgr.Logon($Username,$Password,$CMS,"Enterprise") $objInfoStore = $objEnterpriseSession.Service("","InfoStore") $objInfoObjects = $objInfoStore.Query("SELECT * FROM CI_INFOOBJECTS WHERE SI_KIND = 'Webi'") Return $objInfoObjects }
We can call our function and pipe our Webi Objects to something new like:
Get-Webi -cms BoxiServer01 -user developmentish -password password1 | Select-Object Title, Description | Out-Gridview
lets run through the beans of the script then…
Firstly, I’m passing 3 parameters into the function, this is just the CMS server name, business objects user and password.
We create an new COM CrystalEnterprise.SessionMgr object… We then use our session manager object to create an enterprise session passing in the parameters and invoking the logon method.
We then use our enterprise session to start an infostore service and execute a query against it.
We bind this to a local variable and return it to be piped off the back of the function..
When we call it we’re just interested in the title and description and we pipe that out to a gridview just to display it.
And for those who like a good powershell one liner… here is the whole lot on a single line:
(((New-Object -com ("CrystalEnterprise.SessionMgr")).Logon("developmentish","password1","boxiserver01","Enterprise")).Service("","InfoStore")).Query("SELECT * FROM CI_INFOOBJECTS WHERE SI_KIND = 'Webi'") | Select Title, Description | OGV
Enjoy!
How do I amend the SELECT statement just to retrieve username and created on date and last login date?
Comment by George — November 13, 2019 @ 3:19 pm
SELECT SI_NAME, SI_OWNER, SI_CREATION_TIME, SI_UPDATE_TS FROM CI_INFOOBJECTS WHERE SI_KIND = ‘Webi’
Comment by Martyn Gough — November 13, 2019 @ 3:30 pm