Git Product home page Git Product logo

technet-gallery's People

Contributors

mscholtes 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

technet-gallery's Issues

PS2EXE-GUI (Write-Progress)

the GUI does not seem to display child objects related to the parent object.
consider the following code which works in PS ISE/Console:

($i1 = Get-Random (0..24));($i2 = Get-Random (25..49));($i3 = Get-Random (50..74))
do {
$TotalPc = [math]::Round(((@($i1;$i2;$i3)) | Measure-Object -Average).Average,0)
Write-Progress -Id 999 -Activity "Parent" -Percentcomplete $TotalPc -Status "$($totalPc)%"
Write-Progress -ParentId 999 -Id 0 -Activity "Child1" -Percentcomplete "$(if($i1 -lt 100){$i1++})$i1" -Status "$($i1)%"
Write-Progress -ParentId 999 -Id 1 -Activity "Child2" -Percentcomplete "$(if($i2 -lt 100){$i2++})$i2" -Status "$($i2)%"
Write-Progress -ParentId 999 -Id 2 -Activity "Child3" -Percentcomplete "$(if($i3 -lt 100){$i3++})$i3" -Status "$($i3)%"
Start-Sleep -Milliseconds 500
}
until ($TotalPc -eq 100)

it will show you the parent progress bar and below it, it's child progress bars.

can the tool be updated to include child progress bars similar to PS/ISE?

Thanks,

New Window When Powershell Job Started

Hello,
Despite which combination of flags I use when compiling my ps1 file (that uses WPF for a GUI), whenever I create a PowerShell job (Start-Job), a new window pops up. The window remains blank, however, and does not disappear right away. Not using -noConsole prevents any new unwanted windows from popping up but then I am stuck with a PowerShell window running while my application runs. Is there a way to stop these windows from showing up?

Is it possible to use "Transpose-Object.ps1" as a module?

I'd like to use this script as a module so I added this module into "WindowsPowerShell" directory but this script is not recognized in the PowerShell. Also, I'm not a programmer and I don't know why this happens. I'd like to know if you know the solution to use this script as a module. Thank you in advance.

$error variable behaves differently in generated executable

Trying to adapt an existing large PowerShell script application to work with PS2EXE, I've run into a number of problems, mainly due to the application not accepting normal (for PowerShell) parameters which become mangled when using PS2EXE. I've overcome all the problems except one.

This application extensively uses a local $error variable. While this works normally, once the .ps1 file is turned into a .exe using PS2EXE, the $error variable becomes unchangable (ERROR: Cannot overwrite variable Error because it is read-only or constant or A variable with name 'Error' already exists.) I can't find anything which would change the behaviour of $error when using PS2EXE.

"FALSE" value being removed

Properties with the value of FALSE are having the value stripped.
Have multiple columns where the value is false, after transposing the value is now null.

Errors with example file

I get a bunch of errors with the stock example file. Any idea?

Exception calling "PinWindow" with "1" argument(s): "Value cannot be null."
At C:\Users\swa\Documents\filestarter\VirtualDesktop.ps1:1993 char:3
+         [VirtualDesktop.Desktop]::PinWindow($Hwnd)
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentNullException

File read: C:\Users\swa\Documents\filestarter\files.json
1: notepad Started
<< 4460160 Showing >>
1: notepad Moving window (4460160)
<< 8064464 2296796 >>
2: explorer Waiting for new window class window
<< 8195068 8064464 2296796 >>
<< Found window 8195068 >>
<< 8195068 Showing >>
2: explorer Moving window (8195068)
<< Moving 8195068 to desktop 2 - Games >>
3: outlook Failed to start process outlook! [This command cannot be run due to the error: The system cannot find the file specified.]
<< 396030 395900 69800 135002 10551866 1576320 >>
4: chrome Waiting for new window class window
<< 396030 5639428 395900 69800 135002 10551866 1576320 >>
<< Found window 5639428 >>
<< 5639428 Showing >>
4: chrome Moving window (5639428)
<< Moving 5639428 to desktop 3 - Desktop 3 >>
Exception calling "UnpinWindow" with "1" argument(s): "Value cannot be null."
At C:\Users\swa\Documents\filestarter\VirtualDesktop.ps1:2044 char:3
+         [VirtualDesktop.Desktop]::UnpinWindow($Hwnd)
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentNullException

Exception calling "MoveWindow" with "1" argument(s): "Value cannot be null."
At C:\Users\swa\Documents\filestarter\VirtualDesktop.ps1:1735 char:3
+         $Desktop.MoveWindow($Hwnd)
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentNullException

fin
PS C:\Users\swa\Documents\filestarter>

Issue setting service startup type

Trying to ensure that SQL Express service is started and set as Automatic. This commands works fine when in a PS1 file:

Get-Service mssql | Set-Service –StartupType Automatic

When I convert the PS1 file to an EXE using PS2EXE, then run it I get the following error:
ERROR: A positional parameter cannot be found that accepts argument 'Automatic'.

I double-checked that was I was running as Administrator, so there shouldn't be permissions issues. I also added "#Requires -RunAsAdministrator" to the top of the script.

Not sure if this is a bug or if there is a workaround for this.

Thanks.

Generated executable -debug option conflict

The generated executable is given a -debug option. This conflicts with the -debug common parameter. A different name should be used for this option in the generated executable: I suggest -callbreak, which is also more descriptive.

PS2EXE-GUI: Make the example for determining the executable's own full path / directory path more robust

First things first: thank you and Ingo for a great tool.

When you call an executable from cmd.exe, [Environment]::GetCommandLineArgs()[0]) reports the executable as specified, not necessarily by its full path (the latter only happens when calling from PowerShell).

Therefore, a Convert-Path call is needed for robustness:

$ScriptPath = Split-Path -Parent (Convert-Path -LiteralPath ([Environment]::GetCommandLineArgs()[0]))

Software issue

Hi Sir,
Thanks for your great tool that I can convert the script to exe application. I found two errors and need your assistance to find the root of the issue;
1、Write-host, -ForegroundColor will not work after convert to exe file. for example, after I convert it to exe, the font text is white other that the font color I set.

Write-Host "Hello World" -ForegroundColor Yellow
2、Write-progress, Write-progress will not closed until the application execute all the code.
Write-Progress Download Percentage: $($data[0])" -Activity "File Downloading" -ErrorAction SilentlyContinue
111
333

I am not sure if we can set the font, background color with your tools. It would be a great if this feature is integrated in this tool.

ps2exe creating file with GetStream from TcpClient fails

Creating an exe from a ps1 file that calls GetStream from TcpClient throws the following error:

>powershell.exe -command "&'.\ps2exe.ps1' ./getstreamerror.ps1"
PS2EXE-GUI v0.5.0.24 by Ingo Karstein, reworked and GUI support by Markus Scholtes

You are using PowerShell 4.0 or above.

Reading input file C:\Users\Ajoro\Ps2exe\PS2EXE-GUI\getstreamerror.ps1
C:\Users\Ajoro\Ps2exe\PS2EXE-GUI\ps2exe.ps1 : Missing closing '}' in statement block or type definition.
At line:1 char:1
+ &'.\ps2exe.ps1' ./getstreamerror.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ParserError: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString,ps2exe.ps1

Steps to reproduce:

Try to convert the following to a exe
(New-Object System.Net.Sockets.TcpClient).GetStream()

Or:

$tcpclient = New-Object System.Net.Sockets.TcpClient
$tcpclient.Connect("localhost", 9000)
$stream = $tcpclient.GetStream()

Pressing cancel in the GUI while waiting for input continues script

I wrote a small script that asks user for input through read-host, if the user enters nothing and leave the input box blank, a default entry is made when OK is clicked, this works great, However when in the GUI cancel is selected the script still proceeds and continues as if the user selected enter. Hitting cancel is not killing the script?

Please do not suggest that folks poison AV wells

Any tool which packages function into executables or provides a mechanism by which to run code is considered an execution harness in the security world (or just a compiler toolchain). Your psh2exe is not much different from my rex-powershell work (part of metasploit for a decade), and while neither piece of code is in itself malware, both can be used maliciously and are therefore signed-for in defensive tooling.
If the proposed effort to reduce the risk factor of PEs created this way as seen by the AV DBs is successful, it will make the harness that much more appealing to malicious actors. This is a real-life logic bug you just can't beat: technology is a two-edged sword and the "bad guys" are much more willing and able to use their edge than the average lazy non-security oriented "coder."
Please do not try to poison the wells of defensive tooling by crowd-sourcing benign sample submissions - you are not at fault for how your code is used in the wild, but you would be at fault for diminishing the defensive posture of organizations and people relying on those databases (potentially with actual liability attached, might want to check the ToS for those services).
Sometimes cool academic things such as this are just not practical in the real war-zone world because they are immediately weaponized and misused (relative to the author's intent). Maybe when people get civil, we can have nice things again.

Transpose-Object bug

This does not work

[pscustomobject]@{a=0; b=1; c=2},
[pscustomobject]@{a=3; b=4; c=5},
[pscustomobject]@{a=6; b=7; c=8},
[pscustomobject]@{a=9; b=10; c=11} | Transpose-Object

but if you add $col=1 to begin block and replace $InputObject | Out-String (line 50) with "column$($col)"; $col++ it will

[PS2EXE] Add -noExtract parameter

Hello Markus,

i have a feature for ps2exe that is very nice to have.

I've contacted Ingo Karstein, the original author of ps2exe and asked him, how i could remove the -extract feature from the ps2exe-script. He told me it's as simple as removing this else-if from the script:

							else if (s.StartsWith("-extract", StringComparison.InvariantCultureIgnoreCase))
							{
								string[] s1 = s.Split(new string[] { ":" }, 2, StringSplitOptions.RemoveEmptyEntries);
								if (s1.Length != 2)
								{
$(if (!$noConsole) {@"
									Console.WriteLine("If you specify the -extract option you need to add a file for extraction in this way\r\n   -extract:\"<filename>\"");
"@ } else {@"
									MessageBox.Show("If you specify the -extract option you need to add a file for extraction in this way\r\n   -extract:\"<filename>\"", System.AppDomain.CurrentDomain.FriendlyName, MessageBoxButtons.OK, MessageBoxIcon.Error);
"@ })
									return 1;
								}
								extractFN = s1[1].Trim(new char[] { '\"' });
							}

It would be great if you would add a -noExtract feature for the ps2exe-script.

Thanks in advance and have a nice day,
@Hope-IT-Works

Window flash

This script is awesome, you are very generous for sharing it.

I have a powershell script that is supposed to do a few things in the background and then exit. I have "compiled" the a script using the following flags:

-inputFile my.ps1
-outputFile my.exe
-noConsole
-iconFile my.ico
-title 'Fancy Title'
-company 'Your name here'
-copyright '2020'
-version '1.0'
-noOutput
-noError
-noVisualStyles

When the exe file is lauched, for a brief moment a console window appears and disappears. I thought that the -noConsole flag meant it would not open up a console window, but it seems like that's what it's doing. Something also briefly flashes in taskbar.

The first line of my script has the following:

$Global:progresspreference='SilentlyContinue'

So presumably it's not the script trying to open anything.

I'd appreciate any suggestions on how to make the exe truly run in the background at launch.

Accented characters PS2EXE

Hello,

I have a small problem with PS2Exe
When I compile some scripts which contain some accented characters, they will appears as ?
image

I think it something related to encoding settings inside the PS2EXE scripts but I do not found what to change.

For information in my script such text were inside some texblock (WPF).

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.