I found this PS script that check if the PC is a Desktop or a Laptop
function Get-HardwareType {
$hardwaretype = Get-WmiObject -Class Win32_ComputerSystem -Property PCSystemType
If ($hardwaretype -ne 2)
{
return $true
}
Else
{
return $false
}}
If (Get-HardwareType)
{
"$Env:ComputerName is a Desktop"
}
Else
{
"$Env:ComputerName is a Laptop"
}
If the result is "Laptop", I need to run this other command
Add-AppxPackage -Path ".\28671Petrroll.PowerPlanSwitcher_0.4.4.0_x86__ge82akyxbc7z4.Appx"
or else to skip it. How can I combine them?
EDIT:
Seems that I need an internet connection for completely install the app; without internet the app doesn't start as long as I run the app with an internet connection. Does someone know what I need to do without an internet connection? Or it's impossible?