Automic Workload Automation

Expand all | Collapse all

Ping URL from UC4

  • 1.  Ping URL from UC4

    Posted 06-07-2019 08:43 AM
    I have an Requirement to Ping a Dynamic URL through UC4. What is the Best way to Ping an URL

    #automicwork #automicwebinterface #caautomicworkloadautomation #restapiwebservice​​​​​


  • 2.  RE: Ping URL from UC4

    Posted 06-07-2019 01:04 PM
    I don't know if it is the best way, but I would consider running a PowerShell solution.


  • 3.  RE: Ping URL from UC4

    Posted 06-10-2019 11:09 AM
    ​Can you please post the powershell script? I am not too familiar with it and we are also trying to achieve this, Used cUrl but failed.


  • 4.  RE: Ping URL from UC4

    Posted 06-10-2019 02:15 PM
    This PowerShell script returns an integer value if it works.  If you pass it a bad url, it will throw an error.
    I don't know how your UC4 is set up for calling PowerShell.  You should follow your shop best practices for doing so.

    write-host $(get-date) **** STARTING REST CALL
    $Url = "https://www.google.com/"
    $ReturnedInformation = Invoke-RestMethod -Uri $url -Method Get
    $ReturnedInformation.length
    write-host $(get-date) **** FINISHED REST CALL


  • 5.  RE: Ping URL from UC4

    Posted 06-10-2019 03:36 PM
    Hi Pete
    Thank you for sharing the script.

    Thanks
    Shravani


  • 6.  RE: Ping URL from UC4

    Posted 06-10-2019 03:36 PM
    So I got the requirement wrong, looks like we are trying to copy a file to the SharePoint site. we are not equipped in Powershell and that's why I am asking. Any help is appreciated. I know this thread is not related to what I am asking, but please feel free to send me a message. Thankyou!


  • 7.  RE: Ping URL from UC4

    Posted 06-10-2019 04:52 PM
    Now you are talking about a much more complex issue.  I'm not really qualified to talk about how it works, but I can cut/paste some of our code here.  We interface with SharePoint through its web api's, and we use PowerShell to do so.

    This PowerShell command imports the required functions;
       Add-PSSnapin Microsoft.SharePoint.PowerShell

    We then create a new webclient and credential it like so;
    (Note that &ServerPassword# contains a UC4-encrypted password.)
       $WebClient = new-object System.Net.WebClient
       $MyPassword = (&UC_JOBMD CMD="echo &ServerPassword#")
       $WebClient.Credentials = new-object System.Net.NetworkCredential($username, $Mypassword, $domain)
       $MyPassword = ""

    Then we upload documents with this instruction;
       $WebClient.UploadFile($UploadFullPath, "PUT", $LocalPath)

    This is not a very robust solution since it uploads a file without any meta-data.   We were planning to enhance it, but then we never got around to it.

    Another good resource;
    http://letmegooglethat.com/?q=how+to+upload+a+file+to+sharepoint+with+powershell


  • 8.  RE: Ping URL from UC4

    Posted 06-10-2019 05:14 PM
    ​Thankyou so much for taking the time and sharing these details, Pete. Will definitely give a try and test this.
    And sorry @Sundaramoorthy R for using this thread and diverting.