Install app and create/copy 2 files to installation folder during Autopilot

Hi there,

I am trying to install a VPN app and automatically import 2 VPN profiles.
What I have now works fine during installation through Company Portal, but when installing a new laptop and using Autopilot, it installs the app, but copying (or creating) the 2 profiles fails.

First I tried by copying it from the DirFiles to the installation folder with the env var for programfilesX86.
Then tried by letting PowerShell create the 2 files (they are basically json files) in the specific folder.

Both fail during Autopilot but work in Company Portal.

I hope someone can help me.

Can you post the line where you copy the 2 json files?

Maybe include the actual error message?

The creating of jsons is done this way:

    $XXXX = @(
        @{
            display_name     = "XXX VPN"
            gateway          = "XXXX.nl"
            user_portal_port = 443
            auto_connect_host = ""
        }
    )

    $YYYY = @(
        @{
            display_name     = "YYYY VPN"
            gateway          = "YYYYY.com"
            user_portal_port = 443
            auto_connect_host = ""
        }
    )

    $filePathXXXX = "$envProgramFilesX86\Sophos\Connect\import\XXXX.pro"
    $filePathYYYY = "$envProgramFilesX86\Sophos\Connect\import\YYYY.pro"

    $XXXXpro = $XXXX | ConvertTo-Json -Depth 3
    $YYYYro = $YYYY | ConvertTo-Json -Depth 3

    Set-Content -Path $filePathXXXX -Value $XXXXpro -Encoding UTF8
    Set-Content -Path $filePathYYYY -Value $YYYYro -Encoding UTF8

the copy was this:

Copy-ADTFile -Path "$($adtSession.DirFiles)\Profiles\*" -Destination "$($envProgramFilesX86)\Sophos\Connect\import\"

I used that $adtSession.DirFiles cause I was also trying the CopyToCache.

I am not sure where to get the logs from, can you tell me where to grab those?

PSADT's default log file location is '$envWinDir\Logs\Software'

Thanks! Let me do a fresh install again and get the logs from it.
I will do it with the copy from cache.

Here is the log.

Apparently it copies the files I suppose (the copy command is successful). But the Sophos app isn't importing them. Perhaps this is because it's not logged on yet?
Right now this app is installed on device level, do you think it would make a difference if I install it on user level? Though that would be problematic with shared devices.

According to the log file, PSADT installed the app and copied the files just fine. I think you have a Sophos app issue. Maybe it has a log file too.

Yes that is what I mentioned before.
During autopilot it is doing things under a different login. I think the provisioning files are imported by Sophos, but it not for the user that is actually going to use the laptop.
Because (re)installing it from the Company Portal works perfect.

if a user cannot read files from the c:\Program files (x86)\ folder, the computer is seriously screwed up.

It's not that they can't read it, it is that during the autopilot, the installation of apps is done under device level, meaning the files are imported under that "user account". After the actual user logs in, the files are already gone.

Ask Sophos if there is a parameter to NOT import the provisioning files at install time.

That way, it will import the provisioning files upon user launch.

1 Like