Forum Discussion
Chris_White_81
Sep 27, 2022Copper Contributor
Copy a OVPN file in Powershell from Intune
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...
Sep 27, 2022
Hi... %userprofile% ... I am missing how the install behavior is configured
Is it configured as System?
If run as system, maybe searching the logged in user first? and change the destination to match the username who has explorer running?
$username = (get-process -name "explorer" -includeusername).username
$username = ($username -split '\\')[1]
$Destination = c:\users\$username\OpenVPN\config\"
Is it configured as System?
If run as system, maybe searching the logged in user first? and change the destination to match the username who has explorer running?
$username = (get-process -name "explorer" -includeusername).username
$username = ($username -split '\\')[1]
$Destination = c:\users\$username\OpenVPN\config\"
- Chris_White_81Sep 27, 2022Copper Contributor
Sorry, yes, its configured to run as system, if i run it on my machine locally it does what it should be. ill look at your suggestions though and see if i can get it working thanks.
- Sep 27, 2022
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
- Chris_White_81Sep 27, 2022Copper Contributor
Rudy_Ooms_MVP Dam, tried it again as user, still fails from intune, doesnt copy the file into the open VPN config folder, will make some futher amendments!