Skip to content

Commit

Permalink
Added ServiceUI
Browse files Browse the repository at this point in the history
Replaced PSexec with ServiceUI for intunewin sandbox
Removed PSexec in favor of ServiceUI
  • Loading branch information
Joly0 committed Apr 4, 2023
1 parent 5094cd7 commit 3945a20
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 48 deletions.
2 changes: 1 addition & 1 deletion Add_Structure.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ $Progress_Activity = "Enabling Run in Sandbox context menus"
Write-Progress -Activity $Progress_Activity -PercentComplete 1

$Check_Sources_Files_Count = (Get-ChildItem "$Current_Folder\Sources\Run_in_Sandbox" -Recurse).count
If ($Check_Sources_Files_Count -ne 58) {
If ($Check_Sources_Files_Count -ne 39) {
Write_Log -Message_Type "ERROR" -Message "Some contents are missing"
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[System.Windows.Forms.MessageBox]::Show("It seems you don't have dowloaded all the folder structure !!!")
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased


## 2023-03-07
### Added
- Added ServiceUI
### Changed
- Replaced PSexec with ServiceUI for intunewin sandbox
### Removed
- Removed psexec in favor of ServiceUI

## 2023-03-06
### Added
- Added option to Sandbox_Config.xml to cleanup leftover .wsb file afterwards (default is true)
Expand Down
44 changes: 1 addition & 43 deletions Sources/Run_in_Sandbox/AppBundle_Install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -36,47 +36,5 @@ ForEach ($App in $Apps_to_install) {
}
If ( ($App_File -like "*.ps1*") -or ($App_File -like "*.vbs*") ) {
& { Invoke-Expression ($App_Full_Path) }
}
# & { Invoke-Expression ($App_Full_Path) }
}
}


# set-location "$Intunewin_Extracted_Folder\$FileName"
# $file = "$Sandbox_Folder\Intunewin_Install_Command.txt"
# & { Invoke-Expression (Get-Content -Raw $file) }


# $Intunewin_Content_File = "$Sandbox_Folder\Intunewin_Folder.txt"
# $ScriptPath = get-content $Intunewin_Content_File


# $FolderPath = Split-Path (Split-Path "$ScriptPath" -Parent) -Leaf
# $DirectoryName = (get-item $ScriptPath).DirectoryName
# $FileName = (get-item $ScriptPath).BaseName

# $Intunewin_Extracted_Folder = "C:\Windows\Temp\intunewin"
# new-item $Intunewin_Extracted_Folder -Type Directory -Force
# copy-item $ScriptPath $Intunewin_Extracted_Folder -Force
# $New_Intunewin_Path = "$Intunewin_Extracted_Folder\$FileName.intunewin"

# set-location $Sandbox_Folder
# & .\IntuneWinAppUtilDecoder.exe $New_Intunewin_Path -s
# $IntuneWinDecoded_File_Name = "$Intunewin_Extracted_Folder\$FileName.Intunewin.decoded"

# new-item "$Intunewin_Extracted_Folder\$FileName" -Type Directory -Force | out-null

# $IntuneWin_Rename = "$FileName.zip"

# Rename-Item $IntuneWinDecoded_File_Name $IntuneWin_Rename -force

# $Extract_Path = "$Intunewin_Extracted_Folder\$FileName"
# Expand-Archive -LiteralPath "$Intunewin_Extracted_Folder\$IntuneWin_Rename" -DestinationPath $Extract_Path -Force

# Remove-Item "$Intunewin_Extracted_Folder\$IntuneWin_Rename" -force
# sleep 1

# set-location "$Intunewin_Extracted_Folder\$FileName"
# $file = "$Sandbox_Folder\Intunewin_Install_Command.txt"
# & { Invoke-Expression (Get-Content -Raw $file) }

}
8 changes: 4 additions & 4 deletions Sources/Run_in_Sandbox/IntuneWin_Install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ Expand-Archive -LiteralPath "$Intunewin_Extracted_Folder\$IntuneWin_Rename" -Des
Remove-Item "$Intunewin_Extracted_Folder\$IntuneWin_Rename" -Force
Start-Sleep 1

$PSexec = "c:\pstools\PSexec.exe"
$ServiceUI = "C:\RunInSandbox\ServiceUI.exe"
$WorkDir = "$Intunewin_Extracted_Folder\$FileName"
$File = "$Sandbox_Folder\Intunewin_Install_Command.txt"
$command = Get-Content -Raw $File

$cmd = "$psexec -w `"$workdir`" -si -accepteula $command"

Set-Location "$Intunewin_Extracted_Folder\$FileName"
$cmd = "$ServiceUI -process:explorer.exe $command"

& { Invoke-Expression $cmd }
Set-Location "$Intunewin_Extracted_Folder\$FileName"

& { Invoke-Expression $cmd }
Binary file removed Sources/Run_in_Sandbox/PsExec.exe
Binary file not shown.
Binary file added Sources/Run_in_Sandbox/ServiceUI.exe
Binary file not shown.

0 comments on commit 3945a20

Please sign in to comment.