Failed to create Junction - No selectable sources...

Apr 16, 2010 at 1:55 AM

Hi Anlan - looks like a great script but I am having trouble getting started with it.

I am executing it like this:

C:\Builds>powershell -command "& .\7zBackup.ps1 --type full --selection C:\Builds\BackupThese.txt --workdrive C --Prefix BuildServer01 --rotate 5 --logfile out.txt --destpath \\BackupServer01\CriticalData "

The entry in the selection file is:

includesource=C:\Documents and Settings\Administrator\Cookies|alias=Cookies

I have Junction and 7z.exe installed in the program files folders as you recommend - they are on the c drive.

 

C:\Program Files\SysInternalsSuite
C:\Program Files\7-Zip

This is the error I am getting

 

 ------------------------------------------------------------------------------
 Backup from sources
 -------------------------------
 - Cookies <== C:\Documents and Settings\Administrator\Cookies
Failed to create Junction [Cookies] to [C:\Documents and Settings\Administrator\Cookies]
 There are no selectable sources to backup. Quitting
True

I have tried backing up several different locations and I always the same error.

Do you have any suggestions for me to try.

Best Regards,

Paul

 

Apr 16, 2010 at 2:22 AM

Hello Anlan,

Problem solved I explicitly referenced the folder  --jbin C:\Program Files\SysInternalsSuite\Junction.exe and this worked.

Your documentation mentions c:\ProgramFiles\ which is not a windows folder.

My suggestion would be to have users put the paths for both Junction and 7z in the path environment variable then you wouldn't have to worry about it.

Also if you can't find junction.exe or 7z.exe then you should have a more clear error message.

I am going to use your program to backup some critical files on one of my servers - don't worry it is a virtual machine that I backup every night anyway. The 7zip backup will be easier to restore from for minor problems.

Next I am going to try the email notification.

I think the script looks great - I'll let you know how it works out.

Best Regards,

Paul

Coordinator
Apr 16, 2010 at 5:11 PM

Hi mooncaptain and thankyou for your feedback.

The problem you encountered deserve a deeper investigation: the script will automatically search for junction.exe not in C:\ProgramFiles but in %ProgramFiles% environment variable ($Env:ProgramFiles) or, better saying, in path %ProgramFiles\SysInternalsSuite\Junction.exe.
I would like to ask you which is the value of the path held in your %ProgramFiles% variable.

On the other hand, you're right on the fact the script does not check for the presence of junction.exe and 7z.exe before processing. I will surely amend this quickly.

Thank you again.

Bye,

Apr 21, 2010 at 7:09 PM

The Path environment variable is searched by a program for .exe and .dll files or possibly other executable files (.cmd, .bat) etc. In the case of junction.exe if a user appended this string

"C:\Program Files\SysInternalsSuite"

without the quote marks into the Path then the OS would look into that folder and all the others in the Path environment for Junction.exe

 

Open a command window and type Path and enter. You'll see all the paths available.

The path can be edited from Computer/properties/advanced and there are utilities and program interfaces that let you edit it as well.

 

Coordinator
Apr 22, 2010 at 8:37 AM

I know that ... but this is not the case.

If you lok at the code you will find that BkJunctionBin variable is set this way:

    if(!(IsVarDefined "BkJunctionBin")) {
        Set-Variable -name BkJunctionBin -value (Join-Path $Env:ProgramFiles "\7-zip\7z.exe") -scope Script
    }

This means this variable is always holding a full path to 7z.exe. When invoking an executable using it's full path ... the %path% environment variable is simply disregarded.

 

Apr 23, 2010 at 10:10 PM

OK, I understand but when I used the explicit parameter

--jbin C:\Program Files\SysInternalsSuite\Junction.exe

in the command line the backup worked and when I left it off it failed with the above message.

I am running this on Windows 2003 server with the latest (more or less) updates and Junction is indeed in the folder indicated.

 

 

Coordinator
Apr 26, 2010 at 3:07 PM

I figured it out.

I've found a bug in the script while checking vars and presence of necessary executables: it happened that in script 7zBackup.ps1 the checking phase of junction.exe was, in reality, checking the presence of 7z.exe (once again). I also assume you did not have the proper 7zbackup-vars.ps1 in the same folder where the script started from.

This bug will be fixed in next minor release.

Thank you.