Solved

Net use loses connection

Posted on 2002-07-26
7
331 Views
Last Modified: 2013-12-28
Hello,

   I have a batch file that I run in order to back up a users computer before we reload it.  The batch file basically connects to a network share and copies the users files to a directory.  It then attempts to ghost the drive to that directory also.  This script used to work but now I'm having a problem.  Right before it gets to the ghost part it loses the connection to the share.  He is the batch file (sorry, it's a little long)

@echo off

::***** Check for CNAME and LNAME
if NOT %CNAME%!==! SET LNAME=%CNAME%

if exist f:\users\con goto skip_map
echo Correct drive mappings not found, attempting to map to \\cdrw2\wfc2bk
net use * /d /YES

net use g: \\cdrw2\wfc2bk
net use f: \\cdrw2\wfc2bk

if not exist f:\users\con echo Error mapping drives, please map them manually by using net use f: \\cdrw2\wfc2bk
if not exist f:\users\con goto finish

:skip_map
echo Checking for user directory
if exist f:\users\%LNAME%\con goto skip_userdir
mkdir f:\users\%LNAME%

:skip_userdir
if NOT exist f:\users\%LNAME%\con echo Error creating user directory
if NOT exist f:\users\%LNAME%\con goto finish


if exist f:\users\%LNAME%\*.zip del f:\users\%LNAME%\*.zip
if exist f:\users\%LNAME%\*.gho del f:\users\%LNAME%\*.gho
if exist f:\users\%LNAME%\*.00* del f:\users\%LNAME%\*.00*
if exist f:\users\%LNAME%\*.wri del f:\users\%LNAME%\*.wri
if exist f:\users\%LNAME%\*.txt del f:\users\%LNAME%\*.txt

start /w msgbox Check_VPN_Cert Please_make_sure_you_check_for_a_VPN_cert.__If_you_have_not,_please_do_so_before_hitting_OK. 40

%winbootdir%\Command\Xcopy32 F:\PUBLIC\BATCH\BatUtils\*.* C:\Windows\Command\*.* /h /r /k /y /d /c >NUL
if exist "C:\Program Files\WinZip\WZZIP.EXE" goto check_env
if not exist "C:\Program Files\WinZip\WINZIP32.EXE" goto NoWinZip
xcopy F:\PUBLIC\BATCH\WinZipCLU\*.* "C:\Program Files\WinZip\*.* /H /R /K /Y /C /D /F >NUL
regedit /s "C:\Program Files\WinZip\WZCLU.reg"
goto check_env

:check_env
::***** BAKDOS.BAT needs to be looked at again! jd - 8/17/01
::%winbootdir%\Command\strings win = inwin
::if %win%! == 1! goto cont
::if not %win%! == 1! call F:\PUBLIC\BATCH\BACKDOS.BAT
::goto finish

:cont
if %1!==! goto Show_Msg
%winbootdir%\Command\Strings flag = UPPER %1
if %flag%!==FULL! goto full
if %flag%!==DATA! goto data
if %flag%!==GHOST! goto full_backup

:Show_Msg
::start /w msgbox D&T_TRISTATE_BACKUP_UTILITY Used_for_both_Desktops_&_Laptops. 40
::start /w msgbox BACKUP_OPTIONS Yes=Data_only;_No=Full_w/GHOST;_Cancel=Exit. 123
::if errorlevel 7 goto full
::if errorlevel 6 goto data
::if errorlevel 2 goto exit

:full
set flag=full
goto Start_It

:data
::set flag=data
::goto Start_It

:Start_It
if exist F:\Users\%LNAME%\Finished.txt del F:\Users\%LNAME%\Finished.txt
echo BEGIN Backup of %LNAME% >F:\Users\%LNAME%\BackupLog.wri

:ProfileBak
echo.
echo Profile backup... (Cookies and Favorites)
echo.
if exist C:\Windows\Profiles\%LNAME%\COOKIES\CON   "C:\Program Files\WinZip\WzZip.exe" -p -r -ef -u -Jhrs -whs -bF:\Users\%LNAME% -x@F:\Public\Batch\Exclude.lst F:\Users\%LNAME%\Cookies.zip C:\Windows\Profiles\%LNAME%\COOKIES\*.* >>F:\Users\%LNAME%\BackupLog.wri
if exist C:\Windows\Profiles\%LNAME%\Favorites\CON "C:\Program Files\WinZip\WzZip.exe" -p -r -ef -u -Jhrs -whs -bF:\Users\%LNAME% -x@F:\Public\Batch\Exclude.lst F:\Users\%LNAME%\Favorites.zip C:\Windows\Profiles\%LNAME%\Favorites\*.* >>F:\Users\%LNAME%\BackupLog.wri

:BulkBak
echo.
echo Bulk backup... (ATS Portable, Sametime, Notes)
echo.
"C:\Program Files\WinZip\WzZip.exe" -P -r -ef -u -Jhrs -whs -bF:\Users\%LNAME% -x@F:\Public\Batch\Exclude.lst F:\Users\%LNAME%\Bulk.zip @F:\Public\Batch\Bulk.lst >>F:\Users\%LNAME%\BackupLog.wri

:outlook
if not exist C:\OUTLOOK\CON goto no_outlook
echo.
echo C:\Outlook backup... (no PST or PAB)
echo.
%winbootdir%\Command\Xcopy32 F:\PUBLIC\BATCH\OutMove\*.* C:\OUTLOOK\*.* /H /R /K /C /Y /F /D
if exist C:\Outlook\Profile*.reg del C:\Outlook\Profile*.reg
regedit /E C:\Outlook\Profile1.reg "HKEY_CURRENT_USER\Software\Microsoft\Windows Messaging Subsystem"
regedit /E C:\Outlook\Profile2.reg "HKEY_CURRENT_USER\Software\Policies\Microsoft\Office"
regedit /E C:\Outlook\Profile3.reg "HKEY_CURRENT_USER\Software\Microsoft\Exchange"
regedit /E C:\Outlook\Profile4.reg "HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\9.0\Outlook"
if not exist C:\Outlook\Proflwiz.exe goto No_Prof_Wiz
if exist C:\Outlook\Profile.ops attrib -s -h -r C:\Outlook\Profile.ops
if exist C:\Outlook\Profile.ops del C:\Outlook\Profile.ops
if exist C:\Outlook\Proflwiz.ini start /w C:\Outlook\Proflwiz.exe /S C:\Outlook\Profile.ops
:No_Prof_Wiz
"C:\Program Files\WinZip\WzZip.exe" -P -r -es -u -Jhrs -whs -bF:\Users\%LNAME% -x@F:\Public\Batch\Exclude.lst F:\Users\%LNAME%\Outlook.zip C:\Outlook\*.* >>F:\Users\%LNAME%\BackupLog.wri
:no_outlook

:PST_PAB_files
echo.
echo All PSTs and PABs backup...
echo.
ECHO BROAD SEARCH FOR OUTLOOK PST and PAB FILES
"C:\Program Files\WinZip\WzZip.exe" -P -r -es -u -Jhrs -whs -bF:\Users\%LNAME% F:\Users\%LNAME%\PSTPAB.zip @F:\Public\Batch\PSTPAB.lst >>F:\Users\%LNAME%\BackupLog.wri

:As2_Dir
if not exist C:\AS2\CON goto NoAS2
echo.
echo AS2 backup...
echo.
"C:\Program Files\WinZip\WzZip.exe" -P -r -es -u -Jhrs -whs -bF:\Users\%LNAME% F:\Users\%LNAME%\AS2.zip @F:\Public\Batch\AS2.lst >>F:\Users\%LNAME%\BackupLog.wri
:NoAS2

:ccData_Dir
if not exist C:\ccMobile\ccData1\CON goto NoccData
::if exist C:\Outlook\PROFILE2.REG goto ccBak
::if exist C:\Outlook\PROFILE4.REG goto ccBak
::if exist c:\ccMobile\*.pst goto ccBak
::if exist c:\ccMobile\*.pab goto ccBak
::if exist C:\CCMOBILE\CCUSER\*.pst goto ccBak
::if exist C:\CCMOBILE\CCUSER\*.pab goto ccBak
::if exist C:\CCMOBILE\ccData1\*.pst goto ccBak
::if exist C:\CCMOBILE\ccData1\*.pab goto ccBak
::ren C:\ccMobile\ccData1 *.old
::if not exist C:\ccMobile\ccData1\CON goto NoccData
:ccBak
echo.
echo ccMobile backup...
echo.
"C:\Program Files\WinZip\WzZip.exe" -P -r -es -u -Jhrs -whs -bF:\Users\%LNAME% -x@F:\Public\Batch\Exclude.lst F:\Users\%LNAME%\ccMobile.zip @F:\Public\Batch\ccMobile.lst >>F:\Users\%LNAME%\BackupLog.wri
:NoccData

:Data_Dir
if not exist C:\Data\CON goto No_Data_Dir
echo.
echo C:\DATA backup...
echo.
"C:\Program Files\WinZip\WzZip.exe" -P -r -es -u -Jhrs -whs -bF:\Users\%LNAME% -x@F:\Public\Batch\Exclude.lst F:\Users\%LNAME%\Data.zip C:\Data\*.* >>F:\Users\%LNAME%\BackupLog.wri
:No_Data_Dir

:Cli_Dir
if not exist C:\Client\CON goto No_Cli_Dir
echo.
echo C:\CLIENT backup...
echo.
"C:\Program Files\WinZip\WzZip.exe" -P -r -es -u -Jhrs -whs -bF:\Users\%LNAME% -x@F:\Public\Batch\Exclude.lst F:\Users\%LNAME%\Client.zip C:\Client\*.* >>F:\Users\%LNAME%\BackupLog.wri
:No_Cli_Dir

:Cli2
if not exist C:\Clients\CON goto No_Cli2_Dir
echo.
echo C:\CLIENTS backup...
echo.
"C:\Program Files\WinZip\WzZip.exe" -P -r -es -u -Jhrs -whs -bF:\Users\%LNAME% -x@F:\Public\Batch\Exclude.lst F:\Users\%LNAME%\Clients.zip C:\Clients\*.* >>F:\Users\%LNAME%\BackupLog.wri
:No_Cli2_Dir

:check_flag
echo Data_only_backup_complete >F:\Users\%LNAME%\Finished.txt
if %flag%!==full! goto full_backup
start /w msgbox FINISH Data_only_backup_complete. 40
goto end

:full_backup
::%winbootdir%\Command\msgbox FINISH Data_backup_complete.__Starting_GHOST. 40
echo Data_backup_complete.__Starting_GHOST.
::if exist f:\users\%LNAME%\cdrive.gho attrib -s -h -r f:\users\%LNAME%\cdrive.gho
::if exist f:\users\%LNAME%\cdrive.gho del f:\users\%LNAME%\cdrive.gho
:: CALL F:\PUBLIC\BATCH\GHOSTIT.BAT
::start /max %winbootdir%\Command\ghost.exe -clone,mode=dump,src=1,dst=f:\users\%LNAME%\cdrive.gho -batch -z1 -fx -span -auto -quiet -sure
echo F:
F:
echo cd \users\%LNAME%
cd\users\%LNAME%
f:\ghost.exe -clone,mode=dump,src=1,dst=f:cdrive.gho -batch -z1 -fx -span -auto
::C:
::cd\
goto finish

:exit
start /w msgbox WARNING YOU_HAVE_CHOSEN_TO_ABORT_THE_PROCESS! 30
goto finish

:end
cd C:\
msgbox COMPLETE Full_system_backup_has_finished.__Please_search_log_file_for_ERR! 30
::%winbootdir%\Command\start /MAX F:\Users\%LNAME%\BackupLog.wri
goto finish

:NoWinZip
msgbox PROBLEM! WinZip_not_found_on_system._Please_install_WinZip_7_and_try_again! 30
goto finish

:finish


Ok the section that has this:

echo F:
F:
echo cd \users\%LNAME%
cd\users\%LNAME%

after it attempts to change to that directory I get this error:

Current drive is no longer valid>

If ghost trys to run then it freezes the computer.  If i exit the batch file without running ghost, it gives that error, but then I type dir and it works.  I can then run ghost. The other users files (ie the zip files) are in the users directory, so the network drive works.  Please help.

Thanks.
0
Comment
Question by:ingenito
7 Comments
 
LVL 63

Expert Comment

by:SysExpert
ID: 7180533
I would make sure that the
net use * /d /YES
is working OK.
Check that the mapped drives are set up correctly and that the connections are OK.

You may need to add a short delay before mapping the drives after deleting.

I hope this helps !
0
 
LVL 63

Expert Comment

by:SysExpert
ID: 7180546
OK , I see you actually check that, which is good.

1) Do you get any error messages ?

I would logging messages around the start of Ghost .
Are you losing Drive F: ?

Can you try using g:, if F: dies ?

I hope this helps !

0
 

Author Comment

by:ingenito
ID: 7180580
Well the reason I net use to G: is because for some reason, when Novell is on Windows the first time you run net use it doesnt actually go to the computer you want it to.  Dont ask me why, but thats the way it is.  So the second time the drive actually gets mapped correctly.

No the mapping works, because the backup data shows up in the user's directory.  It's just at that moment when I try to change to F: and then cd to the user's directory.  If I do this:

echo F:
F:
echo cd \users\%LNAME%
cd\users\%LNAME%
goto finish

The batch file ends and the prompt says

Current drive is no longer valid>

but then If I do a dir at that prompt it works fine and the mapping comes back.  But since ghost sees the drive as not valid it locks up the machine.

0
Are end users causing IT problems again?

You’ve taken the time to design and update all your end user’s email signatures, only to find out they’re messing up the HTML, changing the font and ruining the imagery. What can you do to prevent this? Find out how you can save your signatures from end users today.

 
LVL 10

Expert Comment

by:aeklund
ID: 7180804
What is the contents of the F:\PUBLIC\BATCH\GHOSTIT.BAT
file, does it map any drivers in that file?
0
 
LVL 4

Expert Comment

by:CyberWizard
ID: 7181243
echo F:
F:
echo cd \users\%LNAME%
cd\users\%LNAME%
f:\ghost.exe -clone,mode=dump,src=1,dst=f:cdrive.gho -batch -z1 -fx -span -auto
::C:
::cd\
goto finish


I took me a while to check the script, but then I got to this part...

look at dst
shouldn't that be set to dst=f:\users\%LNAME%\cdrive.gho ?

cheers
0
 
LVL 1

Expert Comment

by:Computer101
ID: 7376250
Hello all,
I am Computer101 from Experts-Exchange and also an expert within this topic area. This uestion has been open a long time.  What I am going to do is allow feedback from the questioner and xperts.  If it is not resolved, I will delete or accept an answer based on the info I have been given, Experts, feel free to offer input.  I will monitor these questions for a period of 5-7 days and come back and evaluate.  I will have another moderator (who is also an expert in this topic area) look at the question also to ensure we do the right thing for this question.

Thank you
Computer101
E-E Admin
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 7757283
Question placed in PAQ

Computer101
E-E Admin
0

Featured Post

The problems with reply email signatures

Do you wish that you could place an email signature under a reply? Well, unfortunately, you can't. That great Exchange/Office 365 signature you've created will just appear at the bottom of an email chain. What a pain! Is there really no way to solve this? Well, there might be...

Join & Write a Comment

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now