How to Integrate CSV Import in My PowerShell Script for User Access Analysis?

0
4
Asked By TechGuru87 On

I'm looking for guidance on where to place the command to import a CSV file in my PowerShell script. My script retrieves a list of files from various SharePoint sites within a tenant and checks user access permissions. However, I need to integrate the import of a users.csv file into this process. Given that I have a large number of sites to process (over 14,000), I've split them into manageable chunks and will run the script multiple times. Any advice on where specifically to put the `$users = Import-Csv -Path .users.csv` command within the script would be greatly appreciated. I've also linked to the script I'm using if you have any specific thoughts on that.

2 Answers

Answered By DataMaster21 On

For large environments like yours, it's worth checking out Microsoft Graph Data Connect. It's specially designed for handling data more efficiently and might save you some time with those 14,000 sites. Just make sure to confirm with your Global Admin if you have access to that since it can simplify a lot of processes.

SharePointSeeker -

Thanks for the suggestion! I’ll definitely follow up on that with my team. We need all the efficiency we can get, and if we do have it, it could really help streamline our work.

Answered By CommandLineAce On

Regarding your question about where to place the import command, you can put `$users = Import-Csv -Path .users.csv` at the very beginning of your script. Just remember, the `.` means it's looking in the current directory, but you can specify a different path if needed. It's also a good idea to discuss your approach and the script with teammates to get more insights.

InfoHunter42 -

I think I get what you're saying, but isn’t there a chance I might need it somewhere later in the script? Just trying to figure out the best flow.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.