# unable to execute a perl script on windows server

**URL:** <https://forum.ansible.com/t/unable-to-execute-a-perl-script-on-windows-server/37565>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [January 20, 2023, 1:49pm UTC](https://forum.ansible.com/t/unable-to-execute-a-perl-script-on-windows-server/37565 "2023-01-20T13:49:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Josmi\_Jose](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@Josmi\_Jose](https://forum.ansible.com/u/Josmi_Jose)\
**Post date:** [January 20, 2023, 1:49pm UTC](https://forum.ansible.com/t/unable-to-execute-a-perl-script-on-windows-server/37565/1 "2023-01-20T13:49:47Z")

</div>

Hi,

I am trying to run a run a perl script in the windows server using ansible playbook located in linux and getting the below error.Can some one help me.

“changed”: false,  
“module\_stderr”: "Exception calling "Create" with "1" argument(s): "At line:4 char:21\r\n+ def \_ansiballz\_main():\r\n+ ~\r\nAn expression was expected after ‘(’.\r\nAt line:13 char:27\r\n+ except (AttributeError, OSError):\r\n+ ~\r\nMissing argument in parameter list.\r\nAt line:15 char:7\r\n+ if scriptdir is not None:\r\n+ ~\r\nMissing ‘(’ after ‘if’ in if statement.\r\nAt line:22 char:7\r\n+ if sys.version\_info \< (3,):\r\n+ ~\r\nMissing ‘(’ after ‘if’ in if statement.\r\nAt line:22 char:30\r\n+ if sys.version\_info \< (3,):\r\n+ ~\r\nMissing expression after ‘,’.\r\nAt line:22 char:25\r\n+ if sys.version\_info \< (3,):\r\n+ ~\r\nThe ‘\<’ operator is reserved for future use.\r\nAt line:27 char:34\r\n+ def invoke\_module(modlib\_path, temp\_path, json\_params):\r\n+ ~\r\nMissing argument in parameter list.\r\nAt line:28 char:40\r\n+ z = zipfile.ZipFile(modlib\_path, mode=‘a’)\r\n+ ~\r\nMissing argument in parameter list.\r\nAt line:31 char:33\r\n+ zinfo = zipfile.ZipInfo()\r\n+ ~\r\nAn expression was expected after ‘(’.\r\nAt line:34 char:25\r\n+ z.writestr(zinfo, sitecustomize)\r\n+ ~\r\nMissing argument in parameter list.\r\nNot all parse errors were reported. Correct the reported errors and try again."\r\nAt line:6 char:1\r\n+ $exec\_wrapper = [ScriptBlock]::Create($split\_parts[0])\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : NotSpecified: (🙂 , MethodInvocationException\r\n + FullyQualifiedErrorId : ParseException\r\n \r\nThe expression after ‘&’ in a pipeline element produced an object that was not valid. It must result in a command name,\r\n a script block, or a CommandInfo object.\r\nAt line:7 char:2\r\n+ &$exec\_wrapper\r\n+~~~~~~~~~~~~~\r\n + CategoryInfo : InvalidOperation: (🙂 , RuntimeException\r\n + FullyQualifiedErrorId : BadExpression\r\n ",  
“module\_stdout”: “”,  
“msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”,  
“rc”: 1  
}

Playbook:

- hosts: SRM

vars:  
ansible\_become\_user: ‘{{ ansible\_user }}’  
release\_version: “Latest”

tasks:

- name: “upgrade DW for {{dw\_instance\_1}}”  
become: yes  
become\_user: Administrator  
shell: ssh {{ ansible\_user }}@{{ ansible\_host }} “D:” && cd D:\AMG\SRM\{{ kit\_name.stdout }}\ && perl srm\_upgrade.pl –dw-instance={{dw\_instance\_1}}

---

<div class="post-metadata">

**Author:** ![Walter\_Rowe](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/walter_rowe/32/4506_2.png) [@Walter\_Rowe](https://forum.ansible.com/u/Walter_Rowe)\
**Post date:** [January 20, 2023, 1:53pm UTC](https://forum.ansible.com/t/unable-to-execute-a-perl-script-on-windows-server/37565/2 "2023-01-20T13:53:52Z")

</div>

shell: **ssh {{ ansible\_user }}@{{ ansible\_host }}** “D:” && cd D:\AMG\SRM\{{ kit\_name.stdout }}\ && perl srm\_upgrade.pl –dw-instance={{dw\_instance\_1}}

Why do you do the ssh? ansible does that by default. Does your Windows machine support ssh? perl?

Walter

---

<div class="post-metadata">

**Author:** ![Josmi\_Jose](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@Josmi\_Jose](https://forum.ansible.com/u/Josmi_Jose)\
**Post date:** [January 20, 2023, 2:12pm UTC](https://forum.ansible.com/t/unable-to-execute-a-perl-script-on-windows-server/37565/3 "2023-01-20T14:12:13Z")

</div>

Hi,

Modified it without ssh and still got the same error. Ran the perl script manually and connection from ansible to the windows machine works as well.

Modified to below:  
shell: ‘“D:” && cd D:\AMG\SRM\{{ kit\_name.stdout }}\ && perl srm\_upgrade.pl –dw-instance={{dw\_instance\_1}}’

ASK [upgrade DW for 41] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
task path: /opt/ansible/tsn\_playbooks/playground/upgrade-srm.yaml:24  
Using module file /usr/lib/python2.7/site-packages/ansible/modules/commands/command.py  
Pipelining is enabled.  
\<159.79.80.120\> ESTABLISH SSH CONNECTION FOR USER: svc\_sentf\_ssh  
\<159.79.80.120\> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ‘User=“svc\_sentf\_ssh”’ -o ConnectTimeout=10 -o ControlPath=/opt/ansible/.ansible/cp/a65f93f539 159.79.80.120 ‘[chcp.com](http://chcp.com) 65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BAEgATQBBAGMAQQBCAHMAQQBHAGsAQQBkAEEAQgBmAEEASABBAEEAWQBRAEIAeQBBAEgAUQBBAGMAdwBCAGIAQQBEAEUAQQBYAFEAQQBLAEEAQwBRAEEAWgBRAEIANABBAEcAVQBBAFkAdwBCAGYAQQBIAGMAQQBjAGcAQgBoAEEASABBAEEAYwBBAEIAbABBAEgASQBBAEkAQQBBADkAQQBDAEEAQQBXAHcAQgBUAEEARwBNAEEAYwBnAEIAcABBAEgAQQBBAGQAQQBCAEMAQQBHAHcAQQBiAHcAQgBqAEEARwBzAEEAWABRAEEANgBBAEQAbwBBAFEAdwBCAHkAQQBHAFUAQQBZAFEAQgAwAEEARwBVAEEASwBBAEEAawBBAEgATQBBAGMAQQBCAHMAQQBHAGsAQQBkAEEAQgBmAEEASABBAEEAWQBRAEIAeQBBAEgAUQBBAGMAdwBCAGIAQQBEAEEAQQBYAFEAQQBwAEEAQQBvAEEASgBnAEEAawBBAEcAVQBBAGUAQQBCAGwAQQBHAE0AQQBYAHcAQgAzAEEASABJAEEAWQBRAEIAdwBBAEgAQQBBAFoAUQBCAHkAQQBBAD0APQA=’  
\<159.79.80.120\> (1, ‘’, ‘#\< CLIXML\r\nSystem.Management.Automation.PSCustomObjectSystem.Object1Preparing modules for first use.0-1-1Completed-1 ~~Exception calling “Create” with “1” argument(s): "At line:4 char:21\_x000D\_\_x000A\_~~~~+ def _ansiballz\_main():x000D\_\_x000A_ ~~_~~ + ~x000D\_\_x000A~~~~An expression was expected after '('.x000D\_\_x000A~~~~At line:13 char:27\_x000D\_\_x000A ~~_~~ + except (AttributeError, OSError):_x000D\_\_x000A_ ~~~~+ ~_x000D\_\_x000A_~~~~ Missing argument in parameter list._x000D\_\_x000A_ ~~~~At line:15 char:7\_x000D\_\_x000A\_~~~~ + if scriptdir is not None:_x000D\_\_x000A_ ~~~~+ ~_x000D\_\_x000A_~~~~ Missing '(' after 'if' in if statement._x000D\_\_x000A_ ~~~~At line:22 char:7\_x000D\_\_x000A\_~~~~ + if sys.version\_info \< (3,):_x000D\_\_x000A_ ~~~~+ ~_x000D\_\_x000A_~~~~ Missing '(' after 'if' in if statement._x000D\_\_x000A_ ~~~~At line:22 char:30\_x000D\_\_x000A\_~~~~ + if sys.version\_info \< (3,):_x000D\_\_x000A_ ~~~~+ ~_x000D\_\_x000A_~~~~ Missing expression after ','._x000D\_\_x000A_ ~~~~At line:22 char:25\_x000D\_\_x000A\_~~~~ + if sys.version\_info \< (3,):_x000D\_\_x000A_ ~~~~+ ~_x000D\_\_x000A_~~~~ The '\<' operator is reserved for future use._x000D\_\_x000A_ ~~~~At line:27 char:34\_x000D\_\_x000A\_~~~~ + def invoke\_module(modlib\_path, temp\_path, json\_params):_x000D\_\_x000A_ ~~~~+ ~_x000D\_\_x000A_~~~~ Missing argument in parameter list._x000D\_\_x000A_ ~~~~At line:28 char:40\_x000D\_\_x000A\_~~~~ + z = zipfile.ZipFile(modlib\_path, mode='a')_x000D\_\_x000A_ ~~~~+ ~_x000D\_\_x000A_~~~~ Missing argument in parameter list._x000D\_\_x000A_ ~~~~At line:31 char:33\_x000D\_\_x000A\_~~~~ + zinfo = zipfile.ZipInfo()_x000D\_\_x000A_ ~~~~+ ~_x000D\_\_x000A_~~~~ An expression was expected after '('._x000D\_\_x000A_ ~~~~At line:34 char:25\_x000D\_\_x000A\_~~~~ + z.writestr(zinfo, sitecustomize)_x000D\_\_x000A_ ~~~~+ ~_x000D\_\_x000A_~~~~ Missing argument in parameter list._x000D\_\_x000A_ ~~~~Not all parse errors were reported. Correct the reported errors and try again."_x000D\_\_x000A_~~~~ At line:6 char:1\_x000D\_\_x000A\_~~~~+ $exec\_wrapper = [ScriptBlock]::Create($split\_parts[0])_x000D\_\_x000A_~~~~+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~_x000D\_\_x000A_~~~~ + CategoryInfo : NotSpecified: (🙂 , MethodInvocationException\_x000D\_\_x000A\_ ~~~~+ FullyQualifiedErrorId : ParseException\_x000D\_\_x000A\_~~~~ _x000D\_\_x000A_ ~~~~The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name,_x000D\_\_x000A_~~~~ a script block, or a CommandInfo object._x000D\_\_x000A_ ~~~~At line:7 char:2\_x000D\_\_x000A\_~~~~ + &$exec\_wrapper\_x000D\_\_x000A\_ ~~~~+~~~~~~~~~~~~~ _x000D\_\_x000A_~~~~+ CategoryInfo : InvalidOperation: (🙂 , RuntimeException\_x000D\_\_x000A\_~~~~ + FullyQualifiedErrorId : BadExpression\_x000D\_\_x000A\_ ~~~~_x000D\_\_x000A_~~ ’)  
\<159.79.80.120\> Failed to connect to the host via ssh: #\< CLIXML  
System.Management.Automation.PSCustomObjectSystem.Object1Preparing modules for first use.0-1-1Completed-1 ~~Exception calling “Create” with “1” argument(s): "At line:4 char:21\_x000D\_\_x000A\_~~~~+ def _ansiballz\_main():x000D\_\_x000A_ ~~_~~ + ~x000D\_\_x000A~~~~An expression was expected after ‘(’.x000D\_\_x000A~~~~At line:13 char:27\_x000D\_\_x000A ~~_~~ + except (AttributeError, OSError):_x000D\_\_x000A_ ~~~~+ ~_x000D\_\_x000A_~~~~ Missing argument in parameter list._x000D\_\_x000A_ ~~~~At line:15 char:7\_x000D\_\_x000A\_~~~~ + if scriptdir is not None:_x000D\_\_x000A_ ~~~~+ ~_x000D\_\_x000A_~~~~ Missing ‘(’ after ‘if’ in if statement._x000D\_\_x000A_ ~~~~At line:22 char:7\_x000D\_\_x000A\_~~~~ + if sys.version\_info \< (3,):_x000D\_\_x000A_ ~~~~+ ~_x000D\_\_x000A_~~~~ Missing ‘(’ after ‘if’ in if statement._x000D\_\_x000A_ ~~~~At line:22 char:30\_x000D\_\_x000A\_~~~~ + if sys.version\_info \< (3,):_x000D\_\_x000A_ ~~~~+ ~_x000D\_\_x000A_~~~~ Missing expression after ‘,’._x000D\_\_x000A_ ~~~~At line:22 char:25\_x000D\_\_x000A\_~~~~ + if sys.version\_info \< (3,):_x000D\_\_x000A_ ~~~~+ ~_x000D\_\_x000A_~~~~ The ‘\<’ operator is reserved for future use._x000D\_\_x000A_ ~~~~At line:27 char:34\_x000D\_\_x000A\_~~~~ + def invoke\_module(modlib\_path, temp\_path, json\_params):_x000D\_\_x000A_ ~~~~+ ~_x000D\_\_x000A_~~~~ Missing argument in parameter list._x000D\_\_x000A_ ~~~~At line:28 char:40\_x000D\_\_x000A\_~~~~ + z = zipfile.ZipFile(modlib\_path, mode=‘a’)_x000D\_\_x000A_ ~~~~+ ~_x000D\_\_x000A_~~~~ Missing argument in parameter list._x000D\_\_x000A_ ~~~~At line:31 char:33\_x000D\_\_x000A\_~~~~ + zinfo = zipfile.ZipInfo()_x000D\_\_x000A_ ~~~~+ ~_x000D\_\_x000A_~~~~ An expression was expected after ‘(’._x000D\_\_x000A_ ~~~~At line:34 char:25\_x000D\_\_x000A\_~~~~ + z.writestr(zinfo, sitecustomize)_x000D\_\_x000A_ ~~~~+ ~_x000D\_\_x000A_~~~~ Missing argument in parameter list._x000D\_\_x000A_ ~~~~Not all parse errors were reported. Correct the reported errors and try again."_x000D\_\_x000A_~~~~ At line:6 char:1\_x000D\_\_x000A\_~~~~+ $exec\_wrapper = [ScriptBlock]::Create($split\_parts[0])_x000D\_\_x000A_~~~~+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~_x000D\_\_x000A_~~~~ + CategoryInfo : NotSpecified: (🙂 , MethodInvocationException\_x000D\_\_x000A\_ ~~~~+ FullyQualifiedErrorId : ParseException\_x000D\_\_x000A\_~~~~ _x000D\_\_x000A_ ~~~~The expression after ‘&’ in a pipeline element produced an object that was not valid. It must result in a command name,_x000D\_\_x000A_~~~~ a script block, or a CommandInfo object._x000D\_\_x000A_ ~~~~At line:7 char:2\_x000D\_\_x000A\_~~~~ + &$exec\_wrapper\_x000D\_\_x000A\_ ~~~~+~~~~~~~~~~~~~ _x000D\_\_x000A_~~~~+ CategoryInfo : InvalidOperation: (🙂 , RuntimeException\_x000D\_\_x000A\_~~~~ + FullyQualifiedErrorId : BadExpression\_x000D\_\_x000A\_ ~~~~_x000D\_\_x000A_~~  
fatal: [**SE20GITVRST10]: FAILED! =\> {**  
**“changed”: false,**  
**“module\_stderr”: "Exception calling "Create" with "1" argument(s): "At line:4 char:21\r\n+ def \_ansiballz\_main():\r\n+ ~\r\nAn expression was expected after ‘(’.\r\nAt line:13 char:27\r\n+ except (AttributeError, O**SError):\r\n+ ~\r\nMissing argument in parameter list.\r\nAt line:15 char:7\r\n+ if scriptdir is not None:\r\n+ ~\r\nMissing ‘(’ after ‘if’ in if statement.\r\nAt line:22 char:7\r\n+ if sys.version\_info \< (3,):\r\n+ ~\r\nMissing ‘(’ after ‘if’ in if statement.\r\nAt line:22 char:30\r\n+ if sys.version\_info \< (3,):\r\n+ ~\r\nMissing expression after ‘,’.\r\nAt line:22 char:25\r\n+ if sys.version\_info \< (3,):\r\n+ ~\r\nThe ‘\<’ operator is reserved for future use.\r\nAt line:27 char:34\r\n+ def invoke\_module(modlib\_path, temp\_path, json\_params):\r\n+ ~\r\nMissing argument in parameter list.\r\nAt line:28 char:40\r\n+ z = zipfile.ZipFile(modlib\_path, mode=‘a’)\r\n+ ~\r\nMissing argument in parameter list.\r\nAt line:31 char:33\r\n+ zinfo = zipfile.ZipInfo()\r\n+ ~\r\nAn expression was expected after ‘(’.\r\nAt line:34 char:25\r\n+ z.writestr(zinfo, sitecustomize)\r\n+ ~\r\nMissing argument in parameter list.\r\nNot all parse errors were reported. Correct the reported errors and try again."\r\nAt line:6 char:1\r\n+ $exec\_wrapper = [ScriptBlock]::Create($split\_parts[0])\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : NotSpecified: (🙂 , MethodInvocationException\r\n + FullyQualifiedErrorId : ParseException\r\n \r\nThe expression after ‘&’ in a pipeline element produced an object that was not valid. It must result in a command name,\r\n a script block, or a CommandInfo object.\r\nAt line:7 char:2\r\n+ &$exec\_wrapper\r\n+~~~~~~~~~~~~~\r\n + CategoryInfo : InvalidOperation: (🙂 , RuntimeException\r\n + FullyQualifiedErrorId : BadExpression\r\n ",  
“module\_stdout”: “”,  
“msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”,

---

<div class="post-metadata">

**Author:** ![Walter\_Rowe](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/walter_rowe/32/4506_2.png) [@Walter\_Rowe](https://forum.ansible.com/u/Walter_Rowe)\
**Post date:** [January 20, 2023, 2:19pm UTC](https://forum.ansible.com/t/unable-to-execute-a-perl-script-on-windows-server/37565/4 "2023-01-20T14:19:44Z")

</div>

I will have to defer to others on this one. I don’t run ssh or perl on Windows servers. Our ansible connections to Windows servers are made over WinRM.

Walter

---

<div class="post-metadata">

**Author:** ![Josmi\_Jose](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@Josmi\_Jose](https://forum.ansible.com/u/Josmi_Jose)\
**Post date:** [January 20, 2023, 2:32pm UTC](https://forum.ansible.com/t/unable-to-execute-a-perl-script-on-windows-server/37565/5 "2023-01-20T14:32:55Z")

</div>

I was able to create a directory as well as copy over some files to the windows machine using ansible using shell module. but I couldn’t run this script. So bit confused over here.
