kaxil commented on a change in pull request #13153:
URL: https://github.com/apache/airflow/pull/13153#discussion_r584359471



##########
File path: airflow/providers/microsoft/winrm/operators/winrm.py
##########
@@ -88,10 +97,17 @@ def execute(self, context: dict) -> Union[list, str]:
 
         # pylint: disable=too-many-nested-blocks
         try:
-            self.log.info("Running command: '%s'...", self.command)
-            command_id = self.winrm_hook.winrm_protocol.run_command(  # type: 
ignore[attr-defined]
-                winrm_client, self.command
-            )
+            if self.ps_path is not None:
+                self.log.info("Running command as powershell script: '%s'...", 
self.command)
+                encoded_ps = 
b64encode(self.command.encode('utf_16_le')).decode('ascii')
+                command_id = self.winrm_hook.winrm_protocol.run_command(  # 
type: ignore[attr-defined]
+                    winrm_client, '{0} -encodedcommand 
{1}'.format(self.ps_path, encoded_ps)

Review comment:
       ```suggestion
                       winrm_client, f'{self.ps_path} -encodedcommand 
{encoded_ps}'
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to