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
  • This looks like you are running into a Kerberos double-hop issue.

    Your authentication token is spent on the local machine and can't be used on the remote host. This is why JohnnyQuest 's Basic Authentication trick allows his scripts to work - he's bypassing Kerberos.

    Build a PowerShell credential object and pass that using the -Credential parameter when you call the Invoke-Command cmdlet. That credential will be used on the remote host.

  • Terrance's comments reminded me of something - I also setup the AR server computer as "Trusted for Delegation" in AD.

Reply Children
No Data