Search found 5011 matches

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: 1293

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: 375

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: 464

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: 464

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: 80

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: 464

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: 653

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...
by davidc
Wed Jan 03, 2018 9:04 am
Forum: PowerShell Studio
Topic: Copy & paste DSC code changes 'Type' to Get-Content'
Replies: 3
Views: 505

Re: Copy & paste DSC code changes 'Type' to Get-Content'

You can create a remote profile of another machine if you need to: https://www.sapien.com/blog/2012/10/15/developing-powershell-scripts-for-other-machines-part-1/ https://www.sapien.com/blog/2012/10/16/developing-powershell-scripts-for-other-machines-part-2/ Or use the Cache Editor to create a new p...
by davidc
Wed Jan 03, 2018 8:57 am
Forum: PowerShell Studio
Topic: Copy & paste DSC code changes 'Type' to Get-Content'
Replies: 3
Views: 505

Re: Copy & paste DSC code changes 'Type' to Get-Content'

DSC / Configurations require PowerShell V4 or greater.
by davidc
Wed Jan 03, 2018 8:38 am
Forum: PowerShell Studio
Topic: Unable to add assemblies with same name but different version
Replies: 5
Views: 495

Re: Unable to add assemblies with same name but different version

For clarification, where are you referring to these assemblies? Have you tried using the Add-Type cmdlet directly in your script?