-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathInstall_tool.ps1
51 lines (40 loc) · 2.56 KB
/
Install_tool.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#***************************************************************************************************************
# Author: Damien VAN ROBAEYS
# Website: http://www.systanddeploy.com
# Twitter: https://twitter.com/syst_and_deploy
#***************************************************************************************************************
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | out-null
$Current_Folder = split-path $MyInvocation.MyCommand.Path
$Sources = $Current_Folder + "\" + "Sources\*"
If(test-path $Sources)
{
$Destination_folder = "$env:LOCALAPPDATA\Intunewin_Build_Extract"
If(test-path $Destination_folder){remove-item $Destination_folder -recurse -force | out-null}
new-item $Destination_folder -type directory -force | out-null
copy-item $Sources $Destination_folder -force -recurse
$IntuneWinAppUtil_Link = "https://github.com/microsoft/Microsoft-Win32-Content-Prep-Tool/raw/master/IntuneWinAppUtil.exe"
$IntuneWinAppUtil_File = "$Destination_folder\IntuneWinAppUtil.exe"
Invoke-WebRequest -Uri $IntuneWinAppUtil_Link -OutFile $IntuneWinAppUtil_File -UseBasicParsing | out-null
$Decode_Link = "https://github.com/okieselbach/Intune/raw/master/IntuneWinAppUtilDecoder/IntuneWinAppUtilDecoder/bin/Release/IntuneWinAppUtilDecoder.exe"
$DecodeApp_File = "$Destination_folder\IntuneWinAppUtilDecoder.exe"
Invoke-WebRequest -Uri $Decode_Link -OutFile $DecodeApp_File -UseBasicParsing | out-null
Get-Childitem -Recurse $Destination_folder | Unblock-file
# Creatre the LNK file
$LNK_File = "$Destination_folder\Intunewin Build and Extract.lnk"
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$LNK_File")
$Target_Path = "C:\Windows\System32\cmd.exe"
$Target_Arguments = "/c start /min powershell -WindowStyle Hidden -ExecutionPolicy Bypass -File %LOCALAPPDATA%\Intunewin_Build_Extract\IntuneWin_Generator.ps1"
$Shortcut.TargetPath = $Target_Path
$Shortcut.Arguments = $Target_Arguments
$shortcut.IconLocation = "$Destination_folder\logo.ico"
$shortcut.WorkingDirectory = $Destination_folder
$Shortcut.Save()
$Get_Desktop_Profile = [environment]::GetFolderPath('Desktop')
copy-item $LNK_File $Get_Desktop_Profile -Force
[System.Windows.Forms.MessageBox]::Show("Intunewin Build and Extract has been installed`n`nA shortcut has been added on your Desktop")
}
Else
{
[System.Windows.Forms.MessageBox]::Show("It seems you don't have dowloaded all the folder structure.`nThe folder Sources is missing !!!")
}