Skip to content

Commit

Permalink
msi: Enable file and printer sharing
Browse files Browse the repository at this point in the history
This enbles file and printer sharing for the
'Private' and 'Public' network profiles

Sharing is enabled during install and disabled
during uninstall
  • Loading branch information
anjannath committed Oct 11, 2022
1 parent 82ca273 commit c3e9cf7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packaging/windows/product.wxs.template
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@
Before="AddUserToHypervAdminGroup"
Sequence="execute"/>
<CustomAction Id="AddUserToHypervAdminGroup" BinaryKey="WixCA" DllEntry="WixQuietExec64" Execute="deferred" Impersonate="no" Return="ignore" />
<SetProperty Action="CAEnableFileAndPrinterSharing"
Id="EnableFileAndPrinterSharing"
Value="&quot;[POWERSHELLEXE]&quot; -NonInteractive -ExecutionPolicy Bypass -NoProfile -Command &quot;Set-NetFirewallRule -DisplayGroup 'File And Printer Sharing' -Enabled True -Profile 'Private,Public'&quot;"
Before="EnableFileAndPrinterSharing"
Sequence="execute"/>
<CustomAction Id="EnableFileAndPrinterSharing" BinaryKey="WixCA" DllEntry="WixQuietExec64" Execute="deferred" Impersonate="no" Return="check" />

<util:CloseApplication Id = "TrayRunning" Description="Please exit Red Hat OpenShift Local from tray and run the installation again." Target="crc-tray.exe" RebootPrompt="no" PromptToContinue="yes" />

Expand All @@ -111,6 +117,7 @@
<Custom Action="InstallHyperv" Before="CreateCrcGroup"> NOT Installed AND NOT REMOVE~="ALL" AND NOT WIX_UPGRADE_DETECTED</Custom>
<Custom Action="RemoveCrcGroupRollback" After="CreateCrcGroup"> NOT Installed AND NOT REMOVE~="ALL" AND NOT WIX_UPGRADE_DETECTED</Custom>
<Custom Action="RemoveCrcDaemonTask" Before='RemoveFiles'>Installed AND NOT UPGRADINGPRODUCTCODE</Custom>
<Custom Action="EnableFileAndPrinterSharing" After="AddUserToHypervAdminGroup"> NOT Installed AND NOT REMOVE~="ALL" AND NOT WIX_UPGRADE_DETECTED</Custom>
<ScheduleReboot After="InstallFinalize"> NOT Installed AND NOT REMOVE~="ALL" AND NOT WIX_UPGRADE_DETECTED</ScheduleReboot>
</InstallExecuteSequence>
<Feature Id="DefaultFeature" Level="1">
Expand All @@ -131,6 +138,7 @@
<ProgressText Action="InstallHyperv">Installing Hyper-V</ProgressText>
<ProgressText Action="AddUserToHypervAdminGroup">Adding user: [LogonUser] to Hyper-V Administrators group</ProgressText>
<ProgressText Action="RemoveCrcDaemonTask">Removing crcDaemon task</ProgressText>
<ProgressText Action="EnableFileAndPrinterSharing">Enabling file and printer Sharing</ProgressText>
</UI>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<!-- this should help to propagate env var changes -->
Expand Down

4 comments on commit c3e9cf7

@marcoshaw
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#3386

Enabling the file share seems to cause an issue on the Windows 11 22H2. I haven't quite dug in enough to understand what the problem might be. It's possible something like McAfee AV will not allow this action?

@anjannath
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcoshaw seems the issue was fixed for OP on a clean machine: #3386 (comment)

@patrick-mota
Copy link

@patrick-mota patrick-mota commented on c3e9cf7 Oct 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anjannath I got the problem in my Windows 10 19041.804 with a corporate AV enabled... The install starts then shows the message "enabling printer sharing..." then Rollback error.
I took an older release version and could install without any problem.

EDIT:
Sorry ! You already saw it :) Thank you !

CF: #3386 (comment)

@anjannath
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patrick-mota np, i assume you tried the artefact linked in #3386 (comment) and that worked?

Please sign in to comment.