12Knocksinna / Office365itpros

Office 365 for IT Pros PowerShell examples
MIT License
1.28k stars 567 forks source link

Check for C:\Temp #47

Closed angusmclean11 closed 2 years ago

angusmclean11 commented 2 years ago

I had an issue running the script on a machine that didn't have a folder C:\Temp. The script ran perfectly except for saving the .csv and .html files. Can you please add these lines to create the folder if it doesn't exist?

$path = "C:\Temp" If(!(test-path $path)) { New-Item -ItemType Directory -Force -Path $path | Out-Null }

12Knocksinna commented 2 years ago

What script are you referring to? I can go ahead and add the code in lots of scripts... but that's really something for those who run the scripts to do because they might want to use a different folder!

angusmclean11 commented 2 years ago

TeamsGroupsActivityReport.ps1

12Knocksinna commented 2 years ago

OK, that's an old script (the new version uses Graph queries to speed up processing - https://github.com/12Knocksinna/Office365itpros/blob/master/TeamsGroupsActivityReportV5.PS1). In any case, I've added the lines to both scripts. happy PowerShell!