Support Forums

Calling a script with parameters

Support for all customers who have purchased a SAPIEN PowerShell Studio product license. This forum does not offer a response time guarantee.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
User avatar
OldLost
Posts: 40
Joined: Mon Jul 22, 2013 7:32 am

Calling a script with parameters

Postby OldLost » Fri Jan 29, 2016 3:29 pm

PowerShell Studio 2015 v4.2.99 x64
Windows Server 2012 R2 64bit

In my script I'm calling another PS1 file in the pipeline that takes named parameters. Here is the line in question:

$Data = @(Get-ChildItem -Path ($WorkfileTemplate -f '*', 'csv') | & (Join-Path (Split-Path $PSCommandPath) 'Invoke-This.ps1') -ScriptBlock { Import-Csv -LiteralPath $_.FullName | Select-Object -Property @{ Name = 'Date'; Exp = { ([datetime]($_.Date)).ToString('yyyy-MM-dd') } }, Name, IPAddress, Domain, Error | Sort-Object IPAddress -Unique } | Sort-Object Domain, Name)


My problem is that PowerShell Studio's Format Script command wants to put a space between the minus sign and "ScriptBlock" which, of course, Powershell doesn't like. I know the way I'm doing it Powershell itself doesn't have a problem with it and it works fine, but I have to go back and take out that space before it'll work.

Any way around this?
User avatar
davidc
Posts: 4459
Joined: Thu Aug 18, 2011 4:56 am

Re: Calling a script with parameters

Postby davidc » Wed Mar 02, 2016 12:24 pm

This issue should be resolved in the next service release. Unfortunately there is no way around it until the service build is released.

David
David
SAPIEN Technologies, Inc.

Return to “PowerShell Studio”

Who is online

Users browsing this forum: No registered users and 10 guests