Jump to content

Create FunctionProfile with powershell


Robert

Recommended Posts

Hey Folks,

is there anybody who's got an idea of how to create functionprofiles with powershell?
On hosted swyxware it's necessary to  care about them and I want them to be the same on multiple Servers...

 

I haven't found any cmdlets to achieve this yet - maybe i've searched for the wrong word`s... :)

 

Link to comment
Share on other sites


  • Most Valued User

Unfortunately there are no cmdlets in the SwyxWare Powershell module for that. The ConfigDataStoreAPI on which the PS module is based on has the necessary APIs however. But they are not easy to use. You could probably do something like this:

 

Get the enumerator object and execute a query to fill it

$e. = $LibManager.GetFeatureProfileEnum()

$e.ExecuteAllFilter((new-object "OrderByList))

 

Now the PrimaryCollection member is filled and you could list them

$e.PrimaryCollection

 

That's the easy part. Each object in the collection is a featureprofileEntry object. These are your feature profiles. Each profile object has a collection of FeatureEntry objects which define the features included in that profile. The FeatureEntry object has a feature ID. The IDs are static constants on this object: [SWConfigDataSharedLib.Config.FeatureListBase]

 

To add a feature to an existing profile you would do something like this:

$profile = $e.PrimaryCollection | where Name -eq "MyProfileName"

 

$FeatureEntryToAdd = new-object "SWConfigDataClientLib.Proxies.FeatureProfiles.FeatureEntry"

$FeatureEntryToAdd.FeatureID = [SWConfigDataSharedLib.Config.FeatureListBase]::SClFeatureOptionPackSwyxECR

$profile.FeatureEntryCollection.Add($FeatureEntryToAdd)

$profile.Update($true)

 

Creating a new profile is similar, you create a new SWConfigDataClientLib.Proxies.FeatureProfiles.FeatureProfileEntry object, add the feature as shown above, add it to the FeatureProfileEnumerator object and call the Update($true)  method to write everything back.

 

Be careful, you could easily mess up your SwyxWare setup

Link to comment
Share on other sites


  • 3 months later...
  • Most Valued User

Hello Robert,

 

I have good news for you. The upcoming SwyxWare 2015 R40 will contain the following new FeatureProfile commandlets:

Add-IpPbxFeatureProfile
Add-IpPbxFeatureToProfile
Get-IpPbxDefaultFeatureProfile
Get-IpPbxFeature
Get-IpPbxFeatureProfile
New-IpPbxFeatureProfile
Remove-IpPbxFeatureFromProfile
Remove-IpPbxFeatureProfile
Set-IpPbxDefaultFeatureProfile
Update-IpPbxFeatureProfile

Usage Example
$profile = New-IpPbxFeatureProfile -FeatureProfileName "TestProfile" -UserLimit 10
Add-IpPbxFeatureToProfile -FeatureProfileEntry $profile -FeatureName "SwyxBF (BasicFunctionality)"
Add-IpPbxFeatureToProfile -FeatureProfileEntry $profile -FeatureName "SwyxBCR (Basic Call Routing)" 
Add-IpPbxFeatureToProfile -FeatureProfileEntry $profile -FeatureName "SwyxVoicemail"
Add-IpPbxFeatureProfile -FeatureProfileEntry $profile

Creates a new feature profile object named "TestProfile", assigns the listed features and adds it to the IpPbx server.

How to assign the new "TestProfile" to a user?

$FeatureProfileEntry = Get-IpPbxFeatureProfile -FeatureProfileName "TestProfile"

$UserEntry = Get-IpPbxUser -UserName "UserA"
$UserEntry.FeatureProfileID = $FeatureProfileEntry.FeatureProfileID
Update-IpPbxUser -UserEntry $UserEntry

Link to comment
Share on other sites


Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and have taken note of our Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.