Sep 27 2022 06:17 AM
Sep 27 2022 06:17 AM
Sounds easy, my powershell script works fine if i run it on my machine, it copies the file into the %USERPROFILE%\OpenVPN\config folder. Its packaged up using the Intunewinapp program, but when i put it into intune it fails to install and copy the file over. Culd something like defender be stopping this process? The script works, the intune package works when launched from powershell, so what causes it to fail when i run it as a win32 app from intune? Anyone had this issue before?
This is my script;
$PSScriptRoot = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
$Source = "$PSScriptRoot\Thornes.ovpn"
$Destination = "$env:USERPROFILE\OpenVPN\config\"
Copy-Item -Path $Source -Destination $Destination -Recurse -Force
Sep 27 2022 06:57 AM
Sep 27 2022 08:12 AM - edited Sep 27 2022 08:19 AM
Guess where the %userprofile% resolves to when deploying it as system : C:\Windows\System32\Config\systemprofile :)
and you could always use wildcards in the copy process c:\users\*\openvpn
Sep 27 2022 08:23 AM
Sep 27 2022 05:39 PM - edited Sep 27 2022 05:41 PM
Have you tried to use this C:\Users\%USERNAME%\openvpn\…?
This should do it if you run it as Run As User (Install Behavior).
Sep 28 2022 12:54 AM
Sep 28 2022 01:12 AM
Sep 28 2022 08:52 AM
Sep 28 2022 08:53 AM
Sep 28 2022 08:59 AM - edited Sep 28 2022 09:14 AM
You may need to change you powershell script to the one below, I have test it on my machine now.
$Path = New-item -ItemType directory -force -path "c:\users\%username%\OpenVPN\config\"
Copy-item -path $Source -Destination $path -Recurse -Force
My test has not work, I will update you soon
Sep 28 2022 09:07 AM
@Moe_Kinani Ill try that Moe, ive just thought sod it and pushed it out to all users, for some reason it says its installed on a couple of machines and failed on 10, so im wondering if its something on my machine, which ive been mostly using for testing. ive attached an Intune logfile if that helps anyone, just looking at it myself now.
Sep 28 2022 10:40 AM
@Moe_Kinani ah right, yea, it didnt work when i tried thee path like that either. So, here is the current install so far, out of 14 machines its only run on 2. So i think its at the client side. All the machines are domain joined and from the same image. All users are just standard users, but there must be something client side i think. The script fundamentally does work. Attached an image of the install status
Sep 28 2022 05:46 PM