Automate a PowerShell script that updates information on all SharePoint sites.

IniobongNkanga-8038 1,011 Reputation points
2025-01-09T18:32:36.0466667+00:00

Hello

Please i need your help on this issue.

My IT department has a few PowerShell scripts we are currently using to mass update various settings and user information in our SharePoint sites. Outside of running them using Task Scheduler, is there a way to automate them using Power Automate or something similar?

As a quick side question, is there a way to avoid the authentication that occurs when using Connect-SPOService?

I've tried passing in the admin credential, but receive the following error when I do:

Connect-SPOService : One or more errors occurred.

At C:\Users\Kperry\Documents\defaultopen.ps1:46 char:1

  • Connect-SPOService -URL $AdminSiteURL -Credential $cred

[Connect-SPOService], AggregateException

  • FullyQualifiedErrorId : System.AggregateException,Microsoft.Online.SharePoint.PowerShell.ConnectSPOService

The only way I've had the script succeed is by not passing a credential into the function. Which means I then have to manually select my login credential from the sign-in popup that appears. Without a solution to this, I feel that automating the script would be a bit pointless (as I will have to manually sign in when it runs).

Microsoft 365 and Office | SharePoint | Development
0 comments No comments

1 answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    1 deleted comment

    Comments have been turned off. Learn more

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.