cancel
Showing results for 
Search instead for 
Did you mean: 
0000000000
New Contributor

Scripting Limitations/unable to run certain commands in C:\WINDOWS\System32

I have the following script that I am deploying to a LogMeIn session with private session mode (using link to download LogMeIn agent and not calling card). The LogMeIn technician console and the agent are on the same machine. I am running both as the same AD user:

 

@echo off
C:\WINDOWS\System32\cmd.exe /c echo cmd test
C:\WINDOWS\System32\msg.exe "%username%" /time:0 Hello World

When I try deploying it via LogMeIn I will see the output of the 2nd line "cmd test" but for line 3 I get the following I get 'C:\WINDOWS\System32\msg.exe' is not recognized as an internal or external command, operable program or batch file.

 

 

Why am I able to run C:\WINDOWS\System32\cmd.exe but not C:\WINDOWS\System32\msg.exe?

  • I am able to run the 3rd line if I manually run it directly on command line outside of LogMeIn agent.
  • I still have this issue if I give UAC permission to the LogMeIn agent.
  • When I deploy a script that runs whoami I get the same output as running the command directly on cmd outside of LogMeIn.
  • If I deploy msg instead of the full path I get 'msg' is not recognized as an internal or external command,
    operable program or batch file. I don't get this when I run it directly on the command line outside of LogMeIn.

I'm stumped why this is happening and wonder if this means scripting is more limited than meets the eye.

1 ACCEPTED SOLUTION

Accepted Solutions
GlennD
GoTo Manager

Re: Scripting Limitations/unable to run certain commands in C:\WINDOWS\System32

Hi @0000000000, welcome to the community.

 

I have been informed that the best practice is to check if path C:\Windows\Sysnative\msg.exe exists and then refer msg.exe this way in the shell, otherwise you may call simply msg.exe. 

 

GlennD_0-1702503726972.png

 

It is recommended to use the following code in a CMD file:
"
if exist C:\Windows\Sysnative\msg.exe (
     C:\Windows\Sysnative\msg.exe blabla........
) else (
     msg.exe blabbla...
)
"

I hope this helps.

 

Glenn is a member of the GoTo Community Care Team.

Was your question answered? Please mark it as an Accepted Solution.
Was a post helpful or informative? Give it a Kudo!.
Do you want a new feature added? Make sure you Kudo (vote) for the Idea

Free user and admin training

View solution in original post

2 REPLIES 2
GlennD
GoTo Manager

Re: Scripting Limitations/unable to run certain commands in C:\WINDOWS\System32

Hi @0000000000, welcome to the community.

 

I have been informed that the best practice is to check if path C:\Windows\Sysnative\msg.exe exists and then refer msg.exe this way in the shell, otherwise you may call simply msg.exe. 

 

GlennD_0-1702503726972.png

 

It is recommended to use the following code in a CMD file:
"
if exist C:\Windows\Sysnative\msg.exe (
     C:\Windows\Sysnative\msg.exe blabla........
) else (
     msg.exe blabbla...
)
"

I hope this helps.

 

Glenn is a member of the GoTo Community Care Team.

Was your question answered? Please mark it as an Accepted Solution.
Was a post helpful or informative? Give it a Kudo!.
Do you want a new feature added? Make sure you Kudo (vote) for the Idea

Free user and admin training
0000000000
New Contributor

Re: Scripting Limitations/unable to run certain commands in C:\WINDOWS\System32

The OS I am running this on is Windows 11. What is weird is that running C:\Windows\Sysnative\msg.exe outside of LogMeIn shows that the file doesn't exist and trying to dir C:\Windows\Sysnative shows the directory doesn't exist.

Running it in LogMeIn works. I guess the LogMeIn applet is running as 32-bit process or running 32-bit command prompt and this folder is a virtual folder only accessible to 32 bit programs so they can run 64-bit programs if the virtual folder is specified in path if these resources are to be believed:
https://www.samlogic.net/articles/sysnative-folder-64-bit-windows.htm
https://learn.microsoft.com/en-us/windows/win32/winprog64/file-system-redirector