You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
*.Format.ps1xml files are missing (example: FileSystem.Format.ps1xml) #7973
help about_format.ps1xml says that the *.format.ps1xml files are located in the $PSHOME directory but the format files are missing from that directory (and do not exist in the entire directory tree)
Expected behavior
-----------------
```none
Actual behavior
Environment data
>$PSVersionTable`Name Value
---------
PSVersion 6.1.0
PSEdition Core
GitCommitId 6.1.0
OS Microsoft Windows 10.0.17763
Platform Win32NT
PSCompatibleVersions {1.0,2.0,3.0,4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Do you have a need for the ps1xml files? In PowerShell Core 6, the built in formatting are in c# and not in actual ps1xml files. If the concern is the docs are incorrect, we can fix that.
Since the ps1xml files were first released I have modified them to make a some changes.
With each new PS version I have incorporated my changes into the new files in case anything else
changed.
My concern is that the built-in formatting would either add additional changes or possible include
some of my changes. That's why I merge them into the files each time.
Here is a summary of the changes I make:
TableControl
Reduced LastWriteTime from 25 to 20 to allow some extra space for the next change
Increased Length from 14 to 15 to allow room for formatting the length to include commas
Modify LastWriteTime formatting to M/dd/yyyy and h:mm:tt so that date and times line up
better and are easier to read
Modify Length formatting to {0:n0} so that it includes commas
(I cannot believe PS has not made this change in all these years, even DOS had commas!)
ListControl
Modify Length formatting to {0:n0} so that it includes commas
Modify CreationTime formatting to M/dd/yyyy and h:mm:tt so that date and times line up
(NOTE: 2 places require changing)
Modify LastWriteTime formatting to M/dd/yyyy and h:mm:tt so that date and times line up
(NOTE: 2 places require changing)
Modify LastAccessTime formatting to M/dd/yyyy and h:mm:tt so that date and times line up
(NOTE: 2 places require changing)
Then I use the following in my profile to incorporate my changes into the PS session
Steve Lee (@SteveL-MSFT) I would think that at the very least there should be one example / template file, both as a .ps1xml and a .cs file; a good example often speaks much more clearly than several pages of detailed specification. 😕
Joe S (@JoeSalmeri) perhaps you can open a new issue with your specific changes you think should be applied and we can see about making those changes in the product
Rain Sallow (/u/ta11ow) (@vexx32) long term, I'd like to get away from xml for types and formatting, but that feels a long ways away given everything else we want/need to do. We still have some example ps1xml files in this repo and you can always grab the ones from Windows PowerShell. The default formatters are here
Steve Lee (@SteveL-MSFT) I really can't agree more. I'd love to see Update-FormatData accept direct object input and for the relevant necessary type configuration objects be able to be created in PowerShell directly or created with some kind of hashtable syntax.
Sorry for the delay on my part, I was away do to personal issues.
I have opened Issue #8060 where I submitted the changes we have been discussing.
The file included is a copy of the latest FileSystem.Format.ps1xml file with my changes made and includes documentation at the top of what the changes are as well as documentation where each change is made.
Please let me know if you have any questions and thanks very much for your help and consideration!
I was following this tutorial to show stack traces on ErrorRecords. Is it not possible anymore to easily customize printing of built-in objects? If yes that would be sad
Felix Becker (@felixfbecker) you can still do what that tutorial describes. The base format files are in c# now, though, so you'll have to borrow the example file given in the article.
Activity
[-]FileSystem.Format.ps1xml[/-][+]*.Format.ps1xml files are missing (example: FileSystem.Format.ps1xml)[/+]SteveL-MSFT commentedon Oct 9, 2018
Do you have a need for the ps1xml files? In PowerShell Core 6, the built in formatting are in c# and not in actual ps1xml files. If the concern is the docs are incorrect, we can fix that.
JoeSalmeri commentedon Oct 9, 2018
Hi Steve,
Since the ps1xml files were first released I have modified them to make a some changes.
With each new PS version I have incorporated my changes into the new files in case anything else
changed.
My concern is that the built-in formatting would either add additional changes or possible include
some of my changes. That's why I merge them into the files each time.
Here is a summary of the changes I make:
TableControl
Reduced LastWriteTime from 25 to 20 to allow some extra space for the next change
ListControl
Modify Length formatting to {0:n0} so that it includes commas
Then I use the following in my profile to incorporate my changes into the PS session
I am happy to send you my files if you are interested in including those changes.
Thanks!
vexx32 commentedon Oct 9, 2018
Steve Lee (@SteveL-MSFT) I would think that at the very least there should be one example / template file, both as a .ps1xml and a .cs file; a good example often speaks much more clearly than several pages of detailed specification. 😕
SteveL-MSFT commentedon Oct 9, 2018
Joe S (@JoeSalmeri) perhaps you can open a new issue with your specific changes you think should be applied and we can see about making those changes in the product
Rain Sallow (/u/ta11ow) (@vexx32) long term, I'd like to get away from xml for types and formatting, but that feels a long ways away given everything else we want/need to do. We still have some example ps1xml files in this repo and you can always grab the ones from Windows PowerShell. The default formatters are here
vexx32 commentedon Oct 9, 2018
Steve Lee (@SteveL-MSFT) I really can't agree more. I'd love to see
Update-FormatDataaccept direct object input and for the relevant necessary type configuration objects be able to be created in PowerShell directly or created with some kind of hashtable syntax.JoeSalmeri commentedon Oct 17, 2018
Steve Lee (@SteveL-MSFT)
Sorry for the delay on my part, I was away do to personal issues.
I have opened Issue #8060 where I submitted the changes we have been discussing.
The file included is a copy of the latest FileSystem.Format.ps1xml file with my changes made and includes documentation at the top of what the changes are as well as documentation where each change is made.
Please let me know if you have any questions and thanks very much for your help and consideration!
felixfbecker commentedon Feb 23, 2019
I was following this tutorial to show stack traces on ErrorRecords. Is it not possible anymore to easily customize printing of built-in objects? If yes that would be sad
vexx32 commentedon Feb 23, 2019
Felix Becker (@felixfbecker) you can still do what that tutorial describes. The base format files are in c# now, though, so you'll have to borrow the example file given in the article.
felixfbecker commentedon Feb 23, 2019
Which is based on the format file from 3 years ago.