PS1 To Exe Generator - New version

In this post, I will show you the new version of my tool PS1 To EXE generator that allows you to generate an EXE file from a PowerShell project, choose the main ps1 and inlude other files and folders.
Link to the first version: Here

In this new versions, there is some new features:
- New design
- Possibility to require or not admin rights for your EXE
- Possibility to set a password 
- Possibility to add paramaters to your PS1 script
- Check WinRAR informations


How to get the tool?



What's new ?

New design
New design
The tool is now composed of two parts.
The first one, is the same than in the first version.
The second part is new. This part called WinRAR infos allows you to check if WinRAR is installed and which version is used (x86 or x64).

WinRAR test

If WinRAR is installed, you will get the below WinRAR infos:
WinRAR is installed
If WinRAR isn't installed, you will get the below WinRAR infos and this part will be first opened.
WinRAR isn't installed
Admin rights

In the EXE configuration part, the Requires admin rights CheckBox allows you to ask or not admin rights after running the EXE. 
Admin rights CheckBox
If the Requires admin rights has been checked the EXE file will be as below:
Requires admin rights 
If not, it will be as below
Not requires admin rights 


Set a Password 

This function allows you to ask for a password after running the EXE.
Click on the button below
This will open the Flyout below
More options Flyout
Check the Set a password CheckBox to enable the password part as below
Password field
Type your password and close the Flyout.

Now when you run your EXE, you will have to type your password as below
Ask for password
If a bad password is typed, you will get the below message
Bad password

Add parameters

Click on the More options button
In the Add parameters to your PS1 TextBox, type the parameters to add. Don't forget to type with "-"
Add parameters option


How to use it ?

The first step is to selected your PowerShell project. This project should be a folder that contain your PS1 file and all associated files and folder.
For instance, in the following example, my project is the folder below, that contains all these items.
My Project folder
Click on the Browse button from the Content sources part, and select the folder containing your project, in my case it's the folder MyApplication.
Content sources part
Browse project
In the EXE name part, type the name of the EXE you will create.
In the PS1 name, choose the main PS file that will be run after running the EXE file. 
In my case it will be the PS1 MyAppli.ps1
EXE infos part
As mentioned above, check the Requires admin rights CheckBox, to ask for admin rights after running the EXE file.

The icon part allows you to add an icon to your EXE file. Click on the Browse button and select you .ico file.
Choose an icon
To finish, click on the Build the EXE button to create your EXE.
Once it's done the below message appears and your EXE file will be created in your Desktop.
Success message




How to use the Customsettings.ini file like an installation profile ?


In this I will show you, how to use the Customsettings.ini like a profile for your master installation. 

Why a profile ?

This way you can create multiple INI file with different names, for insta,nce one with domain integration, one with workgroup integration, one with DHCP, one for a specific branch of your company...
Once, before starting the deployment, you just have to select the profile you want and all parameters will be set automatically.

How it works ?

Create your profiles

The first step is to create INI file. You can find a tool I created, MDT Profile Generator, that allows you to generate INI profile.

In my following example, I will create one INI profile with below configuration:
- Name: French and Domain
- Domain integration
- DHCP mode
- Language: French
- Computer name: TEST1

My second INI profile will have the configuration below:
- Name: French-StaticIP-Workgroup
- Workgroup integration
- Static IP configuration
- Language: French
- Computer name: TEST2

The third will have the configuration below:
- Name: German and Domain
- Domain integration
- DHCP mode
- Language: Spanish
- Computer name: TEST3

The latest one:
- Name: German and Workgroup
- Workgroup integration
- DHCP mode
- Language: Spanish
- Computer name: TEST4

So, now I have four Customsettings.ini with different names.
The next step is to allow MDT to let your choose which Customsettings.ini to apply.
Indeed, by default MDT will use only INI file with name Customsettings.ini, and you can't use multiple.



Create your wizard

To do that I have created a really simple MDT wizard that allows you to choose an external INI profile, see here my post about it.
The first step is to copy all your INI files in a folder INI_Profiles that should be located in the Deploy folder.
Then integrate the new wizard in your MDT deployment.
Selection profile wizard


Select your profile

The last step, is to run a deployment and select your profile :-).
The below example shows you my selection wizard that displays all my INI profile files mentioned previously.
Selection profile Wizard
Once you choose one of them, all configuration is automatically setted.




PowerShell Tool: MDT profile Generator New version 1.2


In this post, I will show you a tool I created, for MDT, that allows you to generate a Customsettings.ini file easily and quickly.
One year ago, I shared a tool MDT Profile generator. It allows you, as mentioned above, to generate a Customsettings.ini file. This way, this way can be using like a "profile". I will describe you the next step to choose this one during your deployment.

In this new version, you can find some new parameters and options:
- Possibility to load an existing profile
- Apply a product key


How to get the wizard ?




Why a profile ?

Customsettings.ini file can be used to configurate your deployment parameters and configurations easily. You can set almost whatever you want, as language pack to install, applications ...
Once this "profile" is generated, the next step is to select the appropriate profile for your deployment.
For this need I created a wizard that allows you to choose an external customsettings.ini file, see here
Profile selection Wizard


What's new ?

First as you may noticed, the main change is the design. I choosed to integrate the awesome HamburgerMenu control from Mahapps. 
See in the post from my mate, Kevin (aka Dev4sys) how to use it.


Load a profile

Then, the second main new, is the possibility to upload an existing INI file previously created with the tool. 
To upload an INI file, just click on the Load button and choose your profile. Once it's done, the profile parameters will be loaded in the tool.
Load existing profile button
The below example show you the tool behavior after loading a profile with Domain and the  Workgroup integration.
Load domain profile
The below example show you the tool behavior after loading a profile with DHCP or static IP selection.
Load Static IP or DHCP profile
There are also some new changes, about control. 
To generate you profile just click on the Generate profile button.
Generate profile button


How to use it ?

This is a reminder to know how to use the tool.
The tool is composed of 7 part.
- Details
- Domain
- Network
- Backup/Capture/Restore
- Wizards to skip
- Applications
- Other

See below controls available for each part and their action in the Customsettings.ini file.

Details
Details Tab variables

Domain

This part allows you to set domain or workgroup parameters.
Once you choose domain, it will automatically display some new fields.


WorkGroup variables
Domain variables

Network

This part allows you to set a static IP with Gateway, Mask ... or choose a DHCP configuration.
Once you choose Static, some new fields will appear.


Network Static IP variables
Network DHCP variables

Wizards

This part allows you to choose which wizard you want to hide. Choosing Skip all wizard will automatically check all the others.

Applications

This part allows you to choose which applications will be configured as Mandatory applications with value MandatoryApplicationsx
Applications wizard


Others
Others variables





Don't hesitate to contact me by mail, damien.vanrobaeys@gmail.com or directly from the blog.

PowerShell GUI: Use the Mahapps Badged control


In this post, I will show you a nice control to use using PowerShell and Mahapps. We'll see how to manage and use it.
If you often read my posts, you may know that I'm a big fan of Mahapps. It's just, for me an awesome way to give some pretty cool design to GUI. 
Some weeks ago a colleague, Kevin Rahetilahy (aka Dev4sys), has shown me a new Mahapps control that I missed. 
I was what ? I like it, I have to test it and share how to use it.

What is this ?

This control can be compared to the Windows 10 notifications below:
See below what you do with this control.


Badge color

You can first apply the badge to a simple button.
You can apply the color you want to the badge control. In the below example I show some colors that can be pretty to use.
You can also apply a fix number to the badge or use it to display a warning.
In the below example, I created two buttons
System error: it shows the number of system error in the event log during the last day
Application error: it shows the number of application error in the event log during the last day
This control can be very useful to use to highlight some options, or missed parameters. 


Badge with icon

You can also apply, the badge control to a button displayed by an icon.
See below how it can looks like.

Badge location

The third tabitem in my example shows the different available locations on your button.


How to use it ?

Badge in XAML 

How to add a badge to a simple button ?

See below, the code used to display a badge on a simple button.

How to add a badge on a icon button ? 

See below, the code used to display a badge on an icon button

How to add a badge to a tabcontrol ?

See below, the code used to display a badge on a TabControl

How to modify the location of a badge ?

See below the attribute used to modify to the badge location.

How to modify the color of a badge ?

See below the attribute used to modify the badge color


Badge in PS1

See below the code used to modify the value of the badge.

See below the code used to modify the color of the badge



When to use it ?

This control can be very useful. My colleague Kevin used it, in his great tool driver manager,link here.
This tool allows you to see if there are some missing drivers on your computer, of there is an issue with some of them.
It's composed of 3 Tabs, and a badge indicates you directly the number of missing drivers, see below.


You can also imagine a button that will show you the number of event log error during a specific period. You can find an example in my post.

Previously, I shared a tool that allows you to monitor your MDT Deployment. This way you can see if there are deployments running on computers, completed deployment or also deployment failure. 
So, why not using this control to resume quickly number of each part ?

There are many possibilities to use with this control, just use your imagination.



How to get my sample ?


PowerShell module: PSTalk - Speak with PowerShell


In this post, I will share with you a PowerShell module I created that allows you to tell a text using the System voice.

How to get the module

The module PSTalk is available on the PowerShell Gallery and on GitHub.
Click on the links below to get the module.
Module on GitHub
Module on PowerShell Gallery


How to install it ?


From the PowerShell Gallery

Open the PowerShell prompt
Type the below commandline
The module PSTalk will be installed


From GitHub

Click on the download button
Extract content of the zip folder
Open the PowerShell prompt
Type the below commandline

How to use it ?

Type the below commandline to see the available cmdlets
Get-command -module PSTalk
See below, the available alias for the cmdlet
Available alias in the PSTalk module


Speak cmdlet

The Speak cmdlet allows you to tell a text using PowerShell.
See below how to use the cmdlet.
The cmdlet allows you to do the below things
- Choose the voice to speak
- Choose the voice volume
- Choose the voice rate
- Generate a script that will use your selected options

When you add the -voice switch, you will have to choose a voice. Those voices are depending of the installed voices on the computer.
Voices selection
When you add the -resume switch, a short resume will be displayed about your options you have selected 
Voice resume selection
You can also use a pipeline with the speak cmdlet as below

The module in action


The below example shows you how to use basically the speak cmdlet with Text only.

The below example shows you how to use the speak cmdlet with Text only from a pipeline

The below example shows you how to use the speak cmdlet by selecting the voice to speak.