Packing a powershell script with an icon

Apologies if this is covered somewhere and I have been unable to find it but I have a powershell script packaged as an exe (great) but now I’d like to assign an icon to the exe when packaging as opposed to the generic one it gets.

Okay… found it. Needed to create a package.psd1 and add the icon path there.

How exactly did you do this?

If you’re using VS Code, it will create a package.psd1 file when you run the packaging the first time. Then you can add an ApplicationIconPath value to the hashtable to point to an icon.

Thanks, Ill take a look. Using Visual Studio, and although I can set in icon on the project properties, it doesn’t seem to work :confused: If I “Build” the project, I get an icon but an exe missing the actual script, and if I use “Package as executable”, the exe works but no icon…

That should work too. Let me try.

Are you bundling PS7 or PS5?

OK, so I just changed something in the project properties, and now it builds as expected. I made the rookie mistake of changing two things, turning off Obfuscate and setting the Architecture to 64bit in module manifest - Requirements (It was blank)

1 Like