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


VBScript: A under Reflect v6 perfect running script doesn't run under...
Author
Message
Joachim
Joachim
New Member
New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)
Group: Forum Members
Posts: 10, Visits: 14
Hello,
since upgrading Reflectfrom v6.x to v7.1 (.2885) I have a problem with my Backup-VBScript.
I use the original, by Reflect created, script, completed with some additional lines.The complete script runs perfectly under v6 - but not under v7.  

The Job of my completion is to shutdown my NAS after backup. So I have edited the original script direct under:
ExitCode = Backup (...)
with a line like:
objShell.Run """F:\<Path\VBScript-Test-MRv7x.exe"" 1"

"VBScript-Test-MRv7x.exe" is a compiled WScript that contains a command like:
"C:\Program Files\Putty\PLink.exe" -load NASShutdown -l SSd -batch -pw "<SSd-Password>"sudo /sbin/shutdown -P +1

This compiled "VBScript-Test-MRv7x.exe" works fine from outside the Reflect environment; this means, the NAS wasshutdown.
Copying the Reflect-Backup-VBScript into VbsEdit, remarking the "ExitCode = Backup (...)" line, and running an
objShell.Run """F:\<Path\VBScript-Test-MRv7x.exe "" 1" 
then my NAS will shutdown, too. See "VBScript-Test-MRv7x.vbs" as an example.

In result, I think my script and my environment to shutdown my NAS is working. 
But why doesn't shutdown my NAS when the script is called from inside the Reflect v7 environment? And why doesn't run myold v6-script under v7 with the same problem?

Thanks for help, Joachim.

My environment: Windows 7, x64, Build 7601 (actually), Reflect 7.1.2885, Synology NAS with DSM 6.1.5-15254.


Tags
Joachim
Joachim
New Member
New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)
Group: Forum Members
Posts: 10, Visits: 14
Joachim - 14 February 2018 6:04 PM
Hello,
since upgrading Reflectfrom v6.x to v7.1 (.2885) I have a problem with my Backup-VBScript.
I use the original, by Reflect created, script, completed with some additional lines.The complete script runs perfectly under v6 - but not under v7.  

The Job of my completion is to shutdown my NAS after backup. So I have edited the original script direct under:
ExitCode = Backup (...)
with a line like:
objShell.Run """F:\<Path\VBScript-Test-MRv7x.exe"" 1"

"VBScript-Test-MRv7x.exe" is a compiled WScript that contains a command like:
"C:\Program Files\Putty\PLink.exe" -load NASShutdown -l SSd -batch -pw "<SSd-Password>"sudo /sbin/shutdown -P +1

This compiled "VBScript-Test-MRv7x.exe" works fine from outside the Reflect environment; this means, the NAS wasshutdown.
Copying the Reflect-Backup-VBScript into VbsEdit, remarking the "ExitCode = Backup (...)" line, and running an
objShell.Run """F:\<Path\VBScript-Test-MRv7x.exe "" 1" 
then my NAS will shutdown, too. See "VBScript-Test-MRv7x.vbs" as an example.

In result, I think my script and my environment to shutdown my NAS is working. 
But why doesn't shutdown my NAS when the script is called from inside the Reflect v7 environment? And why doesn't run myold v6-script under v7 with the same problem?

Thanks for help, Joachim.

My environment: Windows 7, x64, Build 7601 (actually), Reflect 7.1.2885, Synology NAS with DSM 6.1.5-15254.


Sorry, can't see my "VBScript-Test-MRv7x.vbs". Therefore again.
jphughan
jphughan
Most Valuable Professional
Most Valuable Professional (3.3K reputation)Most Valuable Professional (3.3K reputation)Most Valuable Professional (3.3K reputation)Most Valuable Professional (3.3K reputation)Most Valuable Professional (3.3K reputation)Most Valuable Professional (3.3K reputation)Most Valuable Professional (3.3K reputation)Most Valuable Professional (3.3K reputation)Most Valuable Professional (3.3K reputation)
Group: Forum Members
Posts: 2.4K, Visits: 16K
Are these failures occurring when calling a scheduled task?  If so, Reflect V7 changed to running scheduled jobs under the local SYSTEM account by default, whereas V6 required you to provide admin user credentials to run scheduled backups.  This tripped up someone else here who upgraded to V7 and had his Robocopy job start to fail because the SYSTEM account of course didn't have permissions on the target NAS.  To return to the old user behavior, go to Edit Defaults > User and provide whatever credentials you were using back on V6.

Joachim
Joachim
New Member
New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)
Group: Forum Members
Posts: 10, Visits: 14
No, these failures occur when calling from scheduled task and when starting the vbscript manually!
Same you see, if you test my "VBScript-Test-MRv7x.vbs" as example.
jphughan
jphughan
Most Valuable Professional
Most Valuable Professional (3.3K reputation)Most Valuable Professional (3.3K reputation)Most Valuable Professional (3.3K reputation)Most Valuable Professional (3.3K reputation)Most Valuable Professional (3.3K reputation)Most Valuable Professional (3.3K reputation)Most Valuable Professional (3.3K reputation)Most Valuable Professional (3.3K reputation)Most Valuable Professional (3.3K reputation)
Group: Forum Members
Posts: 2.4K, Visits: 16K
Ok, unfortunately I'm not familiar with VBScript (just PowerShell and a bit with batch files), so I personally wouldn't be the right person to help troubleshoot, but it would certainly be useful to post your script files.  Since I imagine VBS files are blocked, just change their extension to TXT before posting.

Joachim
Joachim
New Member
New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)
Group: Forum Members
Posts: 10, Visits: 14
jphughan - 14 February 2018 7:42 PM
Ok, unfortunately I'm not familiar with VBScript (just PowerShell and a bit with batch files), so I personally wouldn't be the right person to help troubleshoot, but it would certainly be useful to post your script files.  Since I imagine VBS files are blocked, just change their extension to TXT before posting.

Ah, thank you. I could have imagined it ;-).

Also here my "VBScript-Test-MRv7x.vbs" as "VBScript-Test-MRv7x.txt" again.


Attachments
VBScript-Test-MRv7x.txt (1 view, 4.00 KB)
Joachim
Joachim
New Member
New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)
Group: Forum Members
Posts: 10, Visits: 14

Allow me a brief explanation of the "VBScript-Test-MRv7x.vbs" script.
First, the variables are to be defined appropriately. If the script works fine then please compile (e.g. VbsEdit 8.3732 by Adersoft; www.vbsedit.com).
Then paste the compiled .exe file into a Reflect backup VBScript (for example, directly behind the backup-command-line) and test it in this environment - for example, shutting down a NAS. This does not work for me; giRet, the PLink command, returns the error code 1.

The two test options 1 and 2 in "VBScript-Test-MRv7x.vbs" correspond to both possibilities that I have tested so far. Test 1 and Test 2 do not work under Reflect v7. Test 2 worked under Reflect v6 but also not under v7; I had not tested test 1 under v6.


Nick
Nick
Macrium Representative
Macrium Representative (2.3K reputation)Macrium Representative (2.3K reputation)Macrium Representative (2.3K reputation)Macrium Representative (2.3K reputation)Macrium Representative (2.3K reputation)Macrium Representative (2.3K reputation)Macrium Representative (2.3K reputation)Macrium Representative (2.3K reputation)Macrium Representative (2.3K reputation)
Group: Administrators
Posts: 1.3K, Visits: 7.2K
Joachim - 15 February 2018 8:08 AM

Allow me a brief explanation of the "VBScript-Test-MRv7x.vbs" script.
First, the variables are to be defined appropriately. If the script works fine then please compile (e.g. VbsEdit 8.3732 by Adersoft; www.vbsedit.com).
Then paste the compiled .exe file into a Reflect backup VBScript (for example, directly behind the backup-command-line) and test it in this environment - for example, shutting down a NAS. This does not work for me; giRet, the PLink command, returns the error code 1.

The two test options 1 and 2 in "VBScript-Test-MRv7x.vbs" correspond to both possibilities that I have tested so far. Test 1 and Test 2 do not work under Reflect v7. Test 2 worked under Reflect v6 but also not under v7; I had not tested test 1 under v6.


Hi

Thanks for posting.

No, these failures occur when calling from scheduled task and when starting the vbscript manually!


By 'Manual' do you mean right click on the script and selecting 'Run Now' ?



This is exactly the same in v6 and v7. There is no change. In fact the only difference between v6 and v7 with any script execution is that scheduled tasks in v7 by default sun as SYSTEM,.

Reflect doesn't actually 'run' the script when selecting 'Run Now..'. Scripts are run by calling 'ShellExecute' and the Windows Shell will pass the script name as a parameter to 'wscript.exe'. This is the same as entering the script file path in the Windows 'Start' search bar. 

Kind Regards

Nick - Macrium Support

Edited 15 February 2018 11:54 AM by Nick
Joachim
Joachim
New Member
New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)New Member (11 reputation)
Group: Forum Members
Posts: 10, Visits: 14

Hi Nick,

thank you for information.

Yes, with 'Manual' I mean the script execution from "VBScript-Dateien" ("VBScript Files") or from "Geplante Sicherungen" ("Schedules Tasks").

But I don't believe, that there are no differences between vb-scripting under v6 and v7.

My script that shutdown my NAS after backup runs over month - since upgrading to v7 my NAS never was shutdown - and it is the same script and the rest of my environment is unchanged.

But we can simple look at the possible problem...
Can you compile my script and is it possible to test it outside of Reflect? If it runs without error, can you test it again from inside Reflect?
The difference here is, that my script when running outside Reflect, the NAS shuts down (giRet = 0). If the same script runs from inside Reflect, the NAS was not shutdown (giRet = 1).

Why is running the same (compiled) script outside from Reflect without this problem, but from inside Reflect with this problem?

My next test was to copy the whole Reflect-Backup-Script to "VbsEdit", comment out the 'Backup-command lines' etc. and start the rest from inside VbsEdit, so, that my compiled Script ("VBScript-Test-MRv7x.exe") is running in an VBScript-container. Similar when running under Reflect.
See: "Reflect-Backup-VBScript-Test.txt".
What can I tell? The script shut down my NAS. So, there are no errors within the Backup-VBScript ("Reflect-Backup-VBScript-Test.vbs") that prevent the NAS from shutting down.

I am at a loss.

Best regards, Joachim.


Attachments
Nick
Nick
Macrium Representative
Macrium Representative (2.3K reputation)Macrium Representative (2.3K reputation)Macrium Representative (2.3K reputation)Macrium Representative (2.3K reputation)Macrium Representative (2.3K reputation)Macrium Representative (2.3K reputation)Macrium Representative (2.3K reputation)Macrium Representative (2.3K reputation)Macrium Representative (2.3K reputation)
Group: Administrators
Posts: 1.3K, Visits: 7.2K
But I don't believe, that there are no differences between vb-scripting under v6 and v7.


Honestly, there is no difference whatsoever. ​​

v6
void  OnVBSExecute()
{
    ShellExecute(NULL, _T("open"), ListItem.m_csFileName, _T(""), _T(""), SW_NORMAL);
}
​​
v7
void  OnVBSExecute()
{
    ShellExecute(NULL, _T("open"), ListItem.m_csFileName, _T(""), _T(""), SW_NORMAL);
}

Why is running the same (compiled) script outside from Reflect without this problem, but from inside Reflect with this problem?


How have you run the script outside of Reflect? ​​ Macrium Reflect runs with Elevated Privileges, this affects the process tokens though is no different between v6 and v7.  What happens if you run the script from an Elevated (Run as Administrator) command prompt?


Kind Regards

Nick - Macrium Support

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search