microsoftgraph / powershell-intune-samples

This repository of PowerShell sample scripts show how to access Intune service resources. They demonstrate this by making HTTPS RESTful API requests to the Microsoft Graph API from PowerShell.
MIT License
1.37k stars 658 forks source link

Get token for session #158

Closed bezik46 closed 3 years ago

bezik46 commented 3 years ago

Trying to run Win10_PrimaryUser_Set.ps1 from a batch file, but on every line I get:

Please specify your user principal name for Azure Authentication:

Is there a way to get a token that last the whole session?

davefalkus commented 3 years ago

As your using PowerShell already, why are you using a batch file to run the script?

Also why not put your code inside "Win10_PrimaryUser_Set.ps1" and customize for your requirements?