diff --git a/workload/scripts/appAttachToolsVM/AppAttachVMConfig.ps1 b/workload/scripts/appAttachToolsVM/AppAttachVMConfig.ps1 index 9d2f42392..e38a67b51 100644 --- a/workload/scripts/appAttachToolsVM/AppAttachVMConfig.ps1 +++ b/workload/scripts/appAttachToolsVM/AppAttachVMConfig.ps1 @@ -1,9 +1,12 @@ # Purpose: -# Configure VM for App Attach package creation. Installs PsfTooling and MSIX App Attach Windows Store based applications and sets recommended registry settings. +# Configure VM for App Attach package creation. Installs MSIX App Attach Windows Store based application, MSIX Tools Driver, and sets recommended registry settings. -# Updates: -# 8/28/2023 (JCore) - Updated from original to remove Drive Mapping, add latest package versions, create desktop shortcuts and remove startup for Windows and Edge. -# +<# +Updates: + 8/28/2023 (JCore) - Updated from original to remove Drive Mapping, add latest package versions, create desktop shortcuts and remove startup for Windows and Edge. + 10/21/2024 (JCore) - Removed PSFTooling as it's now included in MSIX Tools, added download and install for the MSIX Tools Driver ahead of time, updated URL and + version for MSIX Tools install. Changed Install from Add-AppPackage to Add-AppxProvisionedPackage. +#> Param( @@ -19,11 +22,13 @@ Param( # URLs for MSIX and PsfTooling packages # version 1.2023.319.0 -$MSIXPackageURL = "https://download.microsoft.com/download/d/0/0/d0043667-b1db-4060-9c82-eaee1fa619e8/493b543c21624db8832da8791ebf98f3.msixbundle" -$PsfToolPackageURL = "https://www.tmurgent.com/AppV/Tools/PsfTooling/PsfTooling-6.3.0.0-x64.msix" +$MSIXPackageURL = "https://download.microsoft.com/download/e/2/e/e2e923b2-7a3a-4730-969d-ab37001fbb5e/MSIXPackagingtoolv1.2024.405.0.msixbundle" +# $PsfToolPackageURL = "https://www.tmurgent.com/AppV/Tools/PsfTooling/PsfTooling-6.3.0.0-x64.msix" -$AppAttachInstallFolder = "Microsoft.MSIXPackagingTool_1.2023.319.0_x64__8wekyb3d8bbwe" -$PsfToolInstallFolder = "PsfTooling_6.3.0.0_x64__4y3s55xckzt36" +$AppAttachInstallFolder = "Microsoft.MSIXPackagingTool_1.2024.405.0_x64__8wekyb3d8bbwe" +# $PsfToolInstallFolder = "PsfTooling_6.3.0.0_x64__4y3s55xckzt36" + +$MSIXToolsDriver = "Msix.PackagingTool.Driver~~~~0.0.1.0" # Create Log file for output and troublehsooting $Log = "C:\PostConfig.log" @@ -112,12 +117,6 @@ Invoke-WebRequest -Uri $MSIXPackageURL -OutFile "C:\MSIX\MsixPackagingTool.msixb If ($Error.Count -eq 0) { ".... COMPLETED!" | Out-File $Log -Append } Else { "-----ERROR-----> $Error" | Out-File $Log -Append; $Error.Clear() } -# Download the PFSTooling Tool -"Downloading PSFTooling Tool" | Out-File $Log -Append -Invoke-WebRequest -URI $PsfToolPackageURL -OutFile "C:\MSIX\PsfTooling-x64.msix" -If ($Error.Count -eq 0) { ".... COMPLETED!" | Out-File $Log -Append } -Else { "-----ERROR-----> $Error" | Out-File $Log -Append; $Error.Clear() } - "Enabling PSRemoting" | Out-file $Log -Append Enable-PSRemoting -Force If ($Error.Count -eq 0) { ".... COMPLETED!" | Out-File $Log -Append } @@ -126,30 +125,31 @@ Else { "-----ERROR-----> $Error" | Out-File $Log -Append; $Error.Clear() } Invoke-Command -ComputerName $ENV:COMPUTERNAME -Credential $VMCredential -ScriptBlock { # Installs the MSIX Packaging Tool "Installing MSIX Packaging Tool as $Using:VMUserName" | Out-File $Using:Log -Append - Add-AppPackage -Path "C:\MSIX\MSIXPackagingTool.msixbundle" - If ($Error.Count -eq 0) { ".... COMPLETED!" | Out-File $Using:Log -Append } - Else { "-----ERROR-----> $Error" | Out-File $Using:Log -Append; $Error.Clear() } - - # Downloads and installs the PFSTooling Tool - "Installing PSFTooling Tool as $Using:VMUserName" | Out-File $Using:Log -Append - Add-AppPackage -Path "C:\MSIX\PsfTooling-x64.msix" + Add-AppxPackage -Path "C:\MSIX\MSIXPackagingTool.msixbundle" If ($Error.Count -eq 0) { ".... COMPLETED!" | Out-File $Using:Log -Append } Else { "-----ERROR-----> $Error" | Out-File $Using:Log -Append; $Error.Clear() } - -<# # Map Drive for MSIX Share +<# + # Map Drive for MSIX Share "Mapping MSIX Share to M:" | Out-File $Log -Append New-PSDrive -Name M -PSProvider FileSystem -Root $Using:FileShare -Credential $Using:StorageCredential -Persist # New-SmbGlobalMapping -RemotePath $FileShare -Credential $Credential -LocalPath 'M:' If ($Error.Count -eq 0) { ".... COMPLETED!" | Out-File $Using:Log -Append } - Else { "-----ERROR-----> $Error" | Out-File $Using:Log -Append; $Error.Clear() } #> - + Else { "-----ERROR-----> $Error" | Out-File $Using:Log -Append; $Error.Clear() } + #> } + # Disable PSRemoting after Invoke Command "Disabling PSRemoting" | Out-file $Log -Append Disable-PSRemoting -Force If ($Error.Count -eq 0) { ".... COMPLETED!" | Out-File $Log -Append } Else { "-----ERROR-----> $Error" | Out-File $Log -Append; $Error.Clear() } +# Install MSIX Packaging Tools Driver (Req'd at first launch if not installed) +"Installing MSIX Packaging Tool Driver" | Out-File $Log -Append +Add-WindowsCapability -Online -Name $MSIXToolsDriver +If ($Error.Count -eq 0) { ".... COMPLETED!" | Out-File $Log -Append } +Else { "-----ERROR-----> $Error" | Out-File $Log -Append; $Error.Clear() } + # Stops the Shell HW Detection service to prevent the format disk popup "Stoping Plug and Play Service and setting to disabled" | Out-file $Log -Append Stop-Service -Name ShellHWDetection -Force @@ -185,8 +185,8 @@ Else { "-----ERROR-----> $Error" | Out-File $Log -Append; $Error.Clear() } $DestinationPath = "C:\Users\Public\Desktop" $AppAttach = "$DestinationPath\MSIX App Attach.lnk" $AppAttachExe = "C:\Program Files\WindowsApps\$AppAttachInstallFolder\MsixPackageTool.exe" -$PSFToolExe = "C:\Program Files\WindowsApps\$PsfToolInstallFolder\PsfTooling.exe" -$PSFTool = "$DestinationPath\PSFTool.lnk" +# $PSFToolExe = "C:\Program Files\WindowsApps\$PsfToolInstallFolder\PsfTooling.exe" +# $PSFTool = "$DestinationPath\PSFTool.lnk" $MSIXfldr = "$DestinationPath\MSIX Folder.lnk" $MSIXfldrLoc = "C:\MSIX\" $WshShell = New-Object -comObject WScript.Shell @@ -194,10 +194,6 @@ $Shortcut = $WshShell.CreateShortcut($AppAttach) $Shortcut.TargetPath = $AppAttachExe $Shortcut.Save() $WshShell = New-Object -comObject WScript.Shell -$Shortcut = $WshShell.CreateShortcut($PSFTool) -$Shortcut.TargetPath = $PSFToolExe -$Shortcut.Save() -$WshShell = New-Object -comObject WScript.Shell $Shortcut = $WshShell.CreateShortcut($MSIXfldr) $Shortcut.TargetPath = $MSIXfldrLoc $Shortcut.Save() @@ -209,4 +205,4 @@ Restart-Computer -Force If ($Error.Count -eq 0) { ".... COMPLETED!" | Out-File $Log -Append } Else { "-----ERROR-----> $Error" | Out-File $Log -Append; $Error.Clear() } -"-------------------------- END SCRIPT RUN ------------------------" | Out-File $Log -Append \ No newline at end of file +"-------------------------- END SCRIPT RUN ------------------------" | Out-File $Log -Append