ulfwil Posted January 26, 2015 #1 Share Posted January 26, 2015 Hi, 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 workThe 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 More sharing options...
Most Valued User Martin Posted January 26, 2015 Most Valued User #2 Share Posted January 26, 2015 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.