Calling a script with parameters
Posted: Fri Jan 29, 2016 2: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:
Any way around this?
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:
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.$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)
Any way around this?