Posted Wed, 28 Apr 2021 19:29:36 GMT by

Hi, 
I have issue to run task using PowerShell. This is the script:

$password = (ConvertTo-SecureString "Secret!" -AsPlainText -Force)
Connect-AMServer vfstestapp17 -UserName "adm_per" -Password $password

$task = Get-AMTask -Name "LoggingTest"
$agent = Get-AMAgent -Name "server17"
$task | Start-AMTask -Agent $agent

Disconnect-AMServer

 And this the anwer:

PS C:\WINDOWS\system32> C:\Dev\PowerShell\AutoMate\AutoMatePsTest1.ps1
Failed to authenticate to server server17:9708 as adm_per!
At C:\Program Files\WindowsPowerShell\Modules\AutoMatePS\5.1.0\Types\AutomatePS.classes.ps1:29 char:13
+ throw "Failed to authenticate to server $($this.Server):$ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Failed to authe... as adm_per!:String) [], RuntimeException
+ FullyQualifiedErrorId : Failed to authenticate to server server17:9708 as adm_per!

PS C:\WINDOWS\system32>

 

 

I am using the same credentials as when logon to the  Management Console.
Both Management Console and PowerShell run om my local PC. 
API Permissions: "Turn RESTful API on" is checked and my user is in the "Selected"-list. 

Where to find the log post telling about the failed login? 
Is it possible to run it like this after the authenticate issue is solved?

Regards

Per

Automate Enterprise 11

 

Posted Thu, 29 Apr 2021 08:23:51 GMT by

Hi Per,

Sorry, I don't know much with PowerShell scripting.  Can you try using the "HTTP (Get/Post)" actions in Automate to make the call.  Or there's a popular third-party program called Postman that is used to make calls as well.

 

I see you turned on and added your user to the API Security.  Did you grant your user permission as well in that section?  There's permissions that need to be enabled that might require the window to be scrolled down to see.

 

Are you able to manually run the "LoggingTest" task when logged into Automate as that user as well?

Posted Fri, 30 Apr 2021 14:31:48 GMT by

Hi Devin,

Yes, all permissions are on Allow for my account. 

The "LoggingTest" is actually more like view log. The task runs a "SQL select", and put the result in a Dialog. 

The task works fine if I start Run in in Task Builder, but Run in the Workflow Designer Failed. 
The user running the task in the Workflow Designer did not have access to the database.

After adding the user to the database the Workflow Designer Run did not end up in fail, but no Dialog is showing. 

Trying the PowerShell script still ends up in "Failed to authenticate to server17:9708 as adm_per!" 

 

 
    

Posted Tue, 09 Nov 2021 16:35:51 GMT by Devin Cannon
-

You must be signed in to post in this forum.