Sign in to follow this  
Followers 0
shornw

Windows error?

5 posts in this topic

#1 ·  Posted (edited)

...someone out there may be able to provide a workaround.

Right here go's....XP SP2 disables the Messenger Service on PC which is perfectly valid for home users...NOT domains tho as there are very definately applications on a network, hence the script to enable the Service.

The service has to be changed to Manual in order to start it then changed to Automatic so it starts on subsequent restarts. If I do this in the GUI it starts OK, if I apply the registry change it changes the state to Manual (3) but the _RunDOS wont start the service. Once the Service has been started the _RunDOS command works fine.

I know I can change the state to Automatic and wait for the machine to be re-booted but I work in a large 24/7 environment where sometimes the machines arent restarted for days, plus I want to know what the problem is.

regWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Messenger", "start", "REG_DWORD", 3)

sleep(3000)

#include <Process.au3>

$rc = _RunDos("net start messenger")

The Sleep() was a vain hope that it required a time to register the change of state...

Any ideas???? many thanks

Strangely...if I change the Service state using the script I cant start the service in the GUI unless I select manual again in the GUI.

Edited by shornw

[font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]

Share this post


Link to post
Share on other sites



Use a hex number in the RegWrite line. "0x3"

Share this post


Link to post
Share on other sites

Hi MHz...I tried that but the service wont start from the script until it has been started either with a reboot or by:

1. Disabling the sevice in the GUI

2. Setting the service to manual and restarting it but via the GUI

Once the Service has been started I can Start/Stop it at will with a script......guess it's just another 'feature' of Windows.

As I said in the main post, it's not a huge issue...I can set it to Automatic and that will cover 90% of desktops, it's just not an ideal.

More interestingly I managed to get the script to work under Users log-in, shame it had to be in two exe's but RunAsSet will only work on Run and RunWait. One exe sets permissions and then runs a second with the RegWrite...Any ideas as to a way of doing it in a single script, I've looked but nothing leaps out at me.

Thx again


[font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]

Share this post


Link to post
Share on other sites

Any ideas as to a way of doing it in a single script, I've looked but nothing leaps out at me.

Try this function which will execute first when the script starts and will restart as Admin. Fill in the RunAsSet parameters. Requires the AutoIt Beta for the switch used. Place it anywhere within your script.

Func OnAutoItStart()
    If Not $CMDLINE[0] Then 
        RunAsSet('user', 'domain', 'password')
        Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptFullPath & '" /admin')
        RunAsSet()
        Exit
    ElseIf $CMDLINE[0] And $CMDLINE[1] <> '/admin' Then
        Exit
    EndIf
EndFunc

Share this post


Link to post
Share on other sites

hehehe...you never cease to amaze MHz. You could become my personal guru here :)

I will try this, cant do it just yet as I am on a different site for a few days, but once again ....Many thanks, I really do appreciate that you take the time to help us feebs


[font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0