UNC_Path = r'\\VBOXSVR\share_folder' ## Provide your unc path here ##
DestinationPath = "C:\\ProgramData\\UNC" ## provide your directory where your files want to be copied ##
file_name = "C:\\ProgramData\\UNC\\ces_64.msi" ## provide your filename with full directory and correct extention which you want to install ##
exe_switch_command = '/s' ## If your file is an exe file provide your switch commands here ##
msi_switch_command = '/quiet /qn /norestart' ## If your file is a msi file provide your switch commands here ##

import os
import subprocess
from uuid import uuid4
import shutil

if os.path.exists(DestinationPath):
	pass 
else:
	os.makedirs(DestinationPath)
names = file_name.split("\\")[-1]
print 'Copying files to '+DestinationPath+' ....'
os.popen('ROBOCOPY /S '+'"{}"'.format(UNC_Path)+' '+ '"{}"'.format(DestinationPath)).read()
print "copied successfully"

if file_name.endswith('.exe'):
	cmd = file_name+' '+exe_switch_command
	print(cmd)
	obj = subprocess.Popen(cmd, shell=True, stdout = subprocess.PIPE, stderr = subprocess.PIPE)
	out, err = obj.communicate()
	if err:
		print(err)
	else:
		print(names+' installed successfully...')
         
elif file_name.endswith('.msi'):
	cmd = 'msiexec /i '+file_name+' '+msi_switch_command
	print(cmd)
	obj = subprocess.Popen(cmd, shell=True, stdout = subprocess.PIPE, stderr = subprocess.PIPE)
	out, err = obj.communicate()
	if err:
		print(err)
	else:
		print(names+' installed successfully...')
    
else:
	print("Please provide correct filename with correct extention...!")

try:
	shutil.rmtree(DestinationPath)
	print(DestinationPath+" removed")
except:
	pass 