Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with ConvertTo-PowerShell when there is <# and #> #36

Closed
MsSQLGirl opened this issue Oct 13, 2020 · 2 comments
Closed

Issue with ConvertTo-PowerShell when there is <# and #> #36

MsSQLGirl opened this issue Oct 13, 2020 · 2 comments
Assignees
Labels
investigate Review the issue

Comments

@MsSQLGirl
Copy link

Hello,

I tried converting a couple of PowerShell scripts from tigertoolbox this morning and found a few issues. The Notebook that I used to do the conversion is this: https://gist.githubusercontent.com/MsSQLGirl/b972d381fc85181aeafde5daa15ca171/raw/5d3db3ad14ef06304069bd74b53552b6879f15bf/PowerShellNotebook-ConversionIssue

Exception calling "Substring" with "2" argument(s): "Index and length must refer to a location within the string.
Parameter name: length"
At C:\Users\jukoesma\Documents\WindowsPowerShell\Modules\PowerShellNotebook\2.6.3\ConvertToPowerShellNoteBook.ps1:85 
char:28
+ ...  'Comment' {$TextBlock = $s.Substring($Block.Start, $Block.Length) -r ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentOutOfRangeException
 

I'm exhibiting this error whenever the source powershell file uses <# and #>

@dfinke dfinke self-assigned this Oct 13, 2020
@dfinke dfinke added the investigate Review the issue label Oct 13, 2020
@dfinke
Copy link
Owner

dfinke commented Oct 13, 2020

@SQLvariant could you take a look. I don't remember where we left off on block comments for this. Also, I'll look at adding the ability for this to read from a URL so the irm step can be skipped.

@dfinke dfinke closed this as completed in 04da3bc Oct 14, 2020
@dfinke
Copy link
Owner

dfinke commented Oct 17, 2020

  • Added features to ConvertTo-PowerShellNotebook
    • Pipe files to the function
    • Handles URLs with PowerShell files as endpoints
    • Handles any mix of Files and URLs for conversion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigate Review the issue
Projects
None yet
Development

No branches or pull requests

2 participants