CA Client Automation

  • 1.  Script PowerShell x64 from AM Agent

    Posted Sep 14, 2017 04:17 AM

    Hi,

    I created an External Utility Asset Job to run a powershell script:

        Executable: PowerShell

        Working dir: C:\Windows\System32

        Parameters: Get-NetConnectionProfile >C:\Folder\GetNetConnectionProfile.txt

    This script exits with error: "...Provider Load Failure + Category Information: Not Specified:..."

    This because the command specified have to run in 64 bit environment while AM Agent runs in 32 bit environment.

    How can I configured this Job to run this script in x64 environment?

    Tnx

    D



  • 2.  Re: Script PowerShell x64 from AM Agent

    Broadcom Employee
    Posted Sep 14, 2017 05:26 AM

    You must make sure you are running the correct interpreter for 32 or 64 bit:

     

    “C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe” -File your_script

    “C:\Windows\System32\WindowsPowerShell\v1.0
    powershell.exe” -File your_script

     

     

    Else you can run it from Software delivery Agent but you must set the SD Agent configuration “ps1BinaryMode” to 64bit.

     

    Rgds,

    Steve.



  • 3.  Re: Script PowerShell x64 from AM Agent

    Posted Sep 14, 2017 06:03 AM

    Hi Steve,

    If I run this “C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe” -File your_script 

    the result is the same because the source process is not x64 and then "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" is replaced with "C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe".

     

    How can I change the configuration of SD Agent?

    Can I set ps1BinaryMode during the execution of the job?

    Tnx

    D



  • 4.  Re: Script PowerShell x64 from AM Agent

    Broadcom Employee
    Posted Sep 14, 2017 06:08 AM

    Hi Dave,

     

    A 32bit process can start a 64bit executable (that is how the SD Agent is doing it). The SD Agent configuration is set through the Configuration policy.

     

    Have you tested by running ““C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe” -File your_script

     

    If you get the same error, then your problem is not caused by the 32/64 bit interpreter.

     

    Rgds,

    Steve



  • 5.  Re: Script PowerShell x64 from AM Agent

    Posted Sep 14, 2017 06:34 AM

    Hi Steve,

    I executed the command from powershell_ise.exe 64bit and 32bit.

     

    Here the results:

    -- 32 bit -------------------------------------------------------------------------

    PS C:\Windows\SysWOW64\WindowsPowerShell\v1.0> Get-NetConnectionProfile
    Get-NetConnectionProfile : Errore caricamento provider
    In riga:1 car:1
    + Get-NetConnectionProfile
    + ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (MSFT_NetConnectionProfile:root/StandardCi...nnectionProfile) [Get-NetConnectionProfile], CimExcepti
    on
    + FullyQualifiedErrorId : HRESULT 0x80041013,Get-NetConnectionProfile

    -- 64 bit -------------------------------------------------------------------------

    PS C:\Windows\System32\WindowsPowerShell\v1.0> Get-NetConnectionProfile


    Name : xx.local
    InterfaceAlias : Ethernet
    InterfaceIndex : 10
    NetworkCategory : DomainAuthenticated
    IPv4Connectivity : Internet
    IPv6Connectivity : NoTraffic

    -------------------------------------------------------------------------------------

    If I run the command

        C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe Get-NetConnectionProfile

    from Asset Job, I receive always the error.

     

    How can I change the configuration of SD Agent "ps1BinaryMode" to 64 bit?

     

    Tnx

    D



  • 6.  Re: Script PowerShell x64 from AM Agent

    Broadcom Employee
    Posted Sep 14, 2017 06:50 AM
      |   view attached

    See attached screen shot.

     

     



  • 7.  Re: Script PowerShell x64 from AM Agent

    Posted Sep 14, 2017 08:54 AM

    Hi Steve,

    Now the script with SD runs as expected.

    Is there a similar configuration for Asset Job execution?

    Tnx a lot

    D



  • 8.  Re: Script PowerShell x64 from AM Agent
    Best Answer

    Broadcom Employee
    Posted Sep 14, 2017 10:58 AM

    Hi Dave,

     

    Create a new AM job with the type of “Script”.

     

    A simple script to launch powershell would be:

     

    DIM sCommand as String

    SetMode64(True)

     

    sCommand = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe Get-NetConnectionProfile >c:\temp\steve3.txt"

    execute(sCommand,TRUE,0)

     

    Rgds,

    Steve.



  • 9.  Re: Script PowerShell x64 from AM Agent

    Posted Sep 14, 2017 12:04 PM

    Hi Steve,

    I really appreciated your help.

    Tnx

    D