How can we help?
Test Article #1
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa.
Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros quis urna. Nunc viverra imperdiet enim.
Fusce est. Vivamus a tellus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Proin pharetra nonummy pede.
Mauris et orci. Aenean nec lorem. In porttitor. Donec laoreet nonummy augue.em
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 52 53 54 55 56 |
<# https://learn.microsoft.com/en-us/troubleshoot/windows-client/admin-development/create-desktop-shortcut-with-wsh https://stackoverflow.com/questions/63287152/value-does-not-fall-within-expected-range-when-applying-property-to-windows-10-s #> function Add-CapAdminShortCut { [CmdletBinding()] param ( [Parameter(Mandatory, Position=1)] [string]$AppName, [Parameter(Mandatory,Position=2)] [string]$ExePath ) $ShortcutName = $AppName + ' As Admin' $AppExePath = $ExePath $principalID = $Env:UserDomain + '\' + $Env:USERNAME $RandomPrefix = Get-Random -Minimum 111 -Maximum 999 $TaskName = $AppName + ' - AdminExecTask - ' + $RandomPrefix if (Test-Path $AppExePath){ #exepath exists so continue <# CREATE TASK #> $action = New-ScheduledTaskAction -Execute $AppExePath $principal = New-ScheduledTaskPrincipal -UserID $principalID -RunLevel Highest $settings = New-ScheduledTaskSettingsSet $task = New-ScheduledTask -Action $action -Principal $principal -Settings $settings Register-ScheduledTask $TaskName -InputObject $task <# CREATE SHORTCUT #> $TaskCmd = 'C:\Windows\system32\schtasks.exe' $TaskArgs = ' /run /TN ' + '"' + $TaskName + '"' $WshShell = New-Object -comObject WScript.Shell $Shortcut = $WshShell.CreateShortcut("$Home\Desktop\$ShortcutName.lnk") $Shortcut.TargetPath = $TaskCmd $Shortcut.Arguments = $TaskArgs #windowstyle is not working $Shortcut.WindowStyle = 0 #&&Minimized 0=Maximized 4=Normal $Shortcut.IconLocation = $ExePath $Shortcut.Save() } else { Write-Error "Exe Path is not correct. Please check." return } Write-Host "Task and Shortcut are created succefully." } |