Chimaera Posted March 30, 2015 Share Posted March 30, 2015 Im trying to do as the title says just for automation purposes on a button But im hitting the Windows Resource Protection could not start the repair service. error so i added the netstart command to make sure the service is started but i still cant get past the error even though the service is started Case $T4SFCScanButton3 Local $netstart = RunWait(@ComSpec & " /k " & "net start trustedinstaller", "", @SW_SHOW) Sleep(2000) RunWait(@ComSpec & " /k " & "sfc /scannow", "", @SW_SHOW) Anyone know a way to get round this? If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
ViciousXUSMC Posted March 30, 2015 Share Posted March 30, 2015 Since the /k and your cmd are just strings you can put them together as one string it will help make the use of ' and " a bit easier. Run(@ComSpec & " /k net start trustedinstaller", "", @SW_SHOW) As for the error, I assume you already tried both of these from the cmd itself to see if they work the way you intended? Link to comment Share on other sites More sharing options...
Chimaera Posted March 30, 2015 Author Share Posted March 30, 2015 yep once the service is started which i have verified it should work but i keep getting the error Thx for the option If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
ViciousXUSMC Posted March 30, 2015 Share Posted March 30, 2015 Perhaps #RequireAdmin Maybe when you run from CMD you had administrative rights but your AutoIt Script is calling user level CMD. Link to comment Share on other sites More sharing options...
iamtheky Posted March 30, 2015 Share Posted March 30, 2015 (edited) Bet a shiny nickel your button works fine in Safe Mode. I cant remember if we gave up on sfc at that point, or shortly thereafter. there it is: To resolve this problem, perform the System File Checker scan in safe mode, and make sure that the PendingDeletes and PendingRenames folders exist under %WinDir%WinSxSTemp. http://support.microsoft.com/en-us/kb/929833 Edited March 30, 2015 by boththose ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Chimaera Posted March 30, 2015 Author Share Posted March 30, 2015 (edited) I was running Admin Ill test safe mode tommoz at work thx Just seen a note somewhere doing research about and AV interfering so i killed mine and it work More testing to follow Edited March 30, 2015 by Chimaera If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
ViciousXUSMC Posted March 30, 2015 Share Posted March 30, 2015 (edited) So I tested and I have the same issue... Guess its a system protection thing? Anyways I gotta run for today but I tried a .bat file and it works(ish) so I thought to try something like this. May get you on the right track. #RequireAdmin #Include <File.au3> $pSFC = (@TempDir & "\SFC.bat") _FileCreate($pSFC) $fSFC = FileOpen($pSFC, 1) FileWriteLine($fSFC, "C:\Windows\System32\SFC /ScanNow") FileWriteLine($fSFC, "/pause") FileClose($fSFC) ShellExecute($pSFC) Edited March 30, 2015 by ViciousXUSMC Link to comment Share on other sites More sharing options...
TouchOdeath Posted March 24, 2016 Share Posted March 24, 2016 (edited) I realize this is a year old but heres the real answer (works on my win7 box): If StringInStr(@OSArch, "64") Then Run(@ComSpec & " /k " & @WindowsDir & "\Sysnative\sfc /scannow", "", @SW_SHOW) Else Run(@ComSpec & " /k " & @WindowsDir & "\System32\sfc /scannow", "", @SW_SHOW) EndIf Edited March 24, 2016 by TouchOdeath Link to comment Share on other sites More sharing options...
Chimaera Posted March 25, 2016 Author Share Posted March 25, 2016 14 hours ago, TouchOdeath said: \Sysnative\sfc im not sure this is meant to be there? If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
iamtheky Posted March 25, 2016 Share Posted March 25, 2016 (edited) Its fine, just also wrong. FileOpenDialog("" , "C:\windows\sysnative\" , "SFC (sfc.exe)") This by itself, unless you also turn off redirection, would open system32 on an x64 system from a 32bit install of AutoIt. Edited March 25, 2016 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Chimaera Posted March 25, 2016 Author Share Posted March 25, 2016 2 hours ago, iamtheky said: "C:\windows\sysnative\" On what OS does this occur i cannot see that folder on win 10? If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
TouchOdeath Posted March 25, 2016 Share Posted March 25, 2016 (edited) 4 hours ago, iamtheky said: Its fine, just also wrong. FileOpenDialog("" , "C:\windows\sysnative\" , "SFC (sfc.exe)") This by itself, unless you also turn off redirection, would open system32 on an x64 system from a 32bit install of AutoIt. You mean 32bit compile not install. Read: http://www.samlogic.net/articles/sysnative-folder-64-bit-windows.htm I'll supply another answer to this thread since neither of you 'like' my answer. Again, this works on my x64 system running W7, as far as other OS's, I don't know, test it yourselves. If StringInStr(@OSArch, "64") Then DllCall("kernel32.dll", "boolean", "Wow64EnableWow64FsRedirection", "boolean", 0) Run(@ComSpec & " /k " & @WindowsDir & "\System32\sfc /scannow", "", @SW_SHOW) DllCall("kernel32.dll", "boolean", "Wow64EnableWow64FsRedirection", "boolean", 1) Else Run(@ComSpec & " /k " & @WindowsDir & "\System32\sfc /scannow", "", @SW_SHOW) EndIf Edited March 25, 2016 by TouchOdeath Link to comment Share on other sites More sharing options...
iamtheky Posted March 25, 2016 Share Posted March 25, 2016 Quote You mean 32bit compile not install Unless F5 does a 32bit compile and then runs the script, then i do not mean compile. If it does, then maybe a directive would handle it as well... ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
TouchOdeath Posted March 28, 2016 Share Posted March 28, 2016 (edited) I'm going to make this crystal clear for everyone. I'm guessing boththose primary language isn't english. Heres the skinny on all this: When installing Autoit, if you have a 32bit system, when installed will always compile your script as a 32bit executable. So you won't even see the option to install 64bit because you can't run a 64bit program on a 32bit system, you'll get an error. If you have a 64bit system, when installing Autoit it will ask you if you want 'x64 tools' or 'x86 tools'. If you pick x64 it will always compile your scripts as a 64bit executable. If you pick x86, it will always compile your scripts as a 32bit executable. If you have scite4autoit installed you have the option to specify additional compile parameters to override the 'default' bit compile (regardless if you picked 'x64 tools' or x86 tools'). #AutoIt3Wrapper_UseX64=n The option above if 'n' will compile a 32bit executable, if 'y' will compile a 64bit executable. Regardless if you are running a 32bit OS or 64 bit OS. On 3/24/2016 at 0:45 PM, TouchOdeath said: If StringInStr(@OSArch, "64") Then Run(@ComSpec & " /k " & @WindowsDir & "\Sysnative\sfc /scannow", "", @SW_SHOW) Else Run(@ComSpec & " /k " & @WindowsDir & "\System32\sfc /scannow", "", @SW_SHOW) EndIf From a 64bit system (Windows Vista+), the above code will always work if compiled from a 32bit executable. It will always fail if compiled from a 64bit executable. Regardless if redirection is on or off. Edited March 28, 2016 by TouchOdeath Link to comment Share on other sites More sharing options...
iamtheky Posted March 28, 2016 Share Posted March 28, 2016 thats colorful language, except that the huge boner you have for compilation is blocking your view of scripts that are run WITHOUT being compiled. Or colloquially the 'F5' maneuver when Scite is open. My understanding is that certain things that relied on compile did not work, because it wasnt compiled. Unless my English fails me. ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) 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