Name Export via Powershell not working as expected
I am trying to dump application data from Azure into their own file, however, when i reference the DisplayName attribute for the application to save as the file name I get a weird naming convention. The code below imports the csv with the DisplayName and Object ID. Attached is sample file as well
The output file name is as follows: @{DisplayName=Test Application; ObjectId=10f3cd35-bf7e-468d-bdbb-298fa456b3c5; AppId=440ba5b1-0372-4b62-9379-edf7096c8cb5}.DisplayName.csv
Any help would be appreciated
Jose is correct. But as here, it is not obvious that a parameter is a string, because PowerShell tries to do its best in "helping" you to use parameters and types:
If the filename expression starts with a bracket or dollar, it would first get evaluated as expression and return a string.
In other cases the "expression" is seen as a string, with inline string evaluation only - that is what you see.
In fact. it is much more complicated ;-). But in general you can assume that file name parameters are (implicit) strings. Get-Content, Import-*, Export-* are examples for that behaviour.
ntr2def
ASKER
Thank you Jose for the re-education. It has been over a year since I have done programmatic administration and as you were explaining my immediate reaction was "Duh!"
Jose Gabriel Ortega Castro
Yeah? haha, so much fun! :)
Read the @Qlemo comment and as well as @odba I respect them much, especially on the Powershell area, they're gods of it :)
And I'm glad to help
If the filename expression starts with a bracket or dollar, it would first get evaluated as expression and return a string.
In other cases the "expression" is seen as a string, with inline string evaluation only - that is what you see.
In fact. it is much more complicated ;-). But in general you can assume that file name parameters are (implicit) strings. Get-Content, Import-*, Export-* are examples for that behaviour.