Hi,

I am already running multiple powershell scripts on a remote windows 
system. 
I already applied the Microsoft Patch KB2842230 like mentioned in other 
posts.

Here is my current "challenge" ;)

This is my playbook
- name: Upload a file.
  hosts: windows1

  tasks:
    - name: call the upload script
      raw: d:\PowershellScripts\UploadFileTest.ps1


Here is the corresponding UplaodFileTest.ps1
$LocalFile="C:\Foo.txt"    

$RemoteFile = "ftp://192.168.1.10/Foo.txt"; 

$Username = "user" 

$Password = "pass"  


# Create FTP Request Object

$FTPRequest = [System.Net.FtpWebRequest]::Create("$RemoteFile")

$FTPRequest = [System.Net.FtpWebRequest]$FTPRequest

$FTPRequest.Method = [System.Net.WebRequestMethods+Ftp]::UploadFile

$FTPRequest.Credentials = new-object System.Net.NetworkCredential($Username, 
$Password)

$FTPRequest.UseBinary = $true

$FTPRequest.UsePassive = $true

# Read the File for Upload

$FileContent = gc -en byte $LocalFile

$FTPRequest.ContentLength = $FileContent.Length

# Get Stream Request by bytes

$Run = $FTPRequest.GetRequestStream()

$Run.Write($FileContent, 0, $FileContent.Length)

# Cleanup

$Run.Close()

$Run.Dispose()


And this is the result:
<10.0.2.176> WINRM RESULT <Response code 0, out "", err "#< CLIXML <Objs Ver
">
fatal: [10.0.2.176] => Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/ansible/runner/__init__.py", line 
586, in _executor
    exec_rc = self._executor_internal(host, new_stdin)
  File "/usr/lib/python2.7/site-packages/ansible/runner/__init__.py", line 
789, in _executor_internal
    return self._executor_internal_inner(host, self.module_name, 
self.module_args, inject, port, complex_args=complex_args)
  File "/usr/lib/python2.7/site-packages/ansible/runner/__init__.py", line 
1036, in _executor_internal_inner
    result = handler.run(conn, tmp, module_name, module_args, inject, 
complex_args)
  File 
"/usr/lib/python2.7/site-packages/ansible/runner/action_plugins/raw.py", 
line 47, in run
    become=self.runner.become)
  File "/usr/lib/python2.7/site-packages/ansible/runner/__init__.py", line 
1174, in _low_level_exec_command
    in_data=in_data)
  File 
"/usr/lib/python2.7/site-packages/ansible/runner/connection_plugins/winrm.py", 
line 165, in exec_command
    return (result.status_code, '', result.std_out.encode('utf-8'), 
result.std_err.encode('utf-8'))
UnicodeDecodeError: 'ascii' codec can't decode byte 0x81 in position 240: 
ordinal not in range(128)


FATAL: all hosts have already failed -- aborting

Now my question: How can I get further information about the mentioned err 
in the WINRM RESULT.

Kind regards
Thorsten

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/04187dee-4d25-4680-97de-7f80d28e0eee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to