Jump to content

Win XP - Run script while shutdown


fidel
 Share

Recommended Posts

Hello,

i am trying to do the following on a Windows XP Prof. SP2 machine:

--

1. While Shutdown start a .bat file

2. Bat file unmapps network drives

3. Bat file remaps a specific network drive

4. Bat file backups some data to the newly mounted backup/network drive.

--

Well thats the theory

As using planed tasks in XP are not able to be executed while running shutdown i was forced / or feel'd forced to use this method:

--

* Start

* Run

* gtmedit.msc

* Computer configuration

* Windows Settings

* Scripts

* Shutdown

--

to execute my batch file.

Well my batch file itself works if i do execute it while PC is in normal usage / running but it seems like it does not work If i do execute the script like mentioned above.

Does not work means: script is executed but seems to have problems handling the network.

If i change the script to a local copy (not network based) it works totally.

So, as i am new to the mentioned method to run scripts while shutdown: IS there a known problem to use network-shares/mounts via "net use" in this state of shutting down a XP machine ?

any ideas ?

Feedback is heavily appreciated.

Thanks

fidel

Link to comment
Share on other sites

forgot to add the script:

--

REM unmount drive

net use z: /delete

REM remount drive

net use z: \\IP\SHARE /User:myusername password

REM tried both remount ideas

REM net use z: \\IP\Share password /User:myusername

REM lets do some copy action

xcopy /s /y "C:\bla\blub\*" Z:\Backup

--

Link to comment
Share on other sites

As using planed tasks in XP are not able to be executed while running shutdown ...

Can you be a little bit more specific why you are "not able" to run your shutdown script? Any error messages, or what?

Hi

regarding using default Tasks:

Default planned Tasks dont offer an "execute on shutdown optinon" at all.

Regarding the idea to use gpedit -> shutdown scripts:

well the script itself is executed, but it seems like i.e some commands dont work at this stage.

Means: the map'ing of the network drive writes no output to my log ..... which logs each batch file command. (not included in the example above)

So basically i am just asking if i am correct and that using this way to execute bat files during shutdown is limited or not.

best regards

fidel

Link to comment
Share on other sites

As using planed tasks in XP are not able to be executed while running shutdown ...

Can you be a little bit more specific why you are "not able" to run your shutdown script? Any error messages, or what?

Hi

regarding using default Tasks:

Default planned Tasks dont offer an "execute on shutdown optinon" at all.

Regarding the idea to use gpedit -> shutdown scripts:

well the script itself is executed, but it seems like i.e some commands dont work at this stage.

Means: the map'ing of the network drive writes no output to my log ..... which logs each batch file command. (not included in the example above)

So basically i am just asking if i am correct and that using this way to execute bat files during shutdown is limited or not.

best regards

fidel

well somehow solved.

Works if i use gpedit to add a user logoff script but not a machine shutdown script

guess my basic idea was correct regarding using net use during shutdown stage.

thanks anyways

Link to comment
Share on other sites

I have not used a shutdown script myself, but I know it *should* be working, as it should be run before the actual shut down is initiated.

See here http://www.windows-help-central.com/window...own-script.html for one of the many documents on the Internet.

Link to comment
Share on other sites

I have not used a shutdown script myself, but I know it *should* be working, as it should be run before the actual shut down is initiated.

See here http://www.windows-help-central.com/window...own-script.html for one of the many documents on the Internet.

hehe.

Thanks for research. but basicly you can try that pretty easy yourself ( if you are interessted)

I have choosen this method at beginning as i expected it to work too.

After several shutdown und restart i had enough and used a working alternative as mentioned above (using the logout idea).

i dont think it does work with all functions (using the shutdown idea)....cause otherwise my backup would be executed.

anyway. Thanks for response.

Best regards

fidel

Link to comment
Share on other sites

  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy