Secure use of passwords in batch files?


Recommended Posts

  On 28/07/2010 at 23:33, Prt Scr said:

One thing for starters, youre missing a comma after the robocopy options:

1=/mir /dcopy:T /copy:DATO /xd,"D:\Patrick\Downloads" "D:\Patrick\Desktop" /xa:h,D:\Patrick,\\DOWNSTAIRS\Patrick$

Then theres the options that appear in the wrong place /xa:h

1=/mir /dcopy:T /copy:DATO /xd,"D:\Patrick\Downloads" "D:\Patrick\Desktop" /xa:h,D:\Patrick,\\DOWNSTAIRS\Patrick$

It should be:

1=/mir /dcopy:T /copy:DATO /xd /xa:h,"D:\Patrick\Downloads" "D:\Patrick\Desktop" ,D:\Patrick,\\DOWNSTAIRS\Patrick$

The next issue is why there are 3 sets of folders listed:

"D:\Patrick\Downloads" "D:\Patrick\Desktop" ,D:\Patrick,\\DOWNSTAIRS\Patrick$

As noted before, and in the top of the script, the ini file format i used was:

job number = robocopy optionscommasource foldercommadestination folder

No, those options are correct. This works on the command line:

robocopy.exe "D:\Patrick" \\DOWNSTAIRS\Patrick$ /mir /dcopy:T /copy:DATO /xd "D:\Patrick\Downloads" "D:\Patrick\Desktop" /xa:h

/xd means exclude directory. I don't want Downloads or Desktop copied.

  On 28/07/2010 at 23:46, unknownsoldierX said:

No, those options are correct. This works on the command line:

robocopy.exe "D:\Patrick" \\DOWNSTAIRS\Patrick$ /mir /dcopy:T /copy:DATO /xd/xa:h

/xd means exclude directory. I don't want Downloads or Desktop copied.

Then it needs to be:

1=/mir /dcopy:T /copy:DATO /xd "D:\Patrick\Downloads" "D:\Patrick\Desktop" /xa:h,D:\Patrick,\\DOWNSTAIRS\Patrick$

  On 29/07/2010 at 00:24, unknownsoldierX said:

Look back at my post. That's exactly what I have.

too many late nights....

Was thinking about this issue while i was on the train to my country hideout on thursday, and its my fault it isnt running, forgot you were backing up to a network location, the destination folder check is only checking and parsing errors for physical drives

sometimes im as thick as ****

what you see in the log is destination drive as ]

because my physical drive check first strips the letter of the drive (i.e. z:\ becomes z) to check to see if its the truecrypt drive which we know will fail a drivestatus request...when you shove a network path in there it goes from \\ to \, and fails when it requests the status of drive \

You can try the following code in the mean time , as a quick patch job, Ill fix it when get home in a couple of days, currently having to type this on a mac in country nsw and i hate macs....this has to be the worst keyboard in history, i swear it was made by the same company that makes tic tacs.....no useful keys like end or home or page up/down, cut&paste doesnt work as on a civilized pc...if it was mine id have heaved it out of the window by now, its taken 3 times as long to type this message on this hopeless apple crap...even the sinclair had a better keyboard than this

I actually threatened to stop talking to my family i they bought this thing...why oh why didnt i follow through....

Of course fixing the network path for the destination means now that ive woken up i will fix it for the source folder check as well

As i may have mentioned im not exactly as im my prime mentally as i was a few years ago when i was doing this gear in my sleep

replace this section

                ;get the pure letter of the drive to check against the truecrypt mounted drive letter for the current job
                ;if its the same, we already know it exists and we skip the next part of the drive check. If we dont check
                ;for a match here and the truyecrypt drive letter makes it into the next check it will FAIL as even though
                ;the truecrypt drive is mounted, it will report UNKNOWN to DriveStatus. This "error" is because TrueCrypt is a container, not a real drive.
                $CheckDestinationFolder = StringLeft($CopyDestination, 1)
                ;check destination drive exists - no point always testing if folder exists as the job may be creating a folder
                ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....")
                FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....")
                If $CheckDestinationFolder <> $TC_DriveLetter Then
                        $CheckDestinationFolder2 = DriveStatus(StringLeft($CopyDestination, 3))
                        Select
                                Case "UNKNOWN"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UNKNOWN" & _
                                        @CRLF & "ERROR returned message - UKNOWN - Drive may be unformatted (RAW).")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UNKNOWN" & _
                                        @CRLF & "Drive may be unformatted (RAW).")
                                        ;decrease the amount of successful jobs by 1
                                        $NumberOfJobs -= 1
                                        ;skip to next job
                                        ContinueLoop
                                Case "READY"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY")
                                Case "INVALID"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder &" exists and is accessible....FAILED: INVALID" & _
                                        @CRLF & "ERROR returned message - INVALID - May indicate the drive letter does not exist or that a mapped network drive is inaccessible.")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: INVALID" & _
                                        @CRLF & "ERROR returned message - INVALID - May indicate the drive letter does not exist or that a mapped network drive is inaccessible.")
                                        ;decrease the amount of successful jobs by 1
                                        $NumberOfJobs -= 1
                                        ;skip to next job
                                        ContinueLoop
                                Case "UNKNOWN"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UKNOWN" & _
                                        @CRLF & "ERROR returned message - INVALID - Drive may be unformatted (RAW).")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UKNOWN" & _
                                        @CRLF & "ERROR returned message - INVALID - Drive may be unformatted (RAW).")
                                        ;decrease the amount of successful jobs by 1
                                        $NumberOfJobs -= 1
                                        ;skip to next job
                                        ContinueLoop
                        EndSelect

                Else
                        ;write truecrypt container as destination to console/logfile
                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY (Using TrueCrypt Container)")
                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY (Using TrueCrypt Container)")
                EndIf

with:

                ;check for network path as destination
                $CheckNetworkDrive = StringLeft($CopyDestination, 2)
                If $CheckNetworkDrive = "\\" Then
                Else
                ;get the pure letter of the drive to check against the truecrypt mounted drive letter for the current job
                ;if its the same, we already know it exists and we skip the next part of the drive check. If we dont check
                ;for a match here and the truyecrypt drive letter makes it into the next check it will FAIL as even though
                ;the truecrypt drive is mounted, it will report UNKNOWN to DriveStatus. This "error" is because TrueCrypt is a container, not a real drive.
                $CheckDestinationFolder = StringLeft($CopyDestination, 1)
                ;check destination drive exists - no point always testing if folder exists as the job may be creating a folder
                ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....")
                FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....")
                If $CheckDestinationFolder <> $TC_DriveLetter Then
                        $CheckDestinationFolder2 = DriveStatus(StringLeft($CopyDestination, 3))
                        Select
                                Case "UNKNOWN"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UNKNOWN" & _
                                        @CRLF & "ERROR returned message - UKNOWN - Drive may be unformatted (RAW).")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UNKNOWN" & _
                                        @CRLF & "Drive may be unformatted (RAW).")
                                        ;decrease the amount of successful jobs by 1
                                        $NumberOfJobs -= 1
                                        ;skip to next job
                                        ContinueLoop
                                Case "READY"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY")
                                Case "INVALID"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder &" exists and is accessible....FAILED: INVALID" & _
                                        @CRLF & "ERROR returned message - INVALID - May indicate the drive letter does not exist or that a mapped network drive is inaccessible.")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: INVALID" & _
                                        @CRLF & "ERROR returned message - INVALID - May indicate the drive letter does not exist or that a mapped network drive is inaccessible.")
                                        ;decrease the amount of successful jobs by 1
                                        $NumberOfJobs -= 1
                                        ;skip to next job
                                        ContinueLoop
                                Case "UNKNOWN"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UKNOWN" & _
                                        @CRLF & "ERROR returned message - INVALID - Drive may be unformatted (RAW).")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UKNOWN" & _
                                        @CRLF & "ERROR returned message - INVALID - Drive may be unformatted (RAW).")
                                        ;decrease the amount of successful jobs by 1
                                        $NumberOfJobs -= 1
                                        ;skip to next job
                                        ContinueLoop
                        EndSelect

                Else
                        ;write truecrypt container as destination to console/logfile
                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY (Using TrueCrypt Container)")
                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY (Using TrueCrypt Container)")
                EndIf
                EndIf

User Credentials:  ACCEPTED
User Credentials:  Username and/or Password recognised on:  UPSTAIRS

Attempting to mount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....
Using command line:  "C:\Program Files\TeraCopy\TrueCrypt.exe" /q /v "\\DOWNSTAIRS\Locked$\backups" /lx /p password
Attempting to mount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....MOUNTED

Attempting to open job list file:  D:\Programs\backups\robocopy.ini ....
Attempting to open job list file:  D:\Programs\backups\robocopy.ini ....SUCCESSFUL

Processing jobs....

Job number:  1  starting...
Job number:  1  RoboCopy Options:  /mir /dcopy:T /copy:DATO /xa:h
Job number:  1  Source Folder:  "D:\Temp"
Job number:  1  Destination Folder:  "H:\Temp"
Job number:  1  Checking source folder:  "D:\Temp" exists....
Job number:  1  Checking source folder:  "D:\Temp" exists....SUCCESS
Job number:  1  Checking destination drive:  H exists and is accessible....
Job number:  1  Checking destination drive:  H exists and is accessible....FAILED: UNKNOWN
Drive may be unformatted (RAW).

1  total jobs submitted for  processing
0  of  1  jobs completed successfully

Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....
Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....FAILED
ExitCode:  0TrueCrypt returned error:  0
Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....UNMOUNTED

  On 30/07/2010 at 21:06, unknownsoldierX said:

User Credentials:  ACCEPTED
User Credentials:  Username and/or Password recognised on:  UPSTAIRS

Attempting to mount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....
Using command line:  "C:\Program Files\TeraCopy\TrueCrypt.exe" /q /v "\\DOWNSTAIRS\Locked$\backups" /lx /p password
Attempting to mount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....MOUNTED

Attempting to open job list file:  D:\Programs\backups\robocopy.ini ....
Attempting to open job list file:  D:\Programs\backups\robocopy.ini ....SUCCESSFUL

Processing jobs....

Job number:  1  starting...
Job number:  1  RoboCopy Options:  /mir /dcopy:T /copy:DATO /xa:h
Job number:  1  Source Folder:  "D:\Temp"
Job number:  1  Destination Folder:  "H:\Temp"
Job number:  1  Checking source folder:  "D:\Temp" exists....
Job number:  1  Checking source folder:  "D:\Temp" exists....SUCCESS
Job number:  1  Checking destination drive:  H exists and is accessible....
Job number:  1  Checking destination drive:  H exists and is accessible....FAILED: UNKNOWN
Drive may be unformatted (RAW).

1  total jobs submitted for  processing
0  of  1  jobs completed successfully

Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....
Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....FAILED
ExitCode:  0TrueCrypt returned error:  0
Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....UNMOUNTED

Back home again, on a windows machine

Okay, fair cop, i will always admit when ive made a mistake

In this case you got the above error because i used Select/EndSelect when i should have used Switch/EndSwitch in the drive status check

And i also doubled up: Case "UNKNOWN" instead of "NOTREADY" ...fixed

I can confirm that both hard drive and network destinations work with the corrections

I will add checking for a network source folder and then post the complete code later tonight

existing code

                ;check for network path as destination
                $CheckNetworkDrive = StringLeft($CopyDestination, 2)
                If $CheckNetworkDrive = "\\" Then
                Else
                ;get the pure letter of the drive to check against the truecrypt mounted drive letter for the current job
                ;if its the same, we already know it exists and we skip the next part of the drive check. If we dont check
                ;for a match here and the truyecrypt drive letter makes it into the next check it will FAIL as even though
                ;the truecrypt drive is mounted, it will report UNKNOWN to DriveStatus. This "error" is because TrueCrypt is a container, not a real drive.
                $CheckDestinationFolder = StringLeft($CopyDestination, 1)
                ;check destination drive exists - no point always testing if folder exists as the job may be creating a folder
                ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....")
                FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....")
                If $CheckDestinationFolder <> $TC_DriveLetter Then
                        $CheckDestinationFolder2 = DriveStatus(StringLeft($CopyDestination, 3))
                        Select
                                Case "UNKNOWN"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UNKNOWN" & _
                                        @CRLF & "ERROR returned message - UKNOWN - Drive may be unformatted (RAW).")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UNKNOWN" & _
                                        @CRLF & "Drive may be unformatted (RAW).")
                                        ;decrease the amount of successful jobs by 1
                                        $NumberOfJobs -= 1
                                        ;skip to next job
                                        ContinueLoop
                                Case "READY"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY")
                                Case "INVALID"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder &" exists and is accessible....FAILED: INVALID" & _
                                        @CRLF & "ERROR returned message - INVALID - May indicate the drive letter does not exist or that a mapped network drive is inaccessible.")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: INVALID" & _
                                        @CRLF & "ERROR returned message - INVALID - May indicate the drive letter does not exist or that a mapped network drive is inaccessible.")
                                        ;decrease the amount of successful jobs by 1
                                        $NumberOfJobs -= 1
                                        ;skip to next job
                                        ContinueLoop
                                Case "UNKNOWN"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UKNOWN" & _
                                        @CRLF & "ERROR returned message - INVALID - Drive may be unformatted (RAW).")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UKNOWN" & _
                                        @CRLF & "ERROR returned message - INVALID - Drive may be unformatted (RAW).")
                                        ;decrease the amount of successful jobs by 1
                                        $NumberOfJobs -= 1
                                        ;skip to next job
                                        ContinueLoop
                        EndSelect

                Else
                        ;write truecrypt container as destination to console/logfile
                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY (Using TrueCrypt Container)")
                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY (Using TrueCrypt Container)")
                EndIf
                EndIf

corrected:

                ;check for network path as destination
                $CheckNetworkDrive = StringLeft($CopyDestination, 2)
                If $CheckNetworkDrive = "\\" Then
                Else
                ;get the pure letter of the drive to check against the truecrypt mounted drive letter for the current job
                ;if its the same, we already know it exists and we skip the next part of the drive check. If we dont check
                ;for a match here and the truyecrypt drive letter makes it into the next check it will FAIL as even though
                ;the truecrypt drive is mounted, it will report UNKNOWN to DriveStatus. This "error" is because TrueCrypt is a container, not a real drive.
                $CheckDestinationFolder = StringLeft($CopyDestination, 1)
                ;check destination drive exists - no point always testing if folder exists as the job may be creating a folder
                ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....")
                FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....")
                If $CheckDestinationFolder <> $TC_DriveLetter Then
                        $CheckDestinationFolder2 = DriveStatus(StringLeft($CopyDestination, 3))
                        Switch $CheckDestinationFolder2
                                Case "UNKNOWN"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UNKNOWN" & _
                                        @CRLF & "ERROR returned message - UKNOWN - Drive may be unformatted (RAW).")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UNKNOWN" & _
                                        @CRLF & "Drive may be unformatted (RAW).")
                                        ;decrease the amount of successful jobs by 1
                                        $NumberOfJobs -= 1
                                        ;skip to next job
                                        ContinueLoop
                                Case "READY"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY")
                                Case "NOTREADY"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: NOTREADY" & _
                                        @CRLF & "ERROR returned message - NOTREADY - Typical of floppy and CD drives that do not contain media.")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: NOTREADY" & _
                                        @CRLF & "ERROR returned message - NOTREADY - Typical of floppy and CD drives that do not contain media.")
                                        ;decrease the amount of successful jobs by 1
                                        $NumberOfJobs -= 1
                                        ;skip to next job
                                        ContinueLoop
                                Case "INVALID"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder &" exists and is accessible....FAILED: INVALID" & _
                                        @CRLF & "ERROR returned message - INVALID - May indicate the drive letter does not exist or that a mapped network drive is inaccessible.")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: INVALID" & _
                                        @CRLF & "ERROR returned message - INVALID - May indicate the drive letter does not exist or that a mapped network drive is inaccessible.")
                                        ;decrease the amount of successful jobs by 1
                                        $NumberOfJobs -= 1
                                        ;skip to next job
                                        ContinueLoop

                        EndSwitch

                Else
                        ;write truecrypt container as destination to console/logfile
                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY (Using TrueCrypt Container)")
                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY (Using TrueCrypt Container)")
                EndIf
                EndIf

User Credentials:  ACCEPTED
User Credentials:  Username and/or Password recognised on:  UPSTAIRS

Attempting to mount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....
Using command line:  "C:\Program Files\TeraCopy\TrueCrypt.exe" /q /v "\\DOWNSTAIRS\Locked$\backups" /lx /p password
Attempting to mount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....MOUNTED

Attempting to open job list file:  D:\Programs\backups\robocopy.ini ....
Attempting to open job list file:  D:\Programs\backups\robocopy.ini ....SUCCESSFUL

Processing jobs....

Job number:  1  starting...
Job number:  1  RoboCopy Options:  /mir /dcopy:T /copy:DATO /xa:h
Job number:  1  Source Folder:  "D:\Temp"
Job number:  1  Destination Folder:  "H:\Temp"
Job number:  1  Checking source folder:  "D:\Temp" exists....
Job number:  1  Checking source folder:  "D:\Temp" exists....SUCCESS
Job number:  1  Checking destination drive:  H exists and is accessible....
Job number:  1  Checking destination drive:  H exists and is accessible....SUCCESS: DRIVE READY
Job number:  1  ROBOCOPY reports:  NO CHANGE **** PARTIAL SUCCESS **** - CHECK ROBOCOPY LOG OR FURTHER INFO

1  total jobs submitted for  processing
1  of  1  jobs completed successfully

Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....
Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....FAILED
ExitCode:  0TrueCrypt returned error:  0
Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....UNMOUNTED

Okay, script updated

Added:

* Checking for network paths as source/destination

* Domain/ComputerName extracted from path, Domain/ComputerName is then pinged to make sure it exists, is it passes then the share name is tested, if that passes, the copy job continues, otherwise as with other failures, it skips to the next job

Changed:

* Some of the text and labels, for example SUCCESS is replaced by OK

* Generally shortened long output strings as much as i thought i could and remain informative.

I thought id attach the script this time instead of bloating the thread any further. Just need to rename the extension from .txt to .au3 (the forum doesnt allow uploading of .au3)

tcrobocopy.txtFetching info...

As for your unmounting error, all i can say is that iuve looked into it from several angles and the only reason it can fail unmounting is if you have files to the truecrypt volume open. Dont have any programs trying to or actually accessing the volume. Make sure you dont have say explorer browsing that folder while the script is running...tat is as i may have said before, ids THE ONLY way i can get it to fail.

I don't get permission errors for robocopy anymore, so that is working better. But the drive still doesn't mount. It says it's mounted but it never actually mounts.

I think I found the problem. Notice this in the copy log:

Using command line:  "C:\Program Files\TeraCopy\TrueCrypt.exe" /q /v "\\DOWNSTAIRS\Locked$\backups" [b]/lx[/b] /p password

There should be a space between the /l and the x. I'm not sure how to fix it.

Copylog

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "D:\Programs\Backups\backups.au3"    

User Credentials:  ACCEPTED
User Credentials:  Username and/or Password recognised on:  UPSTAIRS

Mounting truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ...
Using command line:  "C:\Program Files\TeraCopy\TrueCrypt.exe" /q /v "\\DOWNSTAIRS\Locked$\backups" /lx /p password
Mounting truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ...MOUNTED

Open job list file:  D:\Programs\backups\Robocopy.ini ...
Open job list file:  D:\Programs\backups\Robocopy.ini ...OK

Processing jobs...

Job number:  1  starting...
Job number:  1  RoboCopy Options:  /mir /dcopy:T /copy:DT /xa:h
Job number:  1  Source Folder:  "D:\Temp"
Job number:  1  Destination Folder:  "H:\Temp"
Job number:  1  Source:  D:\Temp exists...
Job number:  1  Source:  D:\Temp exists...OK
Job number:  1  Destination:  H:\Temp exists...
Job number:  1  Destination:  H exists and is accessible....
Job number:  1  Destination:  H exists...OK: DRIVE READY
Job number:  1  ROBOCOPY reports:  NO CHANGE **** PARTIAL SUCCESS **** - CHECK ROBOCOPY LOG OR FURTHER INFO

1  total jobs submitted for  processing
1  of  1  jobs completed successfully

Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....
Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ...FAIL
ExitCode:  0TrueCrypt returned error:  0
Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....UNMOUNTED>Exit code: 0    Time: 2.814

Job_1_robocopy.log

-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows                              
-------------------------------------------------------------------------------

  Started : Fri Aug 06 12:03:59 2010

   Source : D:\Temp\
     Dest : H:\Temp\

    Files : *.*

  Options : *.* /S /E /COPY:DT /DCOPY:T /PURGE /MIR /XA:H /R:1000000 /W:30 

------------------------------------------------------------------------------

	                   0	D:\Temp\

------------------------------------------------------------------------------

               Total    Copied   Skipped  Mismatch    FAILED    Extras
    Dirs :         1         0         1         0         0         0
   Files :         0         0         0         0         0         0
   Bytes :         0         0         0         0         0         0
   Times :   0:00:00   0:00:00                       0:00:00   0:00:00

   Ended : Fri Aug 06 12:03:59 2010

  On 06/08/2010 at 17:09, unknownsoldierX said:

I don't get permission errors for robocopy anymore, so that is working better. But the drive still doesn't mount. It says it's mounted but it never actually mounts.

I think I found the problem. Notice this in the copy log:

Using command line:  "C:\Program Files\TeraCopy\TrueCrypt.exe" /q /v "\\DOWNSTAIRS\Locked$\backups" [b]/lx[/b] /p password

There should be a space between the /l and the x. I'm not sure how to fix it.

Copylog

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "D:\Programs\Backups\backups.au3"    

User Credentials:  ACCEPTED
User Credentials:  Username and/or Password recognised on:  UPSTAIRS

Mounting truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ...
Using command line:  "C:\Program Files\TeraCopy\TrueCrypt.exe" /q /v "\\DOWNSTAIRS\Locked$\backups" /lx /p password
Mounting truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ...MOUNTED

Open job list file:  D:\Programs\backups\Robocopy.ini ...
Open job list file:  D:\Programs\backups\Robocopy.ini ...OK

Processing jobs...

Job number:  1  starting...
Job number:  1  RoboCopy Options:  /mir /dcopy:T /copy:DT /xa:h
Job number:  1  Source Folder:  "D:\Temp"
Job number:  1  Destination Folder:  "H:\Temp"
Job number:  1  Source:  D:\Temp exists...
Job number:  1  Source:  D:\Temp exists...OK
Job number:  1  Destination:  H:\Temp exists...
Job number:  1  Destination:  H exists and is accessible....
Job number:  1  Destination:  H exists...OK: DRIVE READY
Job number:  1  ROBOCOPY reports:  NO CHANGE **** PARTIAL SUCCESS **** - CHECK ROBOCOPY LOG OR FURTHER INFO

1  total jobs submitted for  processing
1  of  1  jobs completed successfully

Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....
Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ...FAIL
ExitCode:  0TrueCrypt returned error:  0
Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....UNMOUNTED>Exit code: 0    Time: 2.814

Job_1_robocopy.log

-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows                              
-------------------------------------------------------------------------------

  Started : Fri Aug 06 12:03:59 2010

   Source : D:\Temp\
     Dest : H:\Temp\

    Files : *.*

  Options : *.* /S /E /COPY:DT /DCOPY:T /PURGE /MIR /XA:H /R:1000000 /W:30 

------------------------------------------------------------------------------

	                   0	D:\Temp\

------------------------------------------------------------------------------

               Total    Copied   Skipped  Mismatch    FAILED    Extras
    Dirs :         1         0         1         0         0         0
   Files :         0         0         0         0         0         0
   Bytes :         0         0         0         0         0         0
   Times :   0:00:00   0:00:00                       0:00:00   0:00:00

   Ended : Fri Aug 06 12:03:59 2010

I hate to tell you, but theres no difference whether you put a space in there or not.

Ive made some more changes and will post it after i test, after i get some sleep, its almost 5am here....

It makes a difference when I do it at the command line.

"C:\Program Files\TrueCrypt\TrueCrypt.exe" /v \\DOWNSTAIRS\Locked$\backups /l X /p password /s /q

Works.

"C:\Program Files\TrueCrypt\TrueCrypt.exe" /v \\DOWNSTAIRS\Locked$\backups /lX /p password /s /q

Does not work. No errors, but the volume doesn't mount.

  On 06/08/2010 at 19:18, unknownsoldierX said:

It makes a difference when I do it at the command line.

"C:\Program Files\TrueCrypt\TrueCrypt.exe" /v \\DOWNSTAIRS\Locked$\backups /l X /p password /s /q

Works.

"C:\Program Files\TrueCrypt\TrueCrypt.exe" /v \\DOWNSTAIRS\Locked$\backups /lX /p password /s /q

Does not work. No errors, but the volume doesn't mount.

Then you must have the only system in the world that does that because, quoting from the truecrypt documentation for mounting and unmounting (examples):

Dismount a volume mounted as the drive letter X (the main program window will not be displayed):

truecrypt /q /dx


Mount a volume called myvolume.tc using the password MyPassword, as the drive letter X. TrueCrypt will open an explorer window and beep; mounting will be automatic:

truecrypt /v myvolume.tc /lx /a /p MyPassword /e /b

Ill put the space in, but seriously, theres something weird in that i and the rest of the planet can use it without a space.

Okay

Added:

* Added/Left space after tc drive letter in command line for both mounting and unmounting

* Check that tc volume is still mounted BEFORE trying to unmount it (seemed a sane thing to do:) ) should clear up the errors you were getting when tc volume wasnt mounted in the first place

* A few other changes in the handling of errors when trying to copy to a tc volume that doesnt exist because it wasnt mounted!

tcrobocopy.txtFetching info...

Okay

Fixed:

* incorrect order of robocopy options (i finally read a manual)

Added:

* summary counters for excluded jobs (jobs in the ini file with a # in front of the number) and jobs with errors

* date time stamping of log file(s)

2 versions:

v1 - Outputs separate log files for the main script output and each job

tcrobocopy_seperate_logs..txtFetching info...

v2 (at request of OP) - Outputs all script and robocopy output to the one log file

tcrobocopy_all_in_one_log..txtFetching info...

  • 4 months later...

I was trying to find a solution for this problem, converting .bat files to .exe will not ever solve the problem because any intermediate programmer can get the password easily so I?ve created a new command line tool that can help many others like us to encrypt the .bat file using X509 certificate.

You can find my tool under: http://securebatch.codeplex.com/

Enjoy it!

-Firas

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • I almost picked one up...Best Buy has a heck of a time getting them, much less keep them in stock.
    • Microsoft bans LibreOffice developer's account without warning, rejects appeal by David Uzondu Recently, we reported on LibreOffice, accusing Microsoft of intentionally using complex file formats as a tactic to lock in users to Microsoft Office, hindering open source alternatives like LibreOffice. Now, Microsoft has banned LibreOffice developer, Mike Kaganski, from using its services, citing an "activity that violates [its] Services Agreement". According to Mike, this happened last Monday when he tried to send a technical email to the LibreOffice dev mailing list, which is a normal part of his routine, but Thunderbird returned an error saying the message couldn't be sent. His account was blocked upon retry, and he found himself completely logged out of his Microsoft account. Kaganski guessed that his mail and account were getting flagged by a bot or something, since he was quite sure that nothing in the mail violated Microsoft's terms of service. So he decided to file an appeal, a process which later made him call Redmond "miserably incompetent in IT." The automated system asked for his phone number, which he provided, only to be greeted by a "Try another method" error message. The problem was that there was no other method offered. He then decided to reach out to Microsoft support directly. After some digging, he found a link to contact the team, and there it was, a button asking him to "Sign in to Contact support". Now, you might go, "Hold up, how is he supposed to sign in to contact support when his problem is that he can't sign in in the first place?" As Kaganski himself put it: He eventually got to use his wife's account to file an appeal and finally received a message from support. The instructions inside asked him to go to the sign-in page and, when told the account is blocked, provide a phone number (something he had already tried). Microsoft ignored his detailed report of the failing process, marked his ticket as resolved without any real action, and simply closed it. He is yet to recover his account. As for the email he was trying to send, he was later able to use Gmail, and it went through with no problem. If you are interested, you can read the full email for yourself and see if it violates Microsoft's services agreement. Mike's not the only person who's had their account locked recently, with seemingly no way to recover it. On the 17th of last month, Reddit user u/deus03690 shared how Microsoft locked their account, which, among other things, contained 30 years of "irreplaceable photos and work" on OneDrive. Their appeal, like Mike's, has been fruitless so far. The user said Microsoft reached out 10 days later, asking them to fill out a recovery form and promising to help them "every step of the way," but they haven't heard from the company since.
    • It's like Microsoft hasn't learned anything from Internet Explorer fiascos. Or they weren't slapped hard enough financially for it...
    • Yes they're payroll taxes with some of it linked to share-based compensation for employees. So when the stock price was rising in q2 these charges also increased.
  • Recent Achievements

    • Apprentice
      MikeK13 went up a rank
      Apprentice
    • Week One Done
      andeyhawk65 earned a badge
      Week One Done
    • First Post
      Jake2530 earned a badge
      First Post
    • Explorer
      Deranox went up a rank
      Explorer
    • Week One Done
      John Volks earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      687
    2. 2
      ATLien_0
      259
    3. 3
      Xenon
      178
    4. 4
      neufuse
      135
    5. 5
      +FloatingFatMan
      100
  • Tell a friend

    Love Neowin? Tell a friend!