Skip to content

Commit 8936929

Browse files
authored
Update README.md
1 parent 5c74206 commit 8936929

File tree

1 file changed

+0
-139
lines changed

1 file changed

+0
-139
lines changed

MSIX App Attach/README.md

-139
Original file line numberDiff line numberDiff line change
@@ -107,142 +107,3 @@ MSIX app attach has four distinct phases that must be performed in the following
107107
Each phase creates a PowerShell script. Sample scripts for each phase are available here.
108108

109109
After you've disabled automatic updates, you must enable Hyper-V because you'll be using the Mound-VHD command to stage and and Dismount-VHD to destage.
110-
```
111-
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
112-
````
113-
### Stage the PowerShell script
114-
Before you update the PowerShell scripts, make sure you have the volume GUID of the volume in the VHD. To get the volume GUID:
115-
116-
- Open the network share where the VHD is located inside the VM where you'll run the script.
117-
- Right-click the VHD and select Mount. This will mount the VHD to a drive letter.
118-
- After you mount the VHD, the File Explorer window will open. Capture the parent folder and update the $parentFolder variable
119-
- Open the parent folder. If correctly expanded, you'll see a folder with the same name as the package. Update the $packageName variable to match the name of this folder.
120-
For example, VSCodeUserSetup-x64-1.38.1_1.38.1.0_x64__8wekyb3d8bbwe.
121-
- Open a command prompt and enter mountvol. This command will display a list of volumes and their GUIDs. Copy the GUID of the volume where the drive letter matches the drive you mounted your VHD to in step 2.
122-
For example, in this example output for the mountvol command, if you mounted your VHD to Drive C, you'll want to copy the value above C:\:
123-
````
124-
Possible values for VolumeName along with current mount points are:
125-
126-
\\?\Volume{a12b3456-0000-0000-0000-10000000000}\
127-
*** NO MOUNT POINTS ***
128-
129-
\\?\Volume{c78d9012-0000-0000-0000-20000000000}\
130-
E:\
131-
132-
\\?\Volume{d34e5678-0000-0000-0000-30000000000}\
133-
C:\
134-
````
135-
- Update the $volumeGuid variable with the volume GUID you just copied.
136-
- Open an Admin PowerShell prompt and update the following PowerShell script with the variables that apply to your environment.
137-
````
138-
#MSIX app attach staging sample
139-
#region variables
140-
$vhdSrc="<path to vhd>"
141-
$packageName = "<package name>"
142-
$parentFolder = "<package parent folder>"
143-
$parentFolder = "\" + $parentFolder + "\"
144-
$volumeGuid = "<vol guid>"
145-
$msixJunction = "C:\temp\AppAttach\"
146-
#endregion
147-
#region mountvhd
148-
try
149-
{
150-
Mount-Diskimage -ImagePath $vhdSrc -NoDriveLetter -Access ReadOnly
151-
Write-Host ("Mounting of " + $vhdSrc + " was completed!") -BackgroundColor Green
152-
}
153-
catch
154-
{
155-
Write-Host ("Mounting of " + $vhdSrc + " has failed!") -BackgroundColor Red
156-
}
157-
#endregion
158-
#region makelink
159-
$msixDest = "\\?\Volume{" + $volumeGuid + "}\"
160-
if (!(Test-Path $msixJunction))
161-
{
162-
md $msixJunction
163-
}
164-
$msixJunction = $msixJunction + $packageName
165-
cmd.exe /c mklink /j $msixJunction $msixDest
166-
#endregion
167-
#region stage
168-
[Windows.Management.Deployment.PackageManager,Windows.Management.Deployment,ContentType=WindowsRuntime]| Out-Null
169-
Add-Type -AssemblyName System.Runtime.WindowsRuntime
170-
$asTask = ([System.WindowsRuntimeSystemExtensions].GetMethods() | Where {$_.ToString() -eq 'System.Threading.Tasks.Task`1[TResult] AsTask[TResult,TProgress](Windows.Foundation.IAsyncOperationWithProgress`2[TResult,TProgress])'})[0]
171-
$asTaskAsyncOperation = $asTask.MakeGenericMethod([Windows.Management.Deployment.DeploymentResult],[Windows.Management.Deployment.DeploymentProgress])
172-
$packageManager = [Windows.Management.Deployment.PackageManager]::new()
173-
$path = $msixJunction + $parentFolder + $packageName # needed if we do the pbisigned.vhd
174-
$path = ([System.Uri]$path).AbsoluteUri
175-
$asyncOperation = $packageManager.StagePackageAsync($path, $null, "StageInPlace")
176-
$task = $asTaskAsyncOperation.Invoke($null, @($asyncOperation))
177-
$task
178-
#endregion
179-
````
180-
# AppAttach.ps1
181-
For each application, you have to define the following properties:
182-
183-
Property | Note
184-
--------|-------
185-
vhdSrc | Path to the expanded MSIX app (as vhd)
186-
volumeGuid | Guid of the vhd
187-
packageName | Name of the MSIX app attach package
188-
parentFolder | Root folder name in your vhd
189-
hostPools | List of host pool names where the package should be applied
190-
userGroups | List of AD groups: Members get the application linked in their start menu
191-
192-
## Refer this file by a group policy:
193-
194-
- Computer Configuration - Policies - Windows Settings - Scripts - Startup
195-
196-
- Name: %windir%\System32\WindowsPowerShell\v1.0\powershell.exe
197-
198-
- Parameter: -ExecutionPolicy Unrestricted -File \ads01\Configuration\WVD\MSIX\AppAttach.ps1 -ConfigFile \\ads01\Configuration\WVD\MSIX\AppAttach.json -Mode VmStart
199-
200-
- Computer Configuration - Policies - Windows Settings - Scripts - Shutdown
201-
202-
- Name: %windir%\System32\WindowsPowerShell\v1.0\powershell.exe
203-
204-
- Parameter: -ExecutionPolicy Unrestricted -File \ads01\Configuration\WVD\MSIX\AppAttach.ps1 -ConfigFile \\ads01\Configuration\WVD\MSIX\AppAttach.json -Mode VmShutdown
205-
206-
- User Configuration - Policies - Windows Settings - Scripts - Logon
207-
208-
- Name: %windir%\System32\WindowsPowerShell\v1.0\powershell.exe
209-
210-
- Parameter: -ExecutionPolicy Unrestricted -File \ads01\Configuration\WVD\MSIX\AppAttach.ps1 -ConfigFile \ads01\Configuration\WVD\MSIX\AppAttach.json -Mode UserLogon
211-
212-
- User Configuration - Policies - Windows Settings - Scripts - Logoff
213-
214-
- Name: %windir%\System32\WindowsPowerShell\v1.0\powershell.exe
215-
216-
- Parameter: -ExecutionPolicy Unrestricted -File \ads01\Configuration\WVD\MSIX\AppAttach.ps1 -ConfigFile \\ads01\Configuration\WVD\MSIX\AppAttach.json -Mode UserLogoff
217-
218-
- Where \\ads01\Configuration\WVD\MSIX\ is the path to the script and \\ads01\Configuration\WVD\MSIX\AppAttach.json the JSON-configuration file.
219-
220-
- Make sure that the GPO is linked to the computer and enable loopback processing:
221-
222-
- Computer Configuration - Policies - Administrative Templates - System/Group Policy
223-
224-
- Configure user Group Policy loopback processing mode: Enable - Mode: merge.
225-
226-
## Preparing the golden master for the session hosts
227-
To work with MSIX and have the script do the work you have to prepare your golden image:
228-
229-
- Make sure that you have installed the right version from the insider build
230-
231-
- Double-check that you have NOT prepared your image with the command line commands described in https://docs.microsoft.com/en-us/azure/virtual-desktop/app-attach#prepare-the-vhd-image-for-azure (Disable Store auto-update and so on). It’s only for the VM concerning the converting process.
232-
233-
- Copy the PSTools https://docs.microsoft.com/en-us/sysinternals/downloads/psexec to %Windir%\System32 (you need psexec later)
234-
235-
- Give the service GPSVC the right privileges to mount images:
236-
237-
- Create a cmd-file with this content:
238-
```
239-
sc privs gpsvc SeManageVolumePrivilege/SeTcbPrivilege/SeTakeOwnershipPrivilege/SeIncreaseQuotaPrivilege/SeAssignPrimaryTokenPrivilege/SeSecurityPrivilege/SeChangeNotifyPrivilege/SeCreatePermanentPrivilege/SeShutdownPrivilege/SeLoadDriverPrivilege/SeRestorePrivilege/SeBackupPrivilege/SeCreatePagefilePrivilege
240-
```
241-
- Open an administrative cmd and execute:
242-
```
243-
psexec /s cmd
244-
```
245-
- In this service cmd execute the cmd-file to give GPSVC the right permissions
246-
247-
(This adds the SeManageVolumePrivilege which allows mounting of images)
248-

0 commit comments

Comments
 (0)