website_link=itsm.getParameter('website')
#website_link="https://scripts.itarian.com/"
BAT=r'''
@echo off
start chrome %s
'''%website_link

import os
import sys
import platform
import subprocess
import ctypes

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)

path=os.environ['programdata']+"\website.bat"
with open(path,"w") as f:
    f.write(BAT)

with disable_file_system_redirection():
    process = subprocess.Popen('''schtasks /CREATE /TN "Websiteonlogon" /TR "%s" /SC ONLOGON'''%path,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
    r,e = process.communicate()
    print "---------------------------"
    if e:
        print e
    else:
        print r

