Associate
Good Afternoon,
I am trying to do the following -
I have been using the following powershell script -
**NOTE: I am a complete noob when it comes to Powershell.**
# dump all DLs to a variable, whether DistributionList or mail-enabled Sec-group
$DLList = get-distributionlist
# Iterate over each DL to get member-list
foreach ($DL in $DLList) {
# Get the member list
$Dmember=get-distributiongroupmember $DL
# Get DL name
$Dname=$DL.name
# Start outputting
write-output "`q$Dname`q" -nonewline
# Iterate over member list, outputting
foreach ($Member in $Dmember) {
$MName=$Member.DisplayName
write-output ",`q$MName`q" -nonewline
}
# Add terminal line-feed
write-output "`n"
}
Now the above will get me a display on screen but how do I engineer the above script to export to a text or xls file?
I am trying to do the following -
- Run off a report of all the distribution lists and mail enabled security groups
- List the members of each group alongside each DL SG
I have been using the following powershell script -
**NOTE: I am a complete noob when it comes to Powershell.**
# dump all DLs to a variable, whether DistributionList or mail-enabled Sec-group
$DLList = get-distributionlist
# Iterate over each DL to get member-list
foreach ($DL in $DLList) {
# Get the member list
$Dmember=get-distributiongroupmember $DL
# Get DL name
$Dname=$DL.name
# Start outputting
write-output "`q$Dname`q" -nonewline
# Iterate over member list, outputting
foreach ($Member in $Dmember) {
$MName=$Member.DisplayName
write-output ",`q$MName`q" -nonewline
}
# Add terminal line-feed
write-output "`n"
}
Now the above will get me a display on screen but how do I engineer the above script to export to a text or xls file?