Forums on Intune, SCCM, and Windows 11

Welcome to the forums. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your topics and posts, as well as connect with other members through your own private inbox!

NEW Application Working only if deployed in available mode

  • Thread starter Thread starter Marcomile
  • Start date Start date
  • Replies Replies 1
  • Views Views 840

Marcomile

Member
Messages
13
Reaction score
4
Points
3
Hi all,
I have a problem with an application. It is an Installshield silent install (Iss). I need to run this application in compatibility mode (XP SP2) so I run the installation via vbs script:
##############################################################
set objShell = WScript.CreateObject ("WScript.Shell")
Set wshShell = CreateObject( "WScript.Shell" )

'Determino current Directory"
CurrentDIR = (objShell.CurrentDirectory)
KeyName = CurrentDir & "\setup.exe"

'Determino chiave registro
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"
strValueName = Keyname
strValue = "~WINXPSP2"

'verifico se esiste chiave SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
Const HKEY_LOCAL_MACHINE = &H80000002
'
strComputer = "."
'
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
'
RegKey= "Layers"
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\"
'
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
'
For Each subkey In arrSubKeys
bFound = (lcase(subkey) = lcase(regkey))
if bFound then exit for
Next
'
if bFound then
keyexist = "True"
else
keyexist = "False"
end if


'se non esiste chiave SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers la creo

if keyexist = "False" then

'Const HKEY_LOCAL_MACHINE = &H80000002

strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"
strComputer = "."

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")


oReg.CreateKey HKEY_LOCAL_MACHINE, strKeyPath
end if



' Creo chiave per compatibility flag.

strComputer = "."

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"

oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue



'Lancio Setup Software
Setupcommand = chr(34) & Keyname & chr(34) & " -s -f1" & chr(34) & CurrentDir & "\setup.iss" & chr(34)
msgbox Setupcommand
wshShell.run Setupcommand ,1 ,true
###################################################################

This application works in available mode, if deployed in required mode it seems that setup.exe gets non switches.

Anybody can help me?
 
I noticed that if I run application in "install for user mode" it works.
Do you know if System users skips AllUsers compatibility flags?
 
Back
Top