ludo10 Posted October 20, 2005 Share Posted October 20, 2005 hello, i try to deploy Microsoft patch with autoit. When i use by myself the pacth.exe it is ok, I put a line : call \\SERVER\patch$\patch.exe in my user session script and i have an error message : Line 0 (file "\\SERVER\patch$\patche.exe"): Return Runwait(@CompSpec & " /C "&$Commande, "", @SW_HIDE) Error : Unable ti execute the external program. I am sure of the NT authorization on my SERVER (everyone, full control on the patch$ share and folder) On the workstation, the user is not administrator (so i use the runasset command with an domain admin user) Thank you for you help Ludovic ;Script Patch #include <File.au3> #include <Process.au3> $compte = 0 $logfile = "\\SERVER\patch$\0508.log" $var_poste = EnvGet ( "COMPUTERNAME" ) $var_user = EnvGet ( "USERNAME" ) $value = "Update" $Prod = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName") $CSDVer = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "CSDVersion") IF $CSDVer = 'Service Pack 4' AND $Prod = 'Microsoft Windows 2000' then $KB899588 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows 2000\SP5\KB899588", "Type") $KB896423 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows 2000\SP5\KB896423", "Type") IF $KB899588 <> $value then msgbox (0, "", "Installation Patch Microsoft KB899588", 2) ;filecopy("\\SERVER\patch$\W2k\MS0539\KB899588.exe", "c:\") RunAsSet("USER", DOMAIN"", "PASSWORD",2) $rc1 = _rundos("start copy \\SERVER\patch$\w2k\MS0539\KB899588.exe c:\") $rc2 = _rundos("start c:\KB899588.exe /quiet /norestart") $rc3 = _rundos("start del c:\KB899588.exe /q") RunAsSet() _FileWriteLog($logfile ,$var_poste & " Installation KB899588 " & $var_user) $compte = $compte + 1 ENDIF IF $KB896423 <> $value then msgbox (0, "", "Installation Patch Microsoft KB896423", 2) filecopy("\\SERVER\patch$\W2k\MS0543\KB896423.exe", "c:\") RunAsSet("USER", DOMAIN"", "PASSWORD",2) $rc4 = _rundos("start copy \\SERVER\patch$\w2k\MS0543\KB896423.exe c:\") $rc5 = _rundos("satrt c:\KB896423.exe /quiet /norestart") $rc6 = _rundos("del c:\KB896423.exe /q") ;filedelete("c:\KB896423.exe") RunAsSet() _FileWriteLog($logfile ,$var_poste & " Installation KB896423 " & $var_user) $compte = $compte + 1 ENDIF ENDIF Link to comment Share on other sites More sharing options...
Skruge Posted October 20, 2005 Share Posted October 20, 2005 Hi Ludovic, Return Runwait(@CompSpec & " /C "&$Commande, "", @SW_HIDE)Error : Unable ti execute the external program.The correct macro name is @Comspec, not @Compspec. Also, $Commande is not defined in the code you posted. Please post your complete code (in code blocks) or tell us what the value of $Commande should be. Also, SvenP has done extensive work in this area. Take a look at this topic: Using AutoIt to deploy patches [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] Link to comment Share on other sites More sharing options...
ludo10 Posted October 21, 2005 Author Share Posted October 21, 2005 I make a mistake tu put the text error here. I dont have this command in my sript, but it is in the Process.au3 include file. I find where is the problem It is with the runasset command and the /2 option (netonly) I use now /1 and it's work fine ;Script Patch #include <File.au3> #include <Process.au3> $compte = 0 $logfile = "\\SERVER\patch$\0510.log" $var_poste = EnvGet ( "COMPUTERNAME" ) $var_user = EnvGet ( "USERNAME" ) $value = "Update" $Prod = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName") $CSDVer = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "CSDVersion") IF $CSDVer = 'Service Pack 4' AND $Prod = 'Microsoft Windows 2000' then $KB899588 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows 2000\SP5\KB899588", "Type") $KB896423 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows 2000\SP5\KB896423", "Type") IF $KB899588 <> $value then msgbox (0, "", "Installation Patch Microsoft KB899588",2) filecopy("\\SERVER\patch$\w2k\MS0539\KB899588.exe", "c:\temp\") RunAsSet("USERADMIN", "DOMAIN", "PASSWORD",1) runwait("c:\temp\KB899588.exe /quiet /norestart",@SystemDir) filedelete("c:\temp\KB899588.exe") RunAsSet() _FileWriteLog($logfile ,$var_poste & " Installation KB899588 " & $var_user) $compte = $compte + 1 ENDIF IF $KB896423 <> $value then msgbox (0, "", "Installation Patch Microsoft KB896423",2) filecopy("\\SERVER\patch$\w2k\MS0543\KB896423.exe", "c:\temp\") RunAsSet("USERADMIN", "DOMAIN", "PASSWORD",1) runwait("c:\temp\KB896423.exe /quiet /norestart",@SystemDir) filedelete("c:\temp\KB96423.exe") RunAsSet() _FileWriteLog($logfile ,$var_poste & " Installation KB896423 " & $var_user) $compte = $compte + 1 ENDIF ENDIF IF $CSDVer = 'Service Pack 3' AND $Prod = 'Microsoft Windows 2000' then _FileWriteLog($logfile ,$var_poste & " ***POSTE EN SP3*** " & $var_user) ENDIF IF $CSDVer = 'Service Pack 2' AND $Prod = 'Microsoft Windows 2000' then _FileWriteLog($logfile ,$var_poste & " ***POSTE EN SP2*** " & $var_user) ENDIF IF $CSDVer = 'Service Pack 1' AND $Prod = 'Microsoft Windows 2000' then _FileWriteLog($logfile ,$var_poste & " ***POSTE EN SP1*** " & $var_user) ENDIF IF $compte > 0 then msgbox (0, "Reboot de votre machine", "Suite à l'installation de patchs Microsoft, votre pc va redémarrer", 3) Shutdown (6) ENDIF Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now