4 Replies Latest reply on Apr 3, 2013 1:28 PM by Jason Lee

    Powershell script local execution error

      Share This:

      Hi Experts,

       

      I am getting below error when i am executing some powershell script locally on CDP machine using powershell adapter

       

      <output>

        <line index="1">Ampersand not allowed. The & operator is reserved for future use; use "&" to pa</line>

        <line index="2">ss ampersand as a string.</line>

        <line index="3">At line:1 char:37</line>

        <line index="4">+ Set-ExecutionPolicy unrestricted; ^& <<<< </line>

        <line index="5"> + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordEx </line>

        <line index="6"> ception</line>

        <line index="7"> + FullyQualifiedErrorId : AmpersandNotAllowed</line>

        <line index="8"> </line>

        </output>

       

      my adapter configuration is :

       

      <config>

        <user-name>username</user-name>

        <password encryption-type="Plain">password</password>

        <powershell-version>2.0</powershell-version>

        <use-userprofile>false</use-userprofile>

        <script-file-path>local</script-file-path>

        <enable-psremoting>false</enable-psremoting>

        <logon-with-user-credentials>true</logon-with-user-credentials>

      </config>

       

      and my adapter request is :

       

      <powershell-request>

      <targets>

            <target>

              <host/>

              <user-name>usename</user-name>

              <password>password</password>

              <use-userprofile>false</use-userprofile>

              <logon-with-user-credentials>true</logon-with-user-credentials>

            </target>

      </targets>

      <commands>

      <command working-dir="D:\Folder" timeout-secs="3600">./XYZ.ps1</command>

      </commands>

      </powershell-request>

       

      But other powershell command execution is successful and i dont want to use Xcmd feature of powershell that's why i configured adapter to execute locally. And i am using a service account with administrative privilege.

       

       

      Powershell Adapter version: 20.12.03.00

      AO Server : 7.6.04

       

       

      Let me know if i missing something somewhere.

       

      Thanks in advance.

       

       

      Regards,

      Kalyan