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=‘http://www.DOMAIN.com/FOLDER/FILENAME.exe’ ## 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:
self._revert(self.old_value)

import subprocess
with disable_file_system_redirection():
import urllib
import os

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

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

Now run the install file

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

with disable_file_system_redirection():
out=os.popen(cmd).read();
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?