How to setup Dell Quest PowerGUI to edit PowerShell PS1 scripts to Bitbucket with the correct UTF-8 Text encoding to overcome the erroneous Binary Encoding
We use the following workflow to update Microsoft PowerShell (VMware PowerCLI actually) scripts in the Atlassian Bitbucket GIT repository and had this same issue when getting started out of the box with defaults.
- Dell Quest free PowerGui tool (version 3.8) – http://en.community.dell.com/techcenter/powergui/m/
- Atlassian SourceTree – http://www.sourcetreeapp.com/
- Bitbucket – https://bitbucket.org/
The default files created with PowerGui are having the 3 letter file name extension ps1 but when uploaded with Sourcetree they show up in Bitbucket as Binary so text features like edit or diff don’t work. Based on the feedback here and with other google searches the fix for this was to indeed change the encoding to UTF-8, make a simple change to the file, and upload it again. After a few tries this works perfectly and is repeatable. There is a trick though as PowerGUI doesn’t make it obvious how to change the encoding. Here are the steps.
- Start powergui as you normally would. BTW – this is a windows program and I’ve tested this on Windows 8
- Choose “PowerShell Libraries” from the File menu
- Check the box to enable “Add-on.ScriptEditorEssentials” from the Snapins/Modules dialog box. Click OK.
- Now Enable UTF-8 Encoding from the File menu.
- That’s it. Any file you save now will be UTF-8 encoded and show up properly in Bitbucket once uploaded.
powershell, powergui, powercli, text, binary, sourcetree, bitbucket