Powershell, Excel and Internationalisation

By YellowOnline on Friday 30 September 2011 10:05 - Comments (2)
Category: Powershell, Views: 5.701

Whenever I need to create a report on something, I obviously do it through Powershell. But how do you return the data to someone else?

One way would be to give the script to that person and write the values to the shell. Of course, this means that the script needs to run every time someone wants to see the data - although your data will always be up to date, this is not a great way of reporting.
Another way would be to write the output to a text file or, neater, a comma separated values (CSV) file. The data can now be transferred easily, and in the case of a CSV it can even be opened in a spreadsheet so columns keep being columns!

CSV files don't satisfy me though, if only because a CSV is not per se comma separated: when creating a CSV, the separator is defined by the system locale delimiter. In Belgium, for example, a CSV would be semi-colon separated.
This wouldn't be a problem for CSVs created and read on the same machine, but in real life you usually pass the information to someone else on a different machine with perhaps different regional settings. The result will be that the CSV file will not be read properly by whatever program is configured to be the default CSV reader and data transformations - too difficult for the average end-user and surely for managers - are necessary.

I just write all of my output to Excel sheets and make them look fancy, with colours, lines, frozen panes and all the other bling-bling that makes managers go wild. This blogpost explains the how.


Read more »

Enumerating NTFS and share permissions

By YellowOnline on Tuesday 27 September 2011 14:38 - Comments (3)
Category: Powershell, Views: 6.751

I needed to enumerate NTFS and Share permissions from different sources. The following code might be helpful for other Admins. Use it as a function or as a cmdlet; works with shares, admin shares and local paths.


Read more »