Skip to content

Commit

Permalink
Add output file (Excel or CSV)
Browse files Browse the repository at this point in the history
  • Loading branch information
12Knocksinna committed Dec 5, 2024
1 parent fa77bc7 commit a7b83e2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
16 changes: 16 additions & 0 deletions Find-CopilotInteractions-Graph.PS1
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,22 @@ Write-Host ("{0} of the {1} interactions are automatic ({2})" -f $NumberOfAutoma
Write-Host ("{0} of the interactions are user prompts ({1})" -f $UserInteractions, $PerecentUserInteractions)
Write-Host ("{0} of the interactions are Copilot responses to user prompts" -f $PercentCopilotResponses)

# Generate reports
If (Get-Module ImportExcel -ListAvailable) {
$ExcelGenerated = $True
Import-Module ImportExcel -ErrorAction SilentlyContinue
$OutputXLSXFile = ((New-Object -ComObject Shell.Application).Namespace('shell:Downloads').Self.Path) + "\CopilotInteractions.xlsx"
$Report | Export-Excel -Path $OutputXLSXFile -WorksheetName "Copilot Interactions" -Title ("Copilot Interactions {0}" -f (Get-Date -format 'dd-MMM-yyyy')) -TitleBold -TableName "CopilotInteractions"
} Else {
$OutputCSVFile = ((New-Object -ComObject Shell.Application).Namespace('shell:Downloads').Self.Path) + "\CopilotInteractions.csv"
$Report | Export-Csv -Path $OutputCSVFile -NoTypeInformation -Encoding Utf8
}

If ($ExcelGenerated) {
Write-Host ("An Excel report is available in {0}" -f $OutputXLSXFile)
} Else {
Write-Host ("A CSV report is available in {0}" -f $OutputCSVFile)
}

# An example script used to illustrate a concept. More information about the topic can be found in the Office 365 for IT Pros eBook https://gum.co/O365IT/
# and/or a relevant article on https://office365itpros.com or https://www.practical365.com. See our post about the Office 365 for IT Pros repository # https://office365itpros.com/office-365-github-repository/ for information about the scripts we write.
Expand Down
12 changes: 6 additions & 6 deletions Find-InactiveEmailUsers.PS1
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ If (Get-Module ImportExcel -ListAvailable) {
} Else {
$OutputCSVFile = ((New-Object -ComObject Shell.Application).Namespace('shell:Downloads').Self.Path) + "\InactiveMailUsers.csv"
$Report | Export-Csv -Path $OutputCSVFile -NoTypeInformation -Encoding Utf8
}
}

If ($ExcelGenerated) {
Write-Host ("An Excel report is available in {0}" -f $OutputXLSXFile)
} Else {
Write-Host ("A CSV report is available in {0}" -f $OutputCSVFile)
}
If ($ExcelGenerated) {
Write-Host ("An Excel report is available in {0}" -f $OutputXLSXFile)
} Else {
Write-Host ("A CSV report is available in {0}" -f $OutputCSVFile)
}

# An example script used to illustrate a concept. More information about the topic can be found in the Office 365 for IT Pros eBook https://gum.co/O365IT/
# and/or a relevant article on https://office365itpros.com or https://www.practical365.com. See our post about the Office 365 for IT Pros repository # https://office365itpros.com/office-365-github-repository/ for information about the scripts we write.
Expand Down
2 changes: 1 addition & 1 deletion FindMailItemsAccessedAuditRecords.PS1
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ ForEach ($Rec in $Records) {
$Report.Add($ReportLine)
}

$Report | Sort-Object {$_.TimeStamp -as [DateTime]} |Out-GridView
$Report | Sort-Object {$_.TimeStamp -as [DateTime]} | Out-GridView
$Report | Sort-Object {$_.TimeStamp -as [DateTime]} | Export-CSV -NoTypeInformation c:\temp\MailItemsAccessed.csv

# An example script used to illustrate a concept. More information about the topic can be found in the Office 365 for IT Pros eBook https://gum.co/O365IT/
Expand Down

0 comments on commit a7b83e2

Please sign in to comment.