1
Vote

My script doesnt appear to be working.

description

Hi, I'm trying to get my script working but i've spent endless hours trying and I'm not having luck.

I finished configuring the scripts and did a test and its showing as nothing needing to be done. Yet when I run Snapraid Diff check via Elucidate it tells me all the files that were updated,moved, changed, etc

Here is my output on testing:

c:\scripts>powershell.exe -command ".\snapraid-helper.ps1" diff
Transcript started, output file is C:\scripts\logsSnapRAID.log
Directory: C:\scripts

Mode LastWriteTime Length Name

-a--- 18/05/2015 7:20 PM 0 logsSnapRAID.log

Transcript started, output file is C:\scripts\logsSnapRAID.log

Checking for Disk issues in Eventlog at 05/18/2015 19:20:51

TimeGenerated,EntryType,Source,Message

,,,

SnapRAID DIFF Job started on 05/18/2015 19:21:02

diff

SnapRAID DIFF Job finished on 05/18/2015 19:21:02

SUMMARY of changes - Added [0] - Deleted [0] - Moved [0] - Updated [0]

05/18/2015 19:21:02 No change detected. Nothing to do



^^ some reason its showing nothing. as if its not checking my backups. I think this has something to do with this section of code:
# run the snapraid DIFF command
$argument = "diff"
$exe = $config["SnapRAIDPath"] + $config["SnapRAIDExe"]
$argument  >> $TmpOutput
#$TmpOutputInRAM = get-content $TmpOutput  -readcount 100 -delim "`0" 
# NOTE the above Get-Content command is VERY VERY VERY VERY slow, so I am using the .Net function below to get the output of the Snapraid command into a variable
$TmpOutputInRAM = [System.IO.File]::ReadAllLines($TmpOutput)
foreach ($line in $TmpOutputInRAM){
    Add-Content $EmailBody $line
    Write-Host $line
Originally '$argument >> $TmpOutput' was & "$exe" $argument >> $TmpOutput but it seems to not work with that syntax. If I revert the change I get:
c:\scripts>powershell.exe -command ".\snapraid-helper.ps1"
Transcript started, output file is C:\scripts\logsSnapRAID.log
----------------------------------------
Checking for Disk issues in Eventlog at 05/18/2015 19:31:56
----------------------------------------
TimeGenerated,EntryType,Source,Message
,,,
----------------------------------------
SnapRAID DIFF Job started on 05/18/2015 19:32:37
----------------------------------------
The term '"C:\Program Files (x86)\snapraid-2.0"Snapraid.exe' is not recognized
as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correc
t and try again.
At C:\scripts\snapraid-helper.ps1:371 char:2
+ & <<<<  "$exe" $argument  >> $TmpOutput
    + CategoryInfo          : ObjectNotFound: ("C:\Program Fil....0"Snapraid.e
   xe:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Exception calling "ReadAllLines" with "1" argument(s): "Could not find file 'C:
\Users\fserv\AppData\Local\Temp\snapraid.out'."
At C:\scripts\snapraid-helper.ps1:374 char:49
+ $TmpOutputInRAM = [System.IO.File]::ReadAllLines <<<< ($TmpOutput)
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException


----------------------------------------
SnapRAID DIFF Job finished on 05/18/2015 19:32:37
----------------------------------------
SUMMARY of changes - Added [0] - Deleted [0] - Moved [0] - Updated [0]
----------------------------------------
05/18/2015 19:32:37 No change detected. Nothing to do
My full ps1 config is attached

file attachments

comments