Sign in to follow this  

Call Powershell Scripts From Ecr

Recommended Posts


Is there anyone having experience from calling Powershell scripts from with in an ECR?

I think it's a good idé to use powershell for easy things, rarely used. (I can understand if someone has comments on that statement)


My script is for example like this - to set Ulf Wilhelmsson to DND status


try {

  import-module ippbx

  connect-ippbx -ServerName localhost -UseIpPbxLogin -CredentialsFile  "C:\Program Files (x86)\SwyxWare\IpPbxLogin.xml"

  Set-IpPbxUserPresenceState -UserEntry $(Get-IpPbxUser -UserName 'Ulf Wilhelmsson') -IsAway:$false -IsDND:$true

} catch {

  "Error in Set-IpPbxUserPresenceStatet $error ($?)"|out-file -Filepath  ... 



 Works all right if run from GUI, but when called from ECR I got the following error 


"Error in Set-IpPbxUserPresenceStatet The variable '$Global:IpPbxServer' cannot be retrieved because it has not been set. "


So as far as I understand is the connect-ippbx statement not rising any error but the result of the operation seems not to work

The user credentials in the IpPbxLogin.xml have Administration rights.


The code in the ECR script looks like this.


strCommand = "Powershell.exe -executionpolicy remotesigned -windowstyle hidden -File " & strFullName 

PBXScriptOutputTrace "[uWDEBUG] " & strCommand


Set WshShell = CreateObject("WScript.Shell")

returnval = WshShell.Run(strCommand,0, true)



Anyone having any idéa?

Share this post

Link to post
Share on other sites

The reason might be this one: The credentials file created with Export-IpPbxCredential is Windows user specific. When you call powershell.exe from the ECR script it runs with the same account as the SwyxServer service. If you created the credential file with another account it cannot be decrypted later on from the service account user. 

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this