12Knocksinna / Office365itpros

Office 365 for IT Pros PowerShell examples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Check for C:\Temp

angusmclean11 opened this issue · comments

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
}

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!

TeamsGroupsActivityReport.ps1

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!