My brain has gone to mush this morning!
I would like to save the name of the exported file below into a variable, so I can add this to an array. The reason behind this is because I am using a date and time stamp for the end of the filename.
I am not sure how to proceed from here. Please help a fellow n00bie :D
$DateFilename = Get-Date -format "dd-MM-yyyy@HH-mm"
get-adgroup -filter * -Properties * | where {$_.managedby -eq $null -and $_.distinguishedname -notlike "*OU=To Be Deleted,OU=Groups,OU=UK,DC=Domain,DC=Domain,DC=net"} | Select SamAccountName, description, managedby, whencreated | export-csv C:\PS\exports\Groups_No_Desc_$DateFilename.csv
Thanks