Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
897 views
in Technique[技术] by (71.8m points)

wix - How to deploy MSI that installs to localappdata, via GPO, system session?

I need my app to be installed to local app data of the active console session, or even to all the machine's users.
But when deploying via GPO, a system session is the one running the MSI.
So how can I create an MSI via WiX Toolset that achieves that purpose?

I tried using this guide: https://docs.microsoft.com/en-us/windows/win32/msi/msiinstallperuser
So I set these properties in the wxs file:

<Property Id='ALLUSERS' Value='2' />
<Property Id='MSIINSTALLPERUSER' Value='1' />

And the dir structure is:

<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="LocalAppDataFolder">
        <Directory Id="APPLICATIONFOLDER" Name="MyApp">

Then, I ran the msi via system session using psexec, but as the log says:

PROPERTY CHANGE: Adding APPLICATIONFOLDER property. Its value is 'C:WINDOWSSysWOW64configsystemprofileAppDataLocalMyApp'.

And it tries to install to the default local app data

I've tried several other methods, like changing the APPLICATIONFOLDER via a c# custom action, or by modifying the database via c# custom action, but I still didn't find a working solution.

Any help will be greatly appreciated


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

What you did to the MSI was correct. But, you used psexec to "install" (instead of GPO) and as you stated, "via system session", so you got the system account's local app data directory.

You need to assign (or maybe publish, but you were describing assign) your MSI to your users in GPO. Then the MSI will be installed as you desire. If you assign to the computer in GPO, the MSI should be setup to be "per-machine", in which case ProgramFiles would be the better directory to use (and ALLUSERS should be "1" in that case).

Use Group Policy to remotely install software


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...