BROKEN SCRIPT (help!) - Download and run executable

I am not a python coder. But I pieced and patched together this code to download and run a EXE file. I tested it remotely against my laptop and it does not work. It does not generate any errors or logs either??

Any help appreciated. Thanks.

====== script variables ==================================================================

DownTo=‘C:\windows emp’ ## Path where the file should download to
fromURL=‘’ ## URL of the file to download (Case Sensitive)
FileNm=‘FILENAME.exe’ ## File name downloaded / To Execute (Case Sensitive)
MyVars=’’ ## Any cmd line switches needed
cmd= DownTo + FileNm + ’ ’ = MyVars ## Do not change.

====== script variables ==================================================================

import os;
import ctypes
class disable_file_system_redirection:
_disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirect ion
_revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirecti on
def enter(self):
self.old_value = ctypes.c_long()
self.success = self._disable(ctypes.byref(self.old_value))
def exit(self, type, value, traceback):
if self.success:

import subprocess
with disable_file_system_redirection():
import urllib
import os

def downloadFile(DownTo, fromURL):
fileName = fromURL.split(’/’)[-1]
DownTo = os.path.join(DownTo, fileName)
with open(DownTo, ‘wb’) as f:
if os.path.isfile(DownTo):
return ‘{} - {}KB’.format(DownTo, os.path.getsize(DownTo)/1000)
return ‘Please Check URL or Download Path!’

if name==‘main’:
print downloadFile(DownTo, fromURL )

Now run the install file

================================================== =====================

with disable_file_system_redirection():
print(out);#To define a particular parameter, replace the ‘parameterName’ inside itsm.getParameter(‘parameterName’) with that parameter’s name

The content of the script you posted above @nnsit has lost its formatting. Can you perhaps export the script from the EM and attach it here?