Automic Workload Automation

 View Only
  • 1.  Powershell script to upload files to Sharepoint

    Posted Jan 16, 2023 09:38 AM
    Hi Community ,

    we have a file generated in a Windows agent. we need this file to be uploaded to SharePoint using powershell script and windows job.

    Can anyone help us with this?

    Thank you in advance!

    Regards,
    Shravan Shetty


  • 2.  RE: Powershell script to upload files to Sharepoint

    Posted Jan 17, 2023 11:00 AM
    Hi Shravan,

    please check the following pages:

    https://learn.microsoft.com/en-us/answers/questions/931821/upload-file-to-sharpoint-folder
    https://www.sharepointdiary.com/2012/07/upload-file-to-sharepoint-library-using-powershell.html

    regards,
    Peter

    ------------------------------
    Automic Certified Professional & Expert & Knight

    For AUTOMIC trainings please check https://www.qskills.de/qs/workshops/automic/
    ------------------------------



  • 3.  RE: Powershell script to upload files to Sharepoint

    Posted Jan 17, 2023 02:24 PM
    Hi Peter,

    Thankyou for this!

    But I need to know how can I run PowerShell scripts in Automic ?

    Regards,
    Shravan Shetty


  • 4.  RE: Powershell script to upload files to Sharepoint

    Posted Jan 18, 2023 02:40 AM
    Hi Shravan,

    first we need to make sure that the agent configuration supports it. Please ask your Automic admin if PowerShell is configured as an alternative interpreter.

    regards,
    Peter

    ------------------------------
    Automic Certified Professional & Expert & Knight

    For AUTOMIC trainings please check https://www.qskills.de/qs/workshops/automic/
    ------------------------------



  • 5.  RE: Powershell script to upload files to Sharepoint

    Posted Feb 06, 2023 10:33 AM

    Hello,

    You can also use the PnP cmdlets.

    https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-pnppowershell?source=recommendations

    as Peter already mentoin, you need to check if Powershell is configured as external interpreter.
    Then you need to only change from "Batch" to "Custom interpretor" in the windows tab of the Win job.
    There is also a method to invoke powershell scripts via cmd

    powershell "C:\Path\script.ps1" 

    or

    giving the full path to powershell.exe (or pwsh.exe)



    ------------------------------
    ------------------------------
    Automic SME @ DXC.Technology
    ------------------------------
    ------------------------------



  • 6.  RE: Powershell script to upload files to Sharepoint

    Posted Feb 07, 2023 03:08 PM
    Here's what I use to run PowerShell scripts: 

    In Client 0  -- DIV_Variables >> UC_EXT_INTERPRETERS_WINDOWS,
    add the following: 

    Then in the windows job object, Process tab, see below example:
    I call the External Interpreter with a :Begin statement 
    Then I put the script I want to run as .ps1 
    Then I use an :END statement. 

    :BEGIN_EXT_INT POWERSHELL

    C:\Scripts\****.ps1
    :END_EXT_INT POWERSHELL


  • 7.  RE: Powershell script to upload files to Sharepoint

    Posted Feb 08, 2023 10:08 AM

    Hi @Marilyn Singley,

    The way you do it, creates a .ps1 file that contains ​"C:\Scripts\****.ps1". The :BEGIN_EXT_INT / :END_EXT_INT is intended to execute native Powershell scripts like so: 







    Cheers
    Christoph 



    ------------------------------
    ----------------------------------------------------------------
    Automic AE Consultant and Trainer since 2000
    ----------------------------------------------------------------
    ------------------------------