Andong

Script Working on Windows 2008 R2 but not Windows 2012 R2

7 posts in this topic

Hello Tech Gurus,

I have been using a script to launch some application for long time on windows 2008 R2 server, the script has been working perfectly fine. Recently we migrated the application server to Windows 2012 R2, then script stopped working.

the script is below:

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

;~ The script is passed the following parameters from external application in this order:
;~  1. IP Address
;~  2. Equipment Name
;~  3. Notes
;~  4. Custom Field 1
;~  5. Custom Field 2
;~  6. Custom Field 3
;~
;~ The following passes the sobriquet stored in Custom Field 1 to the MSTE node management utility

Local $pathToExe = "C:\Program Files (x86)\Nokia\MacroSTE\SERVTERM.exe"
If FileExists($pathToExe) Then
 Run($pathToExe & " -sobriquet " & """" & $CmdLine[4] & """")
Else
 MsgBox(0, "Application Not Found", "Unable to find: " & $pathToExe)
EndIf

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

things I have done:

1) checked the program working fine, path is correct;

2) the script returned a code 0

3) I simply tested the following command line only but not working

Run("C:\Program Files (x86)\Nokia\MacroSTE\SERVTERM.exe"), but if I use ShellExecute("C:\Program Files (x86)\Nokia\MacroSTE\SERVTERM.exe") works.

 

Anyone could help to advise what's wrong with Windows 2012 R2? I am using Autoit V3.3.8.1

Much appreciate for the help!

 

 

 

 

Share this post


Link to post
Share on other sites



if it was a 32 bit 2008 and now a 64 bit 2012, try disabling redirection.

_WinAPI_Wow64EnableWow64FsRedirection(FALSE)

 


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites
56 minutes ago, iamtheky said:

if it was a 32 bit 2008 and now a 64 bit 2012, try disabling redirection.

_WinAPI_Wow64EnableWow64FsRedirection(FALSE)

 

Thanks, but it seems it's an unknown function name.

I had put:

#include <WinAPIFiles.au3>
_WinAPI_Wow64EnableWow64FsRedirection (False)

it returned code 1 with error opening WinAPIFiles.au3, also tried WinAPI.au3, returned with unknown function name.

Any further suggestion? Thanks again!

 

Share this post


Link to post
Share on other sites
49 minutes ago, Andong said:

it returned code 1 with error opening WinAPIFiles.au3, also tried WinAPI.au3, returned with unknown function name.

which autoit version you are using?

Share this post


Link to post
Share on other sites

Try:

;~ If StringInStr(@OSArch, "64") Then DllCall('kernel32.dll', 'boolean', 'Wow64EnableWow64FsRedirection', 'boolean', False)

Local $pathToExe = "C:\Program Files (x86)\Nokia\MacroSTE\SERVTERM.exe"
If FileExists($pathToExe) Then
;~  ShellExecute($pathToExe, ' -sobriquet "' & $CmdLine[4] & '"')
    Run('"' & $pathToExe & '" ' & ' -sobriquet "' & $CmdLine[4] & '"')
Else
    MsgBox(16, "Application Not Found", "Unable to find: " & $pathToExe)
EndIf

 

1 person likes this

“The world won’t care about your self-esteem. The world will expect you to accomplish something Before you feel good about yourself.”

Share this post


Link to post
Share on other sites
39 minutes ago, AutoBert said:

which autoit version you are using?

Hello AutoBert,

it's v3.3.8.1. Thanks!

Share this post


Link to post
Share on other sites
40 minutes ago, Trong said:

Try:

;~ If StringInStr(@OSArch, "64") Then DllCall('kernel32.dll', 'boolean', 'Wow64EnableWow64FsRedirection', 'boolean', False)

Local $pathToExe = "C:\Program Files (x86)\Nokia\MacroSTE\SERVTERM.exe"
If FileExists($pathToExe) Then
;~  ShellExecute($pathToExe, ' -sobriquet "' & $CmdLine[4] & '"')
    Run('"' & $pathToExe & '" ' & ' -sobriquet "' & $CmdLine[4] & '"')
Else
    MsgBox(16, "Application Not Found", "Unable to find: " & $pathToExe)
EndIf

 

Hello Trong,

Much appreciate for the help! I had tried your script with Run function, no luck.

However I tried your option with ShellExecute, it works!

Not really sure why, but something changed and fixed the problem.

Thanks again for the great help!

Cheers,

Andong

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now