Search found 5004 matches

by davidc
Fri Jan 12, 2018 3:22 pm
Forum: PowerShell GUIs
Topic: Calling Code ?
Replies: 2
Views: 102

Re: Calling Code ?

[TOPIC MOVED TO THE POWERSHELL GUIS FORUM BY MODERATOR]

A function is probably the best bet. You can also share the same event over multiple button controls. You can use the $this variable to determine what control triggered the event.
by davidc
Fri Jan 12, 2018 12:40 pm
Forum: PowerShell Studio
Topic: New-TagAssignment works in .ps1, but not in .psf...
Replies: 12
Views: 905

Re: New-TagAssignment works in .ps1, but not in .psf...

I'm glad you were able to resolve the issue. There are some gotchas and limitations when it comes to GUIs in PowerShell, but once you are aware of them, you can usually work around it.
by davidc
Wed Jan 10, 2018 9:11 am
Forum: PowerShell Studio
Topic: Use Powershell Studio as the powershell ISE console
Replies: 1
Views: 170

Re: Use Powershell Studio as the powershell ISE console

If you wish to do this, I recommend using the Run in Console commands. This allows you to keep a persistent runspace within the embedded console.
by davidc
Tue Jan 09, 2018 11:00 am
Forum: PowerShell Studio
Topic: New-TagAssignment works in .ps1, but not in .psf...
Replies: 12
Views: 905

Re: New-TagAssignment works in .ps1, but not in .psf...

As I mentioned previously, some cmdlets depend on eventing or asynchronous calls that will not work when a GUI in displayed in PowerShell. To get around this limitation, tru using the Button - Start Job to replace the current button_Go. Run the whole script portion of the click event using the Job T...
by davidc
Tue Jan 09, 2018 10:13 am
Forum: PowerShell Studio
Topic: Editor keeps crashing (Powershell Studio 5.4.145 (8 jan 2018))
Replies: 5
Views: 233

Re: Editor keeps crashing (Powershell Studio 5.4.145 (8 jan 2018))

You can download previous builds from your Registered Products page: https://www.sapien.com/account/products This issue should be already resolved in the upcoming release, but if you can provide the script and the exact steps to recreate the issue, it will help us test and reproduce the issue on our...
by davidc
Mon Jan 08, 2018 4:57 pm
Forum: PowerShell Studio
Topic: Problem when creating an .exe file for multiple ps1
Replies: 5
Views: 276

Re: Problem when creating an .exe file for multiple ps1

If you have the property set to Include, then just invoke the reference function.

For the executable, you have to make sure the dot sourced script is in the same directory as the executable. Usually when you package a script, it is created in a "Bin" sub-folder and not at the root folder.
by davidc
Mon Jan 08, 2018 12:30 pm
Forum: PowerShell Studio
Topic: Problem when creating an .exe file for multiple ps1
Replies: 5
Views: 276

Re: Problem when creating an .exe file for multiple ps1

The packager will not resolve the & invokes. Instead try using dot sourcing and see if that resolves the issue:

Code: Select all

. .\Subs.ps1
by davidc
Mon Jan 08, 2018 12:27 pm
Forum: PowerShell GUIs
Topic: PowerCLI - New-TAG hangs in a script
Replies: 2
Views: 60

Re: PowerCLI - New-TAG hangs in a script

[TOPIC MOVED TO POWERSHELL GUIS FORUM BY MODERATOR] Some cmdlets that depend on events internally may get hang up on a GUI because the pipeline / messaging held up by the form. You can try creating the tag using a Job instead and see if that works (Look at the Job Tracker control sets, such as Butto...
by davidc
Mon Jan 08, 2018 12:20 pm
Forum: PowerShell Studio
Topic: Problem when creating an .exe file for multiple ps1
Replies: 5
Views: 276

Re: Problem when creating an .exe file for multiple ps1

We will need to investigate this on our end. In the meantime, have you tried merging the files by using the Build setting within PowerShell Studio? If you set the project file's Build property to Include , you can invoke the ps1 contents as a function: Invoke-Sub_ps1 To change the project file's pro...
by davidc
Fri Jan 05, 2018 2:10 pm
Forum: PowerShell Studio
Topic: Windows Service Wrapper
Replies: 8
Views: 494

Re: Windows Service Wrapper

If you are running the script within a package executable you will need to use: $script:MyInvocation.MyCommand.Path Look at the Get-ScriptDirectory function / snippet as an example. Alternatively, you can use the following to get the executable’s path that is running the script: Add-Type -AssemblyNa...