PowerShell Script – Loop
Rick emailed me asking the following question about the PowerShell script I wrote last year for adding a domain user to the local admin group on a computer.
How would I loop thru the script for multiple machines ? i.e how to add an account to the local admin groups to a list of systems in a csv
Short answer is you need to look using two PowerShell cmdlets in conjunction. They are:
- Import-CSV
- ForEach-Object
You can read about them and a bit about how to use them here, and here. Additionally, I would refer anyone with scripting questions to check out the Scripting Guys blog…it is fantastic.
Hope that helps.
No comments yet.
Leave a Reply