Link to home
Start Free TrialLog in
Avatar of njava
njava

asked on

Troubles with Log off script

I run a Windows 2000 Domain logoff script that backs up Outlook mailboxes from individual computers to the server.

I have two logoff scripts, basically, one logoff.vbs that calls another backup.cmd. Logoff.vbs asks for user input and if yes, it runs backup.cmd

Easy enough except that backup.cmd doesn't run. It stops at PKZIP and then exits very quickly.  I can't see what's on the screen. The script works fine when I scroll to the SYSVOL, then to my policy and click on logoff.vbs. Backup.cmd also works fine if I set it as logoff script in my domain policy and if it is not called from logoff.vbs. However, I need user input.

I spent two days trying to figure it out and I have no clue.

Logoff.vbs
========
Set wshShell = WScript.CreateObject("Wscript.Shell")

strInput = MsgBox("Do you want to backup your e-mail?", vbQuestion + vbYesNo, "Select Yes or No")

If strInput = 6 Then wshShell.Run("backup.cmd") ' They pressed Yes
If strInput = 7 Then WScript.Quit ' They pressed No
+++++++++++++++++++++++++

backup.cmd
========
@ECHO OFF

ECHO Backing up your email and address book to server
ECHO Archiving your file locally

C:
CD\
CD "Documents and Settings\%username%\Local Settings\Application Data\Microsoft\Outlook\"

PKZIP OUTLOOK.ZIP Outlook.pst

ECHO Copying file to server

COPY OUTLOOK.ZIP H:\Email\*.*

ECHO Done!

PAUSE
++++++++++++++++
Avatar of JamesDS
JamesDS

njava

Put a pause command before and after the PKZIP command and post the error message - if there is one
Cheers
JamesDS
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
oBdA

Nice answer, I stand in awe!

Cheers

JamesDS
no idea really... but is the PKZIP command in the correct order? PKZIP Outlook.pst OUTLOOK.ZIP ??
DOH! ~(8(|), gotta stop staying up so late, and gotta start reading the questions better, backup.cmd does work.
Avatar of njava

ASKER

oBdA:
That was indeed the problem!!! I have a couple of notes.

1.  "wshShell.Run("backup.cmd",,true)" won't work - it will exit with error saying that you cannot use parenthesis when calling a Sub. The same line without parens should be used:

wshShell.Run "backup.cmd", 0, true

2. After I fixed wshShell.Run and attempted to run logoff.vbs I got another error
"The procedure entry point DoOpenPipeStream could not be located in the dynamic link library ScrRun.dll".

It happened because the version of scrrun.dll in %windir%\system32 was 5.0 and it should be 5.6 for the script to work.
"regsvr32 scrrun.dll" didn't fix the problem, so I downloaded Windows Scripting Machine (it's not the exact title but close) from Microsoft's website and voila, the script worked like a charm. Surprisingly though, my computer was the only one of 25 that had problems with scrrun.dll