Giter Site home page Giter Site logo

Comments (14)

RichardZimmerman avatar RichardZimmerman commented on June 5, 2024 1

That fixed it! Thank you very much for your help!!!
My GitHub Action (automation) isn't the most advanced right now, but we're now able to schedule regular exports from Intune using this feature. This is much appreciated.

from intunemanagement.

Micke-K avatar Micke-K commented on June 5, 2024

Hello!

Thank you for the support!

This has been requested before. I started looking into it but realised it would be a massive change. I am not sure exactly how to do it. Command line arguments would be a mess since that would end up being way too many to support all options. I might look into having a json file for each environment you want to automate. Another issue is login. For fully automation, the json file should support logging in with an app/secret instead of interactive login.

Any suggestions on how you would like it to work?

Cheers!

from intunemanagement.

osotechie avatar osotechie commented on June 5, 2024

Yeah agree it could become difficult... Maybe start with some bigger / broader tasks only.... For example bulk export / bulk import actions.

Def. happy to have a chat and see how I could help, I haven't done a heap with Powershell GUI so be good to understand the structure of your code etc... I have written a heap of similar automations as well but like what you've done so keen to support and expand on it.

Drop me a message maybe via LinkedIn and we can chat more

from intunemanagement.

RichardZimmerman avatar RichardZimmerman commented on June 5, 2024

I'm having an issue with the Silent Batch Job feature.
Currently, I am cloning the repo on a GitHub runner (temporary VM) to execute the silent batch job.

Each time I run the job (which includes a properly formatted call to the Silent Batch Job feature which includes an appId, tenantId, and secret), I receive "Not authenticated. Batch job will be skipped".

If, on an identical machine, I run start.cmd and accept the EULA, I am then able to close the IntuneManagement window and perform the exact same call to the silent Bulk Export feature with success.

In summary, is there a way I can automate the acceptance of the EULA or have the EULA check disabled for the Silent Batch Job feature?

from intunemanagement.

Micke-K avatar Micke-K commented on June 5, 2024

Hello!

Thank you for reporting this!

The acceptance of the EULA only happens when the windows is displayed, so it will not be "used" during the batch job.

I found a bug when using secret/certificate from Settings. Can you please test with the attached MSALAuthentication file and try?

Cheers!

MSALAuthentication.zip

from intunemanagement.

RichardZimmerman avatar RichardZimmerman commented on June 5, 2024

Thank you for the response.

I tried replacing the MSALAuthentication.psm1 file without success.
I'm creating a fresh [static] machine (Windows Server 2022) now so I can dig a little deeper. I wonder what caused the Silent Batch Job feature to work in my test yesterday.

Here is the statement I am using to execute the Batch Job.

Start-Process -NoNewWindow -Wait -WorkingDirectory $env:GITHUB_WORKSPACE -FilePath powershell -ArgumentList "-File "".\Start-IntuneManagement.ps1""", "-Silent", "-SilentBatchFile .\BulkExport.json", "-TenantId <myTeantId>", "-AppId <myAppId>", "-Secret $env:THIS_SECRET"

from intunemanagement.

Micke-K avatar Micke-K commented on June 5, 2024

Thank you for the update!

Well, that explains why the change didn't work. There was a bug in the script that caused it to fail if the information was stored in Settings or if a certificate was used. Secret on the command line should have worked.

Do you get any errors in the log before it says It isn't authenticated? It has all required info eg TenantId, AppId and Secret because in would not try to authenticate without them. So it should try but I'm not sure what the error would be if one if them are wrong. I can do some testing on the weekend and see if what it could be + add more logging and see where it fails.

Cheers!

from intunemanagement.

RichardZimmerman avatar RichardZimmerman commented on June 5, 2024

I am seeing the same behavior as yesterday. On a brand new server where I have copied the necessary files and set the appropriate environment variables, I cannot run the statement above without the "Not authenticated. Batch job will be skipped" error.

For the second test I run start.cmd by double-clicking and select "cancel" at the EULA, closing the window. I receive the same error when trying to execute the above statement after the window/GUI is closed.

For the third test, I run start.cmd by double-click and accept the conditions in the EULA. After the window displaying the EULA disappears, I close the main window. I run the same statement as above (for all of my test, I have ISE open so I can easily re-run the same statement) and I receive the Intune data I need.

Maybe there is some initialization step that happens after accepting the EULA.

Edit: I see you replied as I was writing this.

from intunemanagement.

RichardZimmerman avatar RichardZimmerman commented on June 5, 2024

image
Here's a screenshot of a complete run-through from "test 1" which was executing the call to the Silent Batch Job feature before launching start.cmd

The logs from "test 2" look the same.

I really appreciate your time on this. I have a feeling there's something simple I missed and I'm going to be embarrassed when I find the answer.

from intunemanagement.

Micke-K avatar Micke-K commented on June 5, 2024

Found it...not sure if I can call it a bug or just bad design. If failed the first time because the reg value FirstTimeRunning was not False, which is obvious since it doesn't exist at that point. It was a way to force a manual login the first time which might not be what we want during a batch job. Try this version of the file.

Sorry about that!

Cheers!

MSALAuthentication.zip

from intunemanagement.

b1grif avatar b1grif commented on June 5, 2024

Hello! This is a great project and a huge help!

First off, who ever setup my tenant many years ago put a space at the end of the tenant name. I'm not sure what could be using the name so I'd rather not change the name and break other things.
So when I run an export in non-interactive mode, the export is working but it is still using tenant name in the file paths.

  • I've unchecked 'Add company Name' in File > Settings
  • I've unchecked 'Add company name to path' in Bulk > Export and saved that to the json file to use with the -SilentBatchFile switch
  • I've verified that 'AddCompanyName' in HKCU\Software\CloudAPIPowerShellManagement is set to 'False'

Is there something else that I'm missing?

from intunemanagement.

Micke-K avatar Micke-K commented on June 5, 2024

Hello @b1grif

Thank you for reporting this! Looks like there is a bug so values that are false were not used.

I'll have a look at this over the weekend.

Cheers!

from intunemanagement.

Micke-K avatar Micke-K commented on June 5, 2024

Core.txt

Try this one. Rename to psm1 and overwrite existing file

from intunemanagement.

b1grif avatar b1grif commented on June 5, 2024

Thanks @Micke-K ! That did the trick!

from intunemanagement.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.