|
Server : Apache/2.4.58 (Win64) OpenSSL/3.1.3 PHP/8.2.12 System : Windows NT SERVER-PC 10.0 build 26200 (Windows 11) AMD64 User : ServerPC ( 0) PHP Version : 8.2.12 Disable Function : NONE Directory : C:/Windows/System32/WindowsPowerShell/v1.0/Modules/StartLayout/ |
Upload File : |
function Get-StartApps {
param(
[string]$Name = '*',
[ValidateSet('Unsorted', 'Name', 'AppID')]
[string]$SortOrder = 'Name'
)
$apps = Get-AllStartApps -SortOrder $SortOrder
$apps | Where-Object { $_.Name -like "*$Name*" }
}
function Get-AllStartApps {
param(
[ValidateSet('Unsorted', 'Name', 'AppID')]
[string]$SortOrder = 'Name'
)
$appsFolder = 'shell:::{4234d49b-0245-4df3-b780-3893943456e1}' # FOLDERID_AppsFolder
$shell = New-Object -ComObject Shell.Application
$appsFolderItems = $shell.NameSpace($appsFolder).Items()
$apps = @()
foreach ($item in $appsFolderItems) {
$apps += [PSCustomObject]@{
'Name' = $item.Name
'AppID' = $item.Path
}
}
# Return based on sort order
switch ($SortOrder) {
'Name' { $apps | Sort-Object Name }
'AppID' { $apps | Sort-Object AppID }
Default { $apps }
}
}