DeaconFrost
[H]F Junkie
- Joined
- Sep 6, 2007
- Messages
- 11,582
I have a list of similar cmdlets to run, each one outputting a text file. The cmdlet runs fine by itself. Is there a way to have the list run as a script (ps1) that runs each line and generates each file, so I don't have to copy and paste each one manually?
The cmdlet is Get-ADGroupMember -Identity 'Group Name' | Select Name | Out-File "File Path".
So I would have the following:
Get-ADGroupMember -Identity 'Group1' | Select Name | Out-File "C:\Temp\Group1.txt"
Get-ADGroupMember -Identity 'Group2' | Select Name | Out-File "C:\Temp\Group2.txt"
...and so on, so that in the end, if I had 35 lines, I'd end up with 35 text files.
The cmdlet is Get-ADGroupMember -Identity 'Group Name' | Select Name | Out-File "File Path".
So I would have the following:
Get-ADGroupMember -Identity 'Group1' | Select Name | Out-File "C:\Temp\Group1.txt"
Get-ADGroupMember -Identity 'Group2' | Select Name | Out-File "C:\Temp\Group2.txt"
...and so on, so that in the end, if I had 35 lines, I'd end up with 35 text files.