Apps doesn't make a profile anymore

This commit is contained in:
Zachary Gorman 2024-06-20 08:57:22 -07:00
parent bc7a063cbb
commit 40c0936ea8

View file

@ -24,10 +24,13 @@
Select-Object @{N='DisplayName';E={$_.Name}} |
Sort-Object -Property DisplayName
} else {
$localapps = Invoke-Command -ComputerName $ComputerName -SessionOption $(New-PSSessionOption -MaxConnectionRetryCount 1) -ScriptBlock {
Get-Package -ProviderName Programs -IncludeWindowsInstaller |
Select-Object @{N='DisplayName';E={$_.Name}} |
Sort-Object -Property DisplayName
#Checks if pc is online so Invoke doesn't hang on offline pc
if (Test-Connection -ComputerName $comp -Count 1) {
$localapps = Invoke-Command -ComputerName $ComputerName -SessionOption $(New-PSSessionOption -MaxConnectionRetryCount 1 -NoMachineProfile) -ScriptBlock {
Get-Package -ProviderName Programs -IncludeWindowsInstaller |
Select-Object @{N='DisplayName';E={$_.Name}} |
Sort-Object -Property DisplayName
}
}
}