i would suspect the script usually is started by some link thats properties say to run it as administrator. the original link that you created once was moved accidentally and someone made a new link to replace the missing one but didn't know the "Run as administrator" has to be checked
anyway, if your script is running from *.tBasic or *.tBasicC source through thincore (thinBasic.exe) or from bundled *.exe directly
you will find out if you right click the link that starts it on the "suspicious reacting engine" and check the properties.
for permanent solution follow the steps on the attached image where i suppose your script is running via thinCore from script source.
If running from bundled exe it would be the exe-file then thats properties are to open in explorer and where you set "run as admin" for compatibility reasons...
If it works, you might consider a script solution to be executed on all engines that makes either the bundled exe or *.tBasic-files run as admin always.
if running from *.tBasic*-script-sources -and not to bother of different file extensions if crypted or special console files - i would suggest to run thinBasic.exe with elevated privileges always. Because its not possible to set for all users in one go (security feature of windows prevents to set administrator priviliges simply to HKEY_LOCAL_MACHINE ) you have to set it at least twice per computer.
In any case to all existing users accounts and once to the .Default-users account - so in future every new account will inherit the setting. since only HKEY_USERS and HKEY_LOCAL_MACHINE can be accessed remotely but HKL_MACHINE will not accept generalized to run as admin always - as mentioned above -
it were the most simple solution to inform all users via net broadcast to import a registry settings file - requires the same file locations on all machines.
optional the thinbasic-script that creates the .reg-file can be run on every pc to provide the correct App_Path.
'---Script created on 02-27-2021 04:52:37 by Me
' ### RegTBAsAdmin.tBasic ###
' this script will create 2 files:
'- TbRunAsAdmin.reg
'- Tb2RegImpAdmin.BAT
' goal: run thinBasic-scripts with elevated privileges
' usually it will succeed importing the regfile from thinbasic-script
' alternate option : create bundled exe of this that will run on each pc on your
' network (right-click + RunAs Admin)
' another option : if thinBasic-path or the optional other files are equal on all
' pcs you can use "Reg Import TbRunAsAdmin.reg" on elevated command prompt
string sRegFile = App_Scriptpath & "TbRunAsAdmin.REG"
string sBatFile = App_Scriptpath & "Tb2RegImpAdmin.BAT"
' BACKSLASHES: \ in reg value name and in reg_[.]*sz data
' must be escaped with a backslash and become: \\
' DOUBLE QUOTES: " within quoted strings will become: \"
string TBPath$ = replace$(App_path, "\", "!") ' do the backslash-thing
TBPath$ = replace$(TBPath$, "!","\\")
string sCode = "Windows Registry Editor Version 5.00" & crlf & crlf
long turn
repeat
incr turn
sCode &= "[HKEY_" & choose$(turn,"CURRENT_USER", "USERS\.DEFAULT")
sCode &= "\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers]" & crlf
' -- run tBasic-scripts as admin through permanently elevating thincore:
sCode &= $DQ & TBPath$ & "thinBasic.exe" & $DQ & "=" & $DQ & " ~RUNASADMIN" & $DQ & crlf
' -- if users have access to thinAir uncomment the next line to allow saving anywhere:
'sCode &= $DQ & TBPath$ & "thinAir\\thinAir.exe" & $DQ & "=" & $DQ & " ~RUNASADMIN" & $DQ & crlf
' -- maybe some bundled exe that shall be executed as admin?
' -- is it located at the same address network-wide?
'sCode &= $DQ & "\\\\yourdomain\\network_location\\SharedFile.exe" & $DQ & "=" & $DQ & " ~RUNASADMIN" & $DQ & crlf
' -- or locally stored to all clients?:
'sCode &= $DQ & "C:\\yourPath\\LocalFile.exe" & $DQ & "=" & $DQ & " ~RUNASADMIN" & $DQ & crlf
sCode &= crlf
until turn = 2
sCode &= string$(2, $spc)
' almost ready... registry uses UCS2-Le encoding,
' 16 Bit with Byte-Order-Mark (BOM) = FF FE
' sCode is plain ascii until here - lets convert!
long nChars = lenf(sCode)
' allocate destination memory for Ucs2_Le:
' 2 Bytes BOM, 2 bytes per char
string AsUcs2_Le = mkbyt$(0xFF, 0xFE) & _ ' = BOM
repeat$(nChars,mkbyt$(0x20, 0x00))
' just using count of 8 bit chars for 16-bit space-chars
'-- a virtual byte at the current - first - char of sCode to read it:
dim bRead as Byte at strptr(sCode)
' get position of the first char in destinations memory
dword pos2Write = strptr(AsUcs2_Le)+2
while nChars
poke( byte, pos2Write, bRead )
' 1 char less to do:
decr nChars
' move the byte to read onto the next char:
SetAt(bRead, GetAt(bRead) + 1)
' go 2 bytes (skip 1 + go 1) forward at destination memory
pos2Write += 2
wend
' all converted, now save it to a REG-file next to this script
Save_File( sRegFile, AsUcs2_Le)
AsUcs2_Le = Shell_CaptureOutput( "REG IMPORT " & $DQ & sRegFile & $DQ, "", %sw_Hide, 1500) & crlf
save_File( sBatFile, "Reg Import " & $DQ & sRegFile & $DQ & crlf & string$(3,$spc) )
if msgbox(AsUcs2_Le & "Is the result bad enough to try something else?", %MB_YesNo, "registry replies:") = %IDNO Then
msgbox ("Anyway you can run regedit as administrator and import" & crlf & sRegFile, %MB_IconInformation | %MB_OK, "Keep in mind:")
AsUcs2_Le ="..."
EndIf
Bookmarks