I am trying to deploy a folder to current users’ documents folder using the win32 app deployment tool to create an intunewin file and then deploy via intune.
I have packaged the following to be converted into an intunewin file:
Install.cmd
VPN.txt
PSscript.ps1
Below is a couple PSscripts I’ve attempted but keeps failing. Any ideas would be greatly appreciated!
Without having experiences with Intune - it might not be an PowerShell issue?!
$PSScriptRoot is an automatic variable filled in be PowerShell when running a script. You should not use this name for your own variables!!
Regardless of that unnecessary variable assignment - does the script runs in the current users context? If it runs in system context you cannot use $Env:Username or $env:Documents!
@ECHO OFF
SET ThisScriptsDirectory=%~dp0
SET PowerShellScriptPath=%ThisScriptsDirectory%PSscript.ps1
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& '%PowerShellScriptPath%'"
This script doesnt run at all. Do you have any suggestions for the correct syntax for the users’ folder?
I need to the install.cmd to intune can all it. You can run scripts in intune, but it will need the folder files which you can’t do unless you packaged the cmd, PScript into an intunewin file.
Is Intune not able to run tasks in system context?
But if the script runs in user context anyway the environment variables should work. Have you tried providing the path to the script file with the -File parameter?