Jac Posted June 12, 2007 Share Posted June 12, 2007 Hi i would like to create a Windows Xp Service that basicly will do this When the user log on into windows, it verify if explorer.exe is running. If not, i want to start it. Why i want to do that ? Because i have a lot of pc that when users log in windows xp sp2, explorer.exe is not running and there is no icons and taskbar. If we start "explorer.exe" everything come back to normal. I have this problem since a few weeks and i did not find any solution wet. So i would like to try to make a service that check if explorer.exe is running. Here is my script While Not ProcessExists("explorer.exe") Run("explorer.exe") Exit WEnd I then use this tool to make my service (http://www.tacktech.com/display.cfm?ttid=197) My problem is that when i try to start the service, it start the file explorer.exe but nothing happen. I tried it with notepad.exe and still the same thing. The process start but i dont see the notepad windows Any help would be appreciated Thanks a lot ! Jac Link to comment Share on other sites More sharing options...
The Kandie Man Posted June 12, 2007 Share Posted June 12, 2007 (edited) Don't run AutoIt as a service. That is unnecessarily complicated. Instead, use the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run registry key to run the script. This code will cause the script to run every time a user logs into their account. If IsAdmin() Then RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Start Explorer Check", "REG_SZ", @ScriptFullPath) Else RegWrite("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Start Explorer Check", "REG_SZ", @ScriptFullPath) EndIf Make sure you compile the script as an executable before you run it so that the script adds an .exe path to the registry and not an .au3 path. Hopefully this works for you, did a brief test of it myself, but I didn't feel like ending explorer.exe to see if it actually worked. - The Kandie Man ;-) Edited June 12, 2007 by The Kandie Man "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire Link to comment Share on other sites More sharing options...
herewasplato Posted June 12, 2007 Share Posted June 12, 2007 ...there is no icons and taskbar...Take a look at:http://support.microsoft.com/default.aspx?...b;EN-US;Q318027Welcome to the forum.-MSP- [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Jac Posted June 13, 2007 Author Share Posted June 13, 2007 Hi The Kandie Man Thanks for helping me. I tried what you say but its not working. It has to be a service because if explorer.exe is not running, it dont load what is in the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run. I did a test by renaming this key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell="Explorer.exe" to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell="Explorer.exeOLD" I reboot my pc and i had the problem. No desktop icons and taskbar. So if i could put that as a service, maybe it would work Thanks for your help Jac Don't run AutoIt as a service. That is unnecessarily complicated. Instead, use the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run registry key to run the script. This code will cause the script to run every time a user logs into their account. If IsAdmin() Then RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Start Explorer Check", "REG_SZ", @ScriptFullPath) Else RegWrite("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Start Explorer Check", "REG_SZ", @ScriptFullPath) EndIf Make sure you compile the script as an executable before you run it so that the script adds an .exe path to the registry and not an .au3 path. Hopefully this works for you, did a brief test of it myself, but I didn't feel like ending explorer.exe to see if it actually worked. - The Kandie Man ;-) Link to comment Share on other sites More sharing options...
MHz Posted June 13, 2007 Share Posted June 13, 2007 How to create a service?Answer.Sticky: Support Forum FAQ Link to comment Share on other sites More sharing options...
Jac Posted June 13, 2007 Author Share Posted June 13, 2007 Thanks for helping me. This link helped me alot. But i still got a problem. HEre is my script---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#include "ServiceControl.au3"$servicename = "VerifyExplorer"$ServiceExist = RegRead("HKLM\SYSTEM\CurrentControlSet\Services\" & $servicename,"DisplayName")IF $ServiceExist <> "VerifyExplorer" Then _CreateService("", $servicename, $servicename, "C:\Verify_Explorer\srvany.exe", "LocalSystem", "", 0x110) RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\" & $servicename & "\Parameters", "Application", "REG_SZ", @ScriptFullPath) RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\" & $servicename, "Type", "REG_DWORD", 0x110)EndIf;Pour deleter le service;_DeleteService("", $servicename)While Not ProcessExists("explorer.exe") ;MsgBox(0,"info","info") Run("explorer.exe") Sleep(5000);give five seconds before looping again. This prevents the script from starting too many instances of explorerWEndExit---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------With that, it created my service perfectlyThe problem is if you disable process "explorer.exe" and try starting this service, "explorer.exe" will run but nothin will come back (icons and taskbar)But if you execute the script exe file, it work great !Any ideas ?ThanksHow to create a service?Answer.Sticky: Support Forum FAQ Link to comment Share on other sites More sharing options...
PACaleala Posted June 15, 2007 Share Posted June 15, 2007 I had the same problem but my solution was to change the registry. (HCU\software\microsoft\windowsNt\currentVersion\Winlogon RunLogonScriptSync=0) 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