PowerShell insert brake after each returned object

Hi,
I have PowerShell script that returns members of local admin group on remote PC's, however I am trying to insert a brake for each group. Example:
Script:
function get-localadmin {
$computer = Get-Content C:\Computers\computers.txt
$admins = Gwmi win32_groupuser –computer $computer  
$admins = $admins |? {$_.groupcomponent –like '*"Administrators"'}
$admins | % {$_.partcomponent –match “.+Domain\=(.+)\,Name\=(.+)$” > $null
$matches[1].trim('"') + “\” + $matches[2].trim('"')
}
}
get-localadmin | Out-File C:\Computers\members.txt

Result:
PC6666\localadmin
PC6666\MRSUser
CORP\$Desktop Support
CORP\Domain Admins
PC7777\localadmin
PC7777\MRSUser
CORP\$Desktop Support
CORP\Domain Admins
PC9999\LocalAdmin
PC9999\MRSUser
CORP\$Desktop Support
CORP\Domain Admins
etc.

I need to insert a brake after each group so it returns in a better to read format. Example:

PC6666\localadmin
PC6666\MRSUser
CORP\$Desktop Support
CORP\Domain Admins

PC7777\localadmin
PC7777\MRSUser
CORP\$Desktop Support
CORP\Domain Admins

PC9999\LocalAdmin
PC9999\MRSUser
CORP\$Desktop Support
CORP\Domain Admins



Any suggestions are appreciated.
MRSAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CD, MVPOwnerCommented:
function get-localadmin {
  $admins = Get-WmiObject win32_groupuser -computer $computer  
  $admins = $admins |Where-Object {$_.groupcomponent -like '*"Administrators"'}
  $admins | ForEach-Object {$_.partcomponent -match ".+Domain\=(.+)\,Name\=(.+)$" > $null
  $matches[1].trim('"') + "\" + $matches[2].trim('"')
  }
}
Remove-Item -Path c:\computers\members.txt -ErrorAction SilentlyContinue
$computers = Get-Content C:\Computers\computers.txt
foreach($computer in $computers)
  {
  get-localadmin | Out-File C:\Computers\members.txt -append
#two single quotes not a double quote
  '' | Out-File C:\Computers\members.txt -append
  }

Open in new window

1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MRSAuthor Commented:
Thank you.....
0
MRSAuthor Commented:
Can I ask one more thing regarding this?
How do I add to this on each line it's computer name?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.