I'm copying some files in user context, and even using -WindowStyle Hidden, it still briefly displays a PowerShell window.
Is there a way to make it not display anything like in user context ?
I tested it in 3 different ways:
Intune Install Command
Powershell.exe -NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden .\Invoke-AppDeployToolkit.ps1 -DeploymentType "Install" -DeployMode "Silent"
PSADT Command
1 - Test
$PPTFilePath = "$env:APPDATA\Microsoft\Templates"
Copy-Item -Path "$($adtSession.DirFiles)\Blank.potx" -Destination $PPTFilePath -Recurse -Force
2 - Test
$PPTFilePath = "$env:APPDATA\Microsoft\Templates"
Copy-ADTItem -Path "$($adtSession.DirFiles)\Blank.potx" -Destination $PPTFilePath -Recurse -Force
3 - Test
$PPTFilePath = "$env:APPDATA\Microsoft\Templates"
Start-Process -FilePath 'powershell.exe' -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command ""Copy-Item -Path '$($adtSession.DirFiles)\Blank.potx' -Destination '$env:APPDATA\Microsoft\Templates\Blank.potx' -Force""" -WindowStyle Hidden -Wait