Url = "https://script-downloads.itarian.com/7zip-msi/7z2107-x64.msi"### Provide your download url here ###
Filename = "Newfile"### Provide your filename here ###
import os
import subprocess
import re
import ctypes
import urllib 
import ssl
class disable_file_system_redirection:
    _disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirection
    _revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirection
    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)
with disable_file_system_redirection():
	print('File Downloading')
	destination = "C:\\Users\\"+Filename+".msi"
	gcontext = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
	download = urllib.urlretrieve(Url,destination,context = gcontext)
	print('File downloaded')
	command = 'msiexec /i '+destination+' /quiet /qn'
	cmd = subprocess.Popen(command,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
	result_1,error_1=cmd.communicate()
	if error_1:
		print(error_1)
	else:
		print(Filename+" Sucessfully Installed")
				
