Group Policy Shutdown Scripts

G

Guest

Group Policy > Computer Configuration > Windows Settings > Script > Shutdown


I found this beautifully XP feature – running shutdown scripts before
windows is shutting down. Everything was great until I tried to copy files
from local PC to network share – It doesn’t work!

I guess that XP close network connections before start of executing shutdown
scripts.

1. is that true?
2. If it is, is there any way to disable closing network connection before
start of shutdown scripts?
 
P

Pegasus \(MVP\)

MiroslavK said:
Group Policy > Computer Configuration > Windows Settings > Script >
Shutdown


I found this beautifully XP feature - running shutdown scripts before
windows is shutting down. Everything was great until I tried to copy files
from local PC to network share - It doesn't work!

I guess that XP close network connections before start of executing
shutdown
scripts.

1. is that true?
2. If it is, is there any way to disable closing network connection before
start of shutdown scripts?

I haven't tried this but if I was in your position then I would
add some logging features to the shutdown script in order
to find out for myself, e.g. like so:

@echo off
echo %date% %time:~0,5% %UserName% >> c:\Logs.txt
net use >> c:\Logs.txt
copy "d:\SomeFile.doc" "Q:\Some Folder" 1>>c:\Logs.txt 2>>&1

The contents of c:\Logs.txt would tell you straight away what's
going one.
 
G

Guest

Thanks a lot pegasus, BUT I didn’t told that I’m using PowerShell script
instead of BAT files, and:

echo %date% %time:~0,5% %UserName% >> c:\Logs.txt
net use >> c:\Logs.txt
copy C:\test.txt R:\Users\Katic\test.txt 1>>c:\Logs.txt 2>>&1

Doesn’t work, I guess it has to written as PowerShell commands. Can you help
me with logging “net use†from PowerShell cripts ?
 
P

Pegasus \(MVP\)

Sorry, I don't use PowerShell. Why don't you run a batch
file until you know what's going on?

By the way, to prevent the script from pausing you should
add the /y switch to the copy command:

copy /y C:\test.txt R:\Users\Katic\test.txt 1>>c:\Logs.txt 2>>&1
 
G

Guest

Ok, never mind about powershell, I put your script in shutdown list as BAT
file, and here is results:



22-Oct-07 15:01
New connections will be remembered.

There are no entries in the list.

The system cannot find the drive specified.


In windows, BAT file works ok:


22.10.2007 15:09 miroslavk
New connections will be remembered.


Status Local Remote Network

-------------------------------------------------------------------------------
OK R: \\avalon\R Microsoft Windows Network
OK W: \\avalon\miroslavk Microsoft Windows Network
The command completed successfully.

1 file(s) copied.
 
P

Pegasus \(MVP\)

The key is the very first log line: When you run the script
while logged on then you run it as "miroslavk". When
you run it as part of the shutdown script then no user
name is defined, hence the script appears to run under
the "System" account. This account has no access rights
to networked resources.

This means that you cannot use this facility to save local
files to a network share. You may have to use roaming
profiles instead.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top