Jump to content

Script Working on Windows 2008 R2 but not Windows 2012 R2


Recommended Posts

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!

 

 

 

 

Link to comment
Share on other sites

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

_WinAPI_Wow64EnableWow64FsRedirection(FALSE)

 

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

Link to comment
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!

 

Link to comment
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

 

Regards,
 

Link to comment
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

 

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...