[SOLVED] VBScript: A under Reflect v6 perfect running script doesn't run under v7


[SOLVED] VBScript: A under Reflect v6 perfect running script doesn't...
Author
Message
Nick
Nick
Macrium Representative
Macrium Representative (4.1K reputation)Macrium Representative (4.1K reputation)Macrium Representative (4.1K reputation)Macrium Representative (4.1K reputation)Macrium Representative (4.1K reputation)Macrium Representative (4.1K reputation)Macrium Representative (4.1K reputation)Macrium Representative (4.1K reputation)Macrium Representative (4.1K reputation)Macrium Representative (4.1K reputation)
Group: Administrators
Posts: 2.3K, Visits: 14K
Joachim - 27 February 2018 2:02 PM

Hello Nick,

back again, but this week probably no possibilities to shut down my NAS. Therefore, further tests have to wait.

But in the meantime, I have summarized the logs of my script a bit, so that I can prove to you, that, since September 2016 under Reflect v6.x until exactly the day of the upgrade to version 7.1.x, my NAS was shutdown regularly by my script; over 500 times.

My script called "NAS & Shares.exe" (a compiled WScript) has two tasks and is called twice per Reflect backup task (see "Reflect-Backup-VBScript.vbs.txt") and writes his own log file.
The first call immediately before the real backup call in the Reflect backup task (VBScript, "Sub VBMain()") checks whether my NAS is switched on or not, remembers this state and possibly turns on the NAS.

After executing this real backup call in the Reflect backup task, depending on the backup type ("-full" or "-inc"), my NAS shuts down; with incremental backup then, if "NAS & Shares" had previously turned on the NAS or during full backups, my NAS will always shutdown due to the parameter "/NASoff".

This worked in total from September 2016 to February 04, 2018 under Reflect v6.x.

On February 05, 2018, I upgraded to Reflect v7.1.2885. And from that day on, shutting down the NAS does not work anymore; neither in the described dependency for "inc"-backups nor with the parameter "/NASoff". (The other tasks of "NAS & Shares.exe" are executed correctly.)

The problem, as far as I could identify with the help of my "NAS & Shares.log" (see "NAS & Shares.log.txt"), is the execution of the command "PLink.exe -load PuTTY-Session -l NAS_User -batch -pw "NAS-User_Password" sudo -S <<< "NAS-User_Password" /sbin/shutdown -P +1 ", because PLink now returns the return code 1 from inside the Reflect-VBScript environment. The 'PuTTY-Session' contains a valid SSH-access to NAS on a non-standard SSH-Port. PuTTY v0.67 and v0.70.
"NAS & Shares.exe" called about with a prompt with appropriate parameters, works!
Alternatively, after changing the NAS_User rights, I tested e.g. unsuccessfully: "PLink.exe -load PuTTY-Session -l NAS_User -batch -pw "NAS-User_Password" sudo "NAS-User_Password" /sbin/poweroff". Of course, this call also works from the command prompt.

I think there is hardly a stronger indication of a changed handling of VBScript files between Reflect v6 and Reflect v7.1.

Enclosed the used, original and complete, VBScript file "Reflect-Backup-VBScript.vbs.txt" (Reflect v6.x); the two "NAS & Schares.exe" calls are in "Sub VBMain ()".
Also I have attached the summarized log file of "NAS & Shares.exe" as "NAS & Shares.log.txt", too; I have marked manual explanations with "########".


I would like to see this as an indication of changes in handling between Reflect v6 and v7.1. I can not offer much more from my point of view, because I can not and do not want to get into the depths of Reflect.

Of course, I am happy to answer any questions.

If I can shut down my NAS again, I'll test "reflectbinv6.exe" as a precaution; but due to my logs and circumstances with little hope.

Best regards, Joachim.


Thanks for getting back.

There really isn't any difference whatsoever between the way v6 and v7 launches VBScript source code apart from that scheduled tasks under v7 run by default using the SYSTEM account.  I understand that this must seem frustrating because as far as you can tell the only change has been to upgrade Reflect to v7.  As the failure occurs when running manually AND when scheduled, that would seem to rule out the account as a problem. However, can you change the Scheduled task user to an Admin Account in v7? That way, your scheduled tasks will be running with the same access tokens as v7. 
 
And I run "Reflect-Backup-VBScript-Test.txt" (as .vbs) from VbsEdit (outside Reflect): -> It shutdown my NAS.

When you get the opportunity, please can you take VbsEdit out of the mix and try the same script from an elevated command prompt. Just enter the name of the script and press enter. The Windows Shell will run the script. Does this succeed in shutting down your NAS or not?

Finally, as previously mentioned, to show that Reflect v6 is no different to v7 just copy Reflectv6Bin.exe (using the link above) to the Reflect installation folder and launch by double clicking in Explorer. 

If this shows a difference between v6 and v7 then please can you open a support ticket so we can schedule a remote session to see what is happening:

https://www.macrium.com/support

Kind Regards

Nick - Macrium Support

Next Webinar


Joachim
Joachim
Junior Member
Junior Member (53 reputation)Junior Member (53 reputation)Junior Member (53 reputation)Junior Member (53 reputation)Junior Member (53 reputation)Junior Member (53 reputation)Junior Member (53 reputation)Junior Member (53 reputation)Junior Member (53 reputation)Junior Member (53 reputation)
Group: Forum Members
Posts: 41, Visits: 60

Hi Nick,

after a small night shift I have news and a reason to apologize for unnecessary trouble.

First I started Reflect with the "reflectbinv6.exe" (v6.3.1852). In any case, my NAS was shutdown successfully; i.e. both when calling the VBScript script from "VBScript Files" and from "Scheduled Tasks". This corresponds to previous knowledge.

Then I tested the same again under Reflect v7.1.2917 and found that for some reason my statement from 02/14/ was wrong; for which I expressly apologize.
Because actually my NAS will shutdown when I start the Reflect-backup-script from "VBScript Files"; see your post from 02/15/. However, my NAS will NOT shutdown when I run the script from "Scheduled Tasks".

This may be the real reason for the problems in the, between Reflect v6 and Reflect v7, modified user account for 'Scheduled Tasks'.
As you said - but I was initially unaware - is used under Reflect v6 the administrator account 'PC\Admin', while under v7 the SYSTEM account is used. Your repeated explicit reference was helpful.

Thus, the reason for my problem should be clarified; unfortunately, I have not found a solution. As a result, I also do not realize why my script "NAS & Shares.exe" under the SYSTEM account basically works - but just the PLink command used in it {iRet = gobjShell.Run ("C:\<Path\PLink.exe" -load PuTTY_Session -l NAS_User -batch -pw "NAS_User_Password" sudo /sbin/shutdown -P +1, 0, True)} not anymore; see also: "VBScript-Test-MRv7x.txt".

Do you have a solution idea?


jphughan
jphughan
Macrium Evangelist
Macrium Evangelist (13K reputation)Macrium Evangelist (13K reputation)Macrium Evangelist (13K reputation)Macrium Evangelist (13K reputation)Macrium Evangelist (13K reputation)Macrium Evangelist (13K reputation)Macrium Evangelist (13K reputation)Macrium Evangelist (13K reputation)Macrium Evangelist (13K reputation)Macrium Evangelist (13K reputation)
Group: Forum Members
Posts: 8.8K, Visits: 59K
Glad you're making progress.  In terms of the final push, ry going to Edit Defaults > Schedule, unchecking the option to run as SYSTEM, and then supplying the credentials for whatever user you were using back on V6.  That will cause V7 scheduled tasks to run the same way they did on V6, in which case running the job from the Scheduled Tasks tab should behave as expected.  It's not essential to V7 that scheduled tasks run as SYSTEM.  It can just be a bit more convenient because running scheduled tasks as a user means that if the user's password is changed, scheduled tasks break until Reflect is updated with the new credentials, or you have to create an admin account dedicated to Reflect in order to avoid that issue.

Edited 28 February 2018 3:51 PM by jphughan
Joachim
Joachim
Junior Member
Junior Member (53 reputation)Junior Member (53 reputation)Junior Member (53 reputation)Junior Member (53 reputation)Junior Member (53 reputation)Junior Member (53 reputation)Junior Member (53 reputation)Junior Member (53 reputation)Junior Member (53 reputation)Junior Member (53 reputation)
Group: Forum Members
Posts: 41, Visits: 60

SOLVED!

@Nick, @jphughan: The problem is solved by switching to the admin account. Thanks you for your help and information.
(In the meantime, I found out why the wrong information regarding the execution of the script came from "VBScript Files"; it was my fault.)


PS: In general, I'd like to say thank you for the great backup Software.


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Login

Explore
Messages
Mentions
Search