Git Product home page Git Product logo

ps2exe's People

Contributors

mscholtes avatar thepwrtank18 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ps2exe's Issues

Execution in WinPE

What are the prerequisites for being able to run a PowerShell script compiled with PS2EXE in a WinPE environment?

TcpClient and GetStream Error

The script refuses to produce EXE output if the input script contains TcpClient and GetStream commands at the same time. It gives "Missing closing '}' in statement block or type definition." error message. I can't understand why it finds problematic if a script has both of these commands but on the top of it all, the error message doesn't help to identify the source of the problem.

ICON option?

Hi,

Much respect to this clean compiler tool

Is there away to add software metadata and ICON?

Thanks

Get-Credential issue

When using the get-credential command, instead of seeing the usual security box prompt to type in your credentials, another prompt appears prior and requests:

cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters

Once you click on OK, everything is okay.

Is there anything that can be done to prevent the pop up box?

Many thanks!

Question - Package config.txt file within the EXE?

Greetings,

Thanks for taking the time on making this great tool!

Question: I have a script that it depends on a txt file on the same directory to read variables.

Is it possible to package that config file somehow within the EXE, so the moment we run the exe, it extracts the file and then it reads it?

Screenshot:
image

Message Popups/ and GUI window do not wrap text or resize accordingly

See attached - more of an inconveniece than anything:

(1) If you get a message on a compiled executable with a lot of text, the popup box doesn't wrap or resize, meaning that in some cases the "OK" box is off screen and cannot be clicked
exemessagebox

(2) The GUI does not resize when a long path is selected

GUILongPath

$host.enternestedprompt()

Hi

I'm trying to convert some of my Powershell scripts. They initially remote connect to different servers and load functions to simplify administration tasks for helpdesk. In order to not close the Powershell session and and keep the shell open, while all preloaded functions remain available for administration, I use the method $host.enternestedprompt().

Script conversion seems fine, but the executable Powershell script ignores the enternestedprompt method and closes the shell right away. So far I didn't figure out an alternative for keeping that shell going until its closed manually. Replacing $host.enternestedprompt() e.g. by an Readhost loop will suppress tab completion.

Is there anything that can be done to keep that executable script shell open and interactive?

Thanks
/pascal

Another Exe into the exe

Hello,

Is it possible to integrate another exe into the exe?

Example: to the exe I want to attach the 7zr.exe.

Is it possible ?

Thanks You !

Script with Ukrainian text in code

Good day. My scripts contain Ukrainian language. In the usual version (.ps1) the text in the console is displayed correctly, but in the version (.exe) some Ukrainian letters (і, ї, є) are lost. It displayed as question marks.
If I run my .exe with .cmd using instruction "chcp 1251", the script displays correctly in the console. If I run my .exe directly using the shortcut, the instruction "chcp 1251" can no longer be used, the script text is displayed incorrectly in the console.
My Windows: Windows 10 Enterprise (20H2) x64 Ukrainian.
My Powershell version: 7.1
Please, check how your .exe compiled from .ps1 works with Ukrainian. Thanks.

Task Manager - Background process

Is it possible to compile the script so that it would appear in the Background processes section of task manager? I can do this with Sapien power studio

EXE files only run on single machine

The exe file generated from my script has to be re-made for each new computer I want to run it on, is this expected behavior or is there a setting I'm missing that I need to change?

Compiling any script is detected as virus

Hello there!
I've been using the old software, as well this new repo on github.
The older version, (the TechNet version) after converting a script to an exe a lot of antivirus softares detected them with malware.
On this new repo, after converting a ps1 to exe it's detected once again but with another vulneravility.
This link is a report from a sample ps1 converted and then scanned on virustotal

Anyway, PS2EXE it's an amazing software and thanks a lot for maintaining it!

'x' close dialog option on progress bars

Is there a way to add a close dialog/window button on progressbars?

I have a progress bar that downloads a huge file and takes 5-20 mins. I use the Start-BitsTransfer/Expand-Archive methods that has a built in progressbar on the console. When the progressbar is running and takes longer than I'd like, i can simply close the console window. With PS2E2E, I cannot close the progressbar (even with task manager sometimes).

No logical space left to create more user strings.

Hi,

i have a script which has an embedded binary file as a base64 string,

it runs fine using .\test.ps1 or 'Run with PowerShell' without any issues

but when i try to compile it, i keep getting 'No logical space left to create more user strings'

the embedded file is a 5MB file if that helps

Regards

Simon

Installation Error on Module

I'm having an issue installing the module. I tried a simple Install-Module ps2exe but looks like a link is broken?

PS D:\sample> Install-Module ps2exe

NuGet provider is required to continue
PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet
 provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or
'D:\Users\Hacker1\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by
running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install
and import the NuGet provider now?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): y
WARNING: Unable to download from URI 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409' to ''.
WARNING: Unable to download the list of available providers. Check your internet connection.
PackageManagement\Install-PackageProvider : No match was found for the specified search criteria for the provider
'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package
has the tags.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7405 char:21
+ ...     $null = PackageManagement\Install-PackageProvider -Name $script:N ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (Microsoft.Power...PackageProvider:InstallPackageProvider) [Install-Pac
   kageProvider], Exception
    + FullyQualifiedErrorId : NoMatchFoundForProvider,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackagePro
   vider

PackageManagement\Import-PackageProvider : No match was found for the specified search criteria and provider name
'NuGet'. Try 'Get-PackageProvider -ListAvailable' to see if the provider exists on the system.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7411 char:21
+ ...     $null = PackageManagement\Import-PackageProvider -Name $script:Nu ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (NuGet:String) [Import-PackageProvider], Exception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.ImportPackageProv
   ider

WARNING: Unable to download from URI 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409' to ''.
WARNING: Unable to download the list of available providers. Check your internet connection.
PackageManagement\Get-PackageProvider : Unable to find package provider 'NuGet'. It may not be imported yet. Try
'Get-PackageProvider -ListAvailable'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7415 char:30
+ ... tProvider = PackageManagement\Get-PackageProvider -Name $script:NuGet ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...PackageProvider:GetPackageProvider) [Get-PackageProvi
   der], Exception
    + FullyQualifiedErrorId : UnknownProviderFromActivatedList,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPacka
   geProvider

Install-Module : NuGet provider is required to interact with NuGet-based repositories. Please ensure that '2.8.5.201'
or newer version of NuGet provider is installed.
At line:1 char:1
+ Install-Module ps2exe
+ ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Install-Module], InvalidOperationException
    + FullyQualifiedErrorId : CouldNotInstallNuGetProvider,Install-Module

Thanks!

Wrong kernel version reported

I don't know how, but PS2EXE is reporting the wrong kernel version for Windows 10.

Steps to reproduce:

  1. Put the text "$([System.Environment]::OSVersion.Version)" in a file called test.ps1 and run it in PowerShell.
    The output (on my machine) is 10.0.19042.0
  2. Now run the command ps2exe test.ps1. The executable test.exe will be created. Run the executable.
    The output (on my machine) is 6.2.9200.0

Issue with parameters containing commas?

Hello there, my first GIT post :)

So I have a PS script which takes a comma separated parameter which is then split into an array. This works fine from the command prompt but seems to fail once converted into a .exe with your handy tool? I've tried surrounding in quotes, 'quoted' the comma as per this link but no luck:
https://stackoverflow.com/questions/11990688/powershell-is-removing-comma-from-program-argument

code excerpt:
param(
[array] $supportedbrowser,
[Parameter(Mandatory = $true)]
[string] $url
)

example:
webloader.ps1 -supportedbrowser chrome,edge

Get-ADUser fails after compilation

I am working on converting a script that makes use of Get-ADUser.

When I run the script from source, everything works and the user info is output to the PowerShell window, however, when I try to run the compiled version, it fails with "Unable to contact the server. This may be because this server does not exist, it is currently down, or it does not have the Active Directory Web Services running."

The form looks like (I know most of the form should be outside the do while loop):

do {
    ##
    # WindowsForms Build
    ##

    Add-Type -AssemblyName System.Windows.Forms
    Add-Type -AssemblyName System.Drawing

    $form = New-Object System.Windows.Forms.Form
    $form.Text = 'User_Info'
    $form.Size = New-Object System.Drawing.Size(800,850)
    $form.StartPosition = 'CenterScreen'

    $CancelButton = New-Object System.Windows.Forms.Button
    $CancelButton.Location = New-Object System.Drawing.Point(390,740)
    $CancelButton.Size = New-Object System.Drawing.Size(150,46)
    $CancelButton.Text = 'Cancel'
    $CancelButton.DialogResult = [System.Windows.Forms.DialogResult]::Cancel
    $form.CancelButton = $CancelButton
    $form.Controls.Add($CancelButton)

    $label = New-Object System.Windows.Forms.Label
    $label.Location = New-Object System.Drawing.Point(10,20)
    $label.Size = New-Object System.Drawing.Size(600,20)
    $label.Font = New-Object System.Drawing.Font("Arial",10,[System.Drawing.FontStyle]::Regular)
    $label.Text = 'Enter the username:'
    $form.Controls.Add($label)

    $inputbox = New-Object System.Windows.Forms.TextBox
    $inputbox.Location = New-Object System.Drawing.Point(10,50)
    $inputbox.MinimumSize = New-Object System.Drawing.Size(700,40)
    $inputbox.Font = New-Object System.Drawing.Font("Arial",20,[System.Drawing.FontStyle]::Regular)
    $form.Controls.Add($inputbox)

    $label2 = New-Object System.Windows.Forms.Label
    $label2.Location = New-Object System.Drawing.Point(10,100)
    $label2.Size = New-Object System.Drawing.Size(600,20)
    $label2.Font = New-Object System.Drawing.Font("Arial",10,[System.Drawing.FontStyle]::Regular)
    $label2.Text = 'Output:'
    $form.Controls.Add($label2)

    $outputbox = New-Object System.Windows.Forms.TextBox
    $outputbox.Location = New-Object System.Drawing.Point(10,120)
    $outputbox.MinimumSize = New-Object System.Drawing.Size(700,600)
    $outputbox.Font = New-Object System.Drawing.Font("Arial",20,[System.Drawing.FontStyle]::Regular)
    $outputbox.ReadOnly = $True
    $outputbox.Multiline = $True
    $outputbox.ScrollBars = "Vertical"
    $form.Controls.Add($outputbox)

    $OKButton = New-Object System.Windows.Forms.Button
    $OKButton.Location = New-Object System.Drawing.Point(230,740)
    $OKButton.Size = New-Object System.Drawing.Size(150,46)
    $OKButton.Text = 'OK'
    $OKButton.DialogResult = [System.Windows.Forms.DialogResult]::OK
    $OKButton.add_Click({
        try {
            ##
            # Variables that should be updated on each loop
            ##

            #Today's Date
            $Date = (Get-Date).ToString()

            $Username = $inputbox.Text

            if ($Username -match '.+') {
                UserAccountInfo -Username = $Username -Date = $Date
            }

        }
        catch{
            Add-OutputBoxLine -Message $_.Exception.Message
        }
    })
    $form.AcceptButton = $OKButton
    $form.Controls.Add($OKButton)

    $form.Topmost = $true

    $form.Add_Shown({$inputbox.Select()})
    $result = $form.ShowDialog()

    if ($result -eq [System.Windows.Forms.DialogResult]::Cancel){
        exit
    }
}
while($Username -match '.*')

UserAccountInfo function looks like:

function UserAccountInfo {
    try {
        Add-OutputBoxLine -Message "User Info: $Username"

        $info = (Get-ADUser -Identity $Username -Properties *, "msDS-UserPasswordExpiryTimeComputed", "accountExpires" |

        Select-Object   @{Label = "First Name";Expression = {$_.GivenName}},
                        @{Label = "Last Name";Expression = {$_.Surname}},
                        @{Label = "Display Name";Expression = {$_.DisplayName}},
                        [...]
                        }} | Format-List | Format-Color @{"Locked:"="Red"})

                        Add-OutputBoxLine -Message "$info"
    }
    catch {
        $ErrorMessage = $_.Exception.Message
        Add-OutputBoxLine -Message "Failed to find user. The error message was `"$ErrorMessage`""
        continue
    }
}

These have both been shorted for brevity.

The error message looks like this in the form:
image

I suspect it's related to how PS2EXE compiles the script to an EXE that results in a Kerberos double-hop situation, but I wasn't able to find any documentation on it here.

merge scripts

Is it possible to merge 20+ scripts into one file to be compiled, so there are no .ps1 dependencies

Block/remove Extract capability and pass through parameters to script.

Greetings.

These aren't issues but rather questions, but I read the Issues are how you ask questions on GitHub.

I just found your script on TechNet Gallery last week and have to say I'm quite impressed. I'm using it to compile a single PS1 script to an EXE, but I would like to find out if there is a way to deactivate/block/remove the -Extract capability. Normally I think this capability is a good thing, but I have one scenario where the people I'm handing the EXE to I don't want to be able to pull out the script to dissect it.

Also is there a way to pass through command line parameters from the EXE into the script? Things like "-Verbose" or "-ConfigFile C:\Temp\Config.XML" would be very helpful.

Blank popup opens on Get-ADComputer export via ImportExcel module

Hello Markus,

I am having a small issue where when executing the following function a blank window will pop up with nothing but the executable name in it.

Function GetOfficeOU {
    $DaysInactive = [Microsoft.VisualBasic.Interaction]::InputBox('Input time in days', 'Get Office OU', '300')
    $time = (Get-Date).Adddays(-($DaysInactive))
    Get-ADComputer -SearchBase $Settings.OfficeOU -Filter {LastLogonTimeStamp -lt $time} -Properties LastLogonTimeStamp, Enabled |
    select-object Enabled, Name,@{Name="Last Logon Date"; Expression={[DateTime]::FromFileTime($_.lastLogonTimestamp)}} | Export-Excel $FilenameOffice -AutoSize -StartRow 2 -Title "All Office computers inactive since $DaysInactive days" -TableName Results -Show
    $OutputLabel.Text = "File exported to:`r`n$PSScriptRoot\$FilenameOffice"
}

popup

If I comment out the pipe to Export-Excel it doesn't show the pop up.
For the life of me I can't figure out why it would be doing that. Any ideas?

Edit: It does successfully get the information from AD and pipes it to the Export-Excel which creates the excel file without issues.

Compiling Fails w/o Compatibility mode in v7

v7

PS C:\test> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.0.2
PSEdition                      Core
GitCommitId                    7.0.2
OS                             Microsoft Windows 10.0.19042
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

PS C:\test> Import-Module ps2exe
PS C:\test> Invoke-ps2exe -inputfile "EXE Test 01.ps1" -iconfile "EXE Test 01.ico"
PS2EXE-GUI v0.5.0.21 by Ingo Karstein, reworked and GUI support by Markus Scholtes


Reading input file C:\test\EXE Test 01.ps1
Compiling file...

MethodInvocationException: C:\Users\user\Documents\PowerShell\Modules\ps2exe\1.0.5\ps2exe.ps1:2575
Line |
2575 |      $cr = $cop.CompileAssemblyFromSource($cp, $programFrame)
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Exception calling "CompileAssemblyFromSource" with "2" argument(s): "Operation is not supported on this platform."

v5

PS C:\test> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.19041.1
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1


PS C:\test> Import-Module ps2exe
PS C:\test> Invoke-ps2exe -inputfile "EXE Test 01.ps1" -iconfile "EXE Test 01.ico"
PS2EXE-GUI v0.5.0.21 by Ingo Karstein, reworked and GUI support by Markus Scholtes


Reading input file C:\test\EXE Test 01.ps1
Compiling file...

Output file C:\test\EXE Test 01.exe written

v7 w/ Compatibility

PS C:\test> $PSVersionTable                                                                                             
Name                           Value
----                           -----
PSVersion                      7.0.2
PSEdition                      Core
GitCommitId                    7.0.2
OS                             Microsoft Windows 10.0.19042
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

PS C:\test> Import-Module ps2exe -UseWindowsPowerShell
WARNING: The names of some imported commands from the module 'ps2exe' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
WARNING: Module ps2exe is loaded in Windows PowerShell using WinPSCompatSession remoting session; please note that all input and output of commands from this module will be deserialized objects. If you want to load this module into PowerShell Core please use 'Import-Module -SkipEditionCheck' syntax.
PS C:\test> Invoke-ps2exe -inputfile "EXE Test 01.ps1" -iconfile "EXE Test 01.ico"
PS2EXE-GUI v0.5.0.21 by Ingo Karstein, reworked and GUI support by Markus Scholtes


Reading input file C:\test\EXE Test 01.ps1
Compiling file...

Output file C:\test\EXE Test 01.exe written

Compiled files being quarantined

I have used your PS2EXE in the past and never had an issue. Over the weekend I imported your PowerShell module version of PS2EXE. Every time I attempt to compile a .ps1 file now, my Bitdefender antivirus software is quarantining the compiled file and indicates it is infected with Gen:Variant.Razy.741658. I have tried multiple .ps1 files, I have tried using Windows PowerShell 5.1 and PowerShell 7, and they all yield the same result. I also restored one of the quarantined files and upload it to https://www.virustotal.com/gui/ and 15/67 engines flagged the .exe as being a threat. Not sure if anyone else is seeing this behavior, but wanted to inform you of it.

windows 7 launch issue

Hi, it happens when launch in windows 7, before it requires installed framework 4. After install it i get this when launch any compiled ps1 to exe:

   Problem Event Name: APPCRASH
   Application name: test.exe
   App version: 0.0.0.0
   Application time stamp: 6062e820
   Fault Module Name: KERNELBASE.dll
   Fault module version: 6.1.7601.17514
   Error module timestamp: 4ce7c78c
   Exception code: e0434352
   Exception offset: 000000000000a49d
   OS Version: 6.1.7601.2.1.0.256.1
   Language code: 1049
   Additional information 1: 152d
   Additional Information 2: 152d49a18dcb45231bb1c1efff527c4d
   Additional Information 3: 1939
   Additional Information 4: 1939f0e2c35703370b41f4b9742b71a2

Start-Transcript problem

Hi!

I've already read your comments here

The problem is that i am using a script with about 4 thousand lines of code and a GUI behind. I am using Start-Transcript to log any unexpected output or errors. Is there a way to capture those outputs with the parameters -noOutput and -noErrors set?

Regards
Richard

[enhancement] PowerShell host

Is it possible that the compiler would create powershell 7 host to run script? Or better introduce -version 5|7|auto parameter or something like that. Auto argument would select the latest PS version.

ps2exe for linux

Hey there! ps2exe has really been a pleasure to use 💯. However, the current ps2exe module does not work with Linux as it invokes "powershell" when running the cmdlets and Linux OSes use powershell core (pwsh). Are there any plans to have a version that works with Linux? :)

[Enhancement] Cleanup/compact powershell code

This is a suggestion for future. Consider to add -cleanup or -compact switch parameter to remove comments (except #Requires), empty lines, leading/trailing whitespace, and any other non-code staff. It can save hundreds kilobytes.

Need window maximise option

Need an option to add the WindowStyle command, ie

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -WindowStyle Maximized

create directory

Dear Markus, nice work.
But I have one problem.
When I try to create directory ...

[System.IO.Directory]::CreateDirectory($PathMyFolder) ...

I got error... Exception calling "CreateDirectory" with "1" argument(s): "Path cannot be the empty string or all whitespace."

Is it possible to make that work to create new folder in folder where is *.exe.
From ps1 script work without problem.

Solve AV

Hello,
in our company we use a so called next gen AV solution. It detects suspcious behaivour. And all this great tool does is suspect to it.
One way to solve the AV problem on our side would be to allow users to sign their executables by your software. Any chance to get a parameter like signig to add a certificate?
Because we have a code signing certificate for our developers and of course this is white listed in the AV
Best wishes
Thorsten

Window Flashes

Once you've converted a script file to a .exe, upon double clicking the exe there are a lot of Progress windows that flash before the output comes up (a form in this instance). Any way to have a flag to hide these Progress windows?

Write-Progress Not working in console apps

The Write-Progress does not work in console apps once converted. When using the

-noconsole

argument it shows a windows forms progress bar, but it should also be working in console apps.

Wrong accuse to be malware

The current version does not 'compile my script because it uses a TCPClient. But the client is needed to check the computer's external IP. So this is not malware prevention; it is only annoying for normal users. Those lines will not help to make the world a safer place

	if ($content -match ("TCsX32ent" -replace "sX32", "pCli") -and $content -match ("Ge1Xam" -replace "1X", "tStre"))
	{
		Write-Error "Compile denied as PS2EXE was not created to generate malware." -Category ParserError -ErrorId TerminatorExpectedAtEndOfString
		return
	}

they only make lives for normal users harder.
Could you, therefore, please remove those lines?

Testing web connectivity behaves differently through the EXE than the raw PS1.

Greetings,

I'm using the following logic in a script to try and test URL connectivity:
$WebRequest = [System.Net.WebRequest]::Create($URL)
$WebRequest.Timeout = 8000
$Response = $WebRequest.GetResponse()

When that code is run through the normal .PS1 file, everything works as expected. When it is run through the PS1 embedded in the EXE, it fails. There is a PAC file in on the clients running both the PS1 and EXE use to force things through a proxy, so I suspect this might be an impersonation/credential issue where when run the EXE some things are not passed through correctly.

Have you experienced anything like this before?

Folder Path parameter keeps getting rejected with "Wrong format" message

Hi. Great job on this utility, it's really neat!

I have a mandatory parameter to my script which is a folder path, however I am entering it (quotes, no quotes, backslash escaped or not, ...), it keeps getting rejected.
Below is how the script parameters are set (it works as intended in PowerShell ISE)

Param(
    [Parameter(Mandatory=$True, HelpMessage="Folder")] [System.IO.DirectoryInfo] $path,
    [Parameter(Mandatory=$True, HelpMessage="Log file")] [System.IO.FileInfo] $logFile
)

Encoding

Any chance for a feature request, a dash encoding or something, where you can force an encoding to UTF8, default, Unicode or Ascii.

I work on quite a few different computers, with different setups and most of the time i know i want it to have UTF-8 encoding, so it will show non-english characters correct.
i know, "get-content | Set-content -Encoding UTF8 ", but i have forgotten enough times to think that others might have same issue.

Enhancement request

This script is bloody awesome - thank you for taking the time out to write and publish.

A suggestion - it would be great to be able to specify a minimum version of Powershell required to run the script.

IE. Min v5.1 - if doesn't meet requirements tell user they must upgrade to version XXX to run.

Localized language characters receiving errors

I have not tested with other languages, but I suspect the same will happen unless Norwegian is the exception. Seemingly after last release, all Norwegian letters/special characters (ÆØÅ) no functions after being compiled to EXE. I did not experience this issue mid/late march.

I.e. running the script with powershell will output "ÆØÅ", but after compiling to exe it will output "???"

See attached images.
RunwithPS
RunExe

Non-Standard Display for ShouldContinue and ShouldProcess

I have a script that leverages $PSCmdlet.ShouldContinue() as part of a user prompt. However, the produced EXE doesn't display the prompt in a standard way. Instead, it shows the help information inline with the options. Is this intentional or is this a bug? Is there a way to modify the behavior?

Expected Behavior:
Capture

Actual Behavior:
Capture1

Fails with: The term 'Invoke-ps2exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Full output

PS C:\Users\xxx\choco> invoke-ps2exe C:\Users\xxx\choco\ChocolateyInstallNonAdmin.ps1 C:\Users\xxx\choco\ChocolateyInstallNonAdmin.exe
PS2EXE-GUI v0.5.0.23 by Ingo Karstein, reworked and GUI support by Markus Scholtes

& : The term 'Invoke-ps2exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, 
or if a path was included, verify that the path is correct and try again.
At line:1 char:2
+ &'Invoke-ps2exe'  -inputFile C:\Users\xxx\choco\ChocolateyIns ...
+  ~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Invoke-ps2exe:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Don't display messagebox

Hi,

I wrote a PS1 file as below.
[System.Windows.MessageBox]::Show('Error')

but, this code does not display any messages when EXE is executed after the convert to PS2EXE.
Is the script I wrote a problem?

Regard.

Breaks on 90% of the scripts

The tools breaks almost all the time, showing the error:

Invoke-PS2EXE : Missing closing '}' in statement block or type definition.
At line:1 char:1
+ Invoke-PS2EXE  .\revshell.ps1 .\revshell.exe
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ParserError: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString,Invoke-ps2exe

The tools was installed online using Install-Module

Alternative to `Register-EngineEvent PowerShell.Exiting`

Sorry for posting an issue here, I can't seem to be able to ask a question on TechNet Gallery.

I have a script that works as a background task (without the need for a GUI) and is meant to be fired up and left running until terminated. When I close the console window it does terminate but not in a clean way as I am basically killing the process but I'm not closing properly some objects (that need to be left open as long as the script is running). I'd like to use an alternative of Register-EngineEvent PowerShell.Exiting to execute some cleaning actions when the process gets interrupted. Is there a way to do this ?

[Question-enhancement] Splash screen

Hello,

Is it technically possible to implement a splash screen for GUI apps which is working before PS host initialized and PS script loaded?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.