PowerShell to add new licenses to new user in Microsoft 365

I am having admin privileges to run Powershell commands and allocate licenses to new user.

I have to run command “Connect-MsolService” before running any other commands in MsolAccountSku → which populates popup everytime to sign in.

If I do automation using Invoke PowerShell. How can I handle such popups for every robot execution?

If we can’t handle such popups during execution - do you suggest to use Web automation for assigning licenses.

I can’t run batch commands. Objective is to validate output after running each command.

@FrankSchikora : Please guide on this subject.

@huston8 : Please share your inputs

Please see the following videos about invoking powershell and .batch files. They could help you:
Invoke PowerShell: UiPath | Invoke Power Shell Code | How to invoke Power Shell Script in UiPath with Input Parameters - YouTube
CMD Command General: UiPath | CMD Commad General | Start any cmd Code with this General cmd command code | VB.Net - YouTube
Run Batch File: UiPath | Run Batch File | How to run batch file with UiPath | .bat file | Start Process Activity - YouTube

Best regards
Mahmoud

Thanks @Dawodm
Let me check and try to pass robot credentials (from assets) to authenticate using PowerShell to access Microsoft 365 admin.