Jump to content

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?

Link to comment
Share on other sites

  • Most Valued User

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. 

Link to comment
Share on other sites


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.