This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Workflow to execute script on remote server

Hi,

I am running Active Roles 6.9 and have created a workflow which should execute a PowerShell script on a remote server. If I run the script manually everything works fine. If I use the workflow I receive the message that the workflow executed successfully, but the script does not execute on the remote server. The script I am using is:

################################################################

function onPreMove($Request)
{
$User = $Dirobj.get("mail")

#Get's the credentials of the Active Roles Service Account
$Credential = Import-Clixml -Path "D:\TEMP\ARS.cred"

#Creates a connection to the on premise Skype for Business Management server
$Session =New-PSSession -computername Server01 -Authentication Credssp -Credential $Credential
$ScriptsBlock = {
Import-Module lync

#Reads the email address of the user and enables the user account for Skype for Business
$User = $using:User
$User2 = Get-CsAdUser -Filter {WindowsEmailAddress -like $User}
$SipAddres = "sip:" + $User2.WindowsEmailAddress
Enable-CsUser -Identity $User2.Identity -SipAddress $SipAddres -HostingProviderProxyFqdn "sipfed.online.lync.com"
}
Invoke-Command -Session $Session -ScriptBlock $ScriptsBlock
}

#######################################################################

Does anyone know if this is supported and or should work? 

Parents Reply Children
No Data