Thanks for the information. Is there a limit to the no of try the script would attempt on the device. The documentation says 3 but i am seeing it attempting on every check in.
So if I want to know why my script isn't working, I have to add a whole debug script to the script? Great job Microsoft... Also, I don't understand. What was changed in Event Viewer to get the log file to generate? I'm unable to replicate these steps. Not even getting the folder to appear, but Intune says the script was run on the client.
Thanks Adam/Steve/Ben this is really useful content....much appreciated...could you guys cover App Protection Policies please , if you haven't already done so.
Is it possible to deploy PowerShell scripts through Intune that calls a CSV file "not stored in the target computer"? I have a long CSV file I'm using as for my input and further comparing against some queries. So building a huge array in the script is not an option. Very nice material guys!
You can deploy the content embedded in the script body, or you can use Azure Blob storage, network file share, Win32 app, etc. If you store on a share, you’ll have to handle Auth - AADJ machines won’t be able to Auth to the share - only the user account, so you’ll have to work that into your plan.
Hi Guys, Needing a bit of help. Been using InTune for a while. Getting on reasonably well. Watched a lot of your videos when I first started on it (working for a smaller company so was the one giving the mdm a go!) I simply cannot get powershell scripts to work via intune. I''ve managed it for MAC's without a problem (intune and macs... :|) I've tried going back to basics - "New-Item -Path 'C:\PowerShellTestFolder' -ItemType Directory". Works locally but cannot deploy from Intune to the same device it worked locally. It shows on the admin console as "Device Status" etc as 0. Its just not finding the device. As its such a low risk script I tried pushing it across a wider security group of about 10 devices and it picked up and worked for 1 device of those. What am i missing? I presume theres something stopping it being unable to pick up the devices. The reason I wonder if its this is the device that it did work on is s "BYOD" device so the owner may have certain config on there that allows the scripting to run! Fairly confident i tick the prerequisites docs.microsoft.com/en-us/mem/intune/apps/intune-management-extension I've had a dig through in Administrative Templates Windows Components > Windows PowerShell as well to see if theres any config in there that would allow the scripting to run but no luck with those either. There's nothing in any of the logs etc to indicate the script as even tried to run. I've goggled the issue repeatedly as well and can see others have had the same issue but no real resolution :( Any guidance at all for tips on where to look, settings to try/check/play around with. Articles to read, videos to watch all appreciated.
Hi, i've written some very small scripts running per intune without any problem but the overview shows me that the scripts run into failure. How can i tell intune that the script does it'äs job and run sucessfull?
Put your code inside of try / catch blocks and create some transcript logging. If *your* script is failing, *you* need to write the code to tell you why it's failing. - Ben
The script probably ran, didn't do what you expected it would, but didn't outright fail (returning an exit code of 0 means success, regardless of what the script achieved). Run the script manually - use PSTools to validate the experience as system if required. Add logging to the solution and review where it's failing. -- Ben
Learned more about Intune and improved by PowerShell knowledge as a bonus.
Nice addition to my knowledge on Powershell! Never seen the transcript option before. Cool and useful stuff. Thanksssss
You guys are doing awesome work. Very much appreciated.
Cool stuff! Thanks for the vid. Greatly enjoying your series.
This is super helpful. Thanks a lot both of you!
I'd like to come back just to tell you how this saved my day today :p
Thanks for the information. Is there a limit to the no of try the script would attempt on the device. The documentation says 3 but i am seeing it attempting on every check in.
It's between 3 and 5 attempts. But you should be using Proactive Remediations moving forward.
- Ben
So if I want to know why my script isn't working, I have to add a whole debug script to the script? Great job Microsoft...
Also, I don't understand. What was changed in Event Viewer to get the log file to generate? I'm unable to replicate these steps. Not even getting the folder to appear, but Intune says the script was run on the client.
Thanks Adam/Steve/Ben this is really useful content....much appreciated...could you guys cover App Protection Policies please , if you haven't already done so.
How intune determines successful execution of powershell script ? is it based on exit code 0 for script execution ?
Correct. Standard exit of 0 means no errors caused the PowerShell process to bomb out.
- Ben
Hi, If a PowerShell script has successfully ran on a machine and then it requires a Reset of the device. Would the script run again?
It sure will.
Is it possible to deploy PowerShell scripts through Intune that calls a CSV file "not stored in the target computer"? I have a long CSV file I'm using as for my input and further comparing against some queries. So building a huge array in the script is not an option. Very nice material guys!
You can deploy the content embedded in the script body, or you can use Azure Blob storage, network file share, Win32 app, etc. If you store on a share, you’ll have to handle Auth - AADJ machines won’t be able to Auth to the share - only the user account, so you’ll have to work that into your plan.
@@IntuneTraining thanks! I got to managed it through Win32 app but the Azure Blob storage approach sounds much better to me. Thanks once again!
Hi Guys,
Needing a bit of help. Been using InTune for a while. Getting on reasonably well. Watched a lot of your videos when I first started on it (working for a smaller company so was the one giving the mdm a go!)
I simply cannot get powershell scripts to work via intune. I''ve managed it for MAC's without a problem (intune and macs... :|)
I've tried going back to basics - "New-Item -Path 'C:\PowerShellTestFolder' -ItemType Directory". Works locally but cannot deploy from Intune to the same device it worked locally. It shows on the admin console as "Device Status" etc as 0. Its just not finding the device.
As its such a low risk script I tried pushing it across a wider security group of about 10 devices and it picked up and worked for 1 device of those. What am i missing? I presume theres something stopping it being unable to pick up the devices. The reason I wonder if its this is the device that it did work on is s "BYOD" device so the owner may have certain config on there that allows the scripting to run!
Fairly confident i tick the prerequisites docs.microsoft.com/en-us/mem/intune/apps/intune-management-extension
I've had a dig through in Administrative Templates Windows Components > Windows PowerShell as well to see if theres any config in there that would allow the scripting to run but no luck with those either.
There's nothing in any of the logs etc to indicate the script as even tried to run. I've goggled the issue repeatedly as well and can see others have had the same issue but no real resolution :(
Any guidance at all for tips on where to look, settings to try/check/play around with. Articles to read, videos to watch all appreciated.
Hi, i've written some very small scripts running per intune without any problem but the overview shows me that the scripts run into failure. How can i tell intune that the script does it'äs job and run sucessfull?
Put your code inside of try / catch blocks and create some transcript logging.
If *your* script is failing, *you* need to write the code to tell you why it's failing.
- Ben
Ben or Adam (or both), recommended PowerShell learning resources for someone that's wanting to learn?
This book is a great resource to get you going. www.amazon.com/Learn-Windows-PowerShell-Month-Lunches/dp/1617294160
Audio is really annoying, but thanks for the info
Hi team. I have scripts that say successful via intune however when I look at the machine the registry change didn't happen. Any thoughts
The script probably ran, didn't do what you expected it would, but didn't outright fail (returning an exit code of 0 means success, regardless of what the script achieved).
Run the script manually - use PSTools to validate the experience as system if required. Add logging to the solution and review where it's failing.
-- Ben