diff --git a/functions/public/Invoke-WPFButton.ps1 b/functions/public/Invoke-WPFButton.ps1 index 07cf642f8e..59d3d313f2 100644 --- a/functions/public/Invoke-WPFButton.ps1 +++ b/functions/public/Invoke-WPFButton.ps1 @@ -43,7 +43,6 @@ function Invoke-WPFButton { "WPFFixesUpdate" {Invoke-WPFFixesUpdate} "WPFUpdatesdisable" {Invoke-WPFUpdatesdisable} "WPFUpdatessecurity" {Invoke-WPFUpdatessecurity} - - + "WPFWinUtilShortcut" {Invoke-WPFShortcut -ShortcutToAdd "WinUtil"} } } \ No newline at end of file diff --git a/functions/public/Invoke-WPFShortcut.ps1 b/functions/public/Invoke-WPFShortcut.ps1 new file mode 100644 index 0000000000..1b0377f815 --- /dev/null +++ b/functions/public/Invoke-WPFShortcut.ps1 @@ -0,0 +1,33 @@ +function Invoke-WPFShortcut { + <# + + .DESCRIPTION + Creates a shortcut + + #> + param($ShortcutToAdd) + + Switch ($ShortcutToAdd) { + "WinUtil" { + $SourceExe = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" + $IRM = 'irm https://christitus.com/win | iex' + $Powershell = '-ExecutionPolicy Bypass -Command "Start-Process powershell.exe -verb runas -ArgumentList' + $ArgumentsToSourceExe = "$powershell '$IRM'" + $DestinationName = "WinUtil.lnk" + } + } + + $FileBrowser = New-Object System.Windows.Forms.SaveFileDialog + $FileBrowser.InitialDirectory = [Environment]::GetFolderPath('Desktop') + $FileBrowser.Filter = "Shortcut Files (*.lnk)|*.lnk" + $FileBrowser.FileName = $DestinationName + $FileBrowser.ShowDialog() | Out-Null + + $WshShell = New-Object -comObject WScript.Shell + $Shortcut = $WshShell.CreateShortcut($FileBrowser.FileName) + $Shortcut.TargetPath = $SourceExe + $Shortcut.Arguments = $ArgumentsToSourceExe + $Shortcut.Save() + + Write-Host "Shortcut for $ShortcutToAdd has been saved to $($FileBrowser.FileName)" +} \ No newline at end of file diff --git a/xaml/inputXML.xaml b/xaml/inputXML.xaml index a8496937c4..07c170acb3 100644 --- a/xaml/inputXML.xaml +++ b/xaml/inputXML.xaml @@ -320,6 +320,8 @@