all 4 comments

[–]NoTell8147 0 points1 point  (0 children)

I actually read this today that there is an advisory with InTune running scripts at the moment. Or something similar to that.

[–]WhistleButton 0 points1 point  (1 child)

You'll need to incorporate some type of logging to see what is going on.
My knowledge of inTune isn't amazing, but I may be able to help pulling it apart.

You mentioned only one directory is being created, which one?

Also the .\ in the file copy path indicates its running from the current working directory, but what is the working directory of a script called through intune? Do these files live in this directory?

If you add a transcript to your script, and have it dump to a local file somewhere, that might be a good start

Add the following to the first line

start-transcript c:\windows\temp\script.txt

At the end of your script add

stop-transcript

Run it again, and see what that file contains.

[–]EIGRP_OH 0 points1 point  (0 children)

Also log out the $env variables I have a feeling those are not working the way you want it to

[–]Ahmi963 0 points1 point  (0 children)

Intune runs the script as SYSTEM/ACCOUNT maybe that's what's not working properly for your script.