-
-
Notifications
You must be signed in to change notification settings - Fork 803
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
Importing dbatools ends Transcript #2722
Comments
This is an issue with use of run spaces and @FriedrichWeinmann can answer more but I don't believe this will be something we can fix without removing the run space code utilized to load the module. This is fixed in PowerShell Core 6.0.0.0, reference issue |
So I asked on Twitter and got his response to get the active transcripts which works in this shop https://twitter.com/SeeminglyScienc/status/933461048329371648 of course restarting it creates a new file so maybe it would be possible to grab the name and append post_dbatools_install(get-Random) to the name ? `function Get-ActiveTranscriptPath {
}` just in case gist goes away |
There is also the possibility of restarting the transcript with That way there should be no need to start a new one since they can continue the old one. |
Very nice @shaneis , I missed the append :-) Not enough coffee |
This issue has been automatically marked as stale because it has not had recent activity. If you would like this issue to remain open:
|
This item is still reproducible on 0.9.422. Workaround is to just import the module first |
I remember talking to @SQLDBAWithABeard about this when it was first reported. There is a way to find out if a transcript has been started so we can restart it after the import, that we got shown from Twitter.. |
I've had that experience with runspaces as well. @JustinGrote made a good suggestion to import the module first. Not sure restarting transcripts is within scope. Will close as won't fix for now. If someone wants to fix and discuss in #dbatools-dev, they are welcomed if it's considered in-scope by a few dbatools devs. Otherwise, please do import then start transcript. |
mmm, actually, i'm making headway with other commands. just not sure i can fix the psm1 import. but i found http://stevegilham.blogspot.com/2017/02/powershell-transcript-cmdlets-and.html and from that find the following to be effective
|
okay so check this out No problem:
No problem:
Problem:
not sure whats up, gonna keep digging but it's not looking super promising |
I tried a few things but this is out of my league. especially since it appears to occur when a command is run (cuz maybe that initializes a runspace after i set it back in the psm1?) @FriedrichWeinmann may have some insight since runspaces are his jam, but he's low on time and I won't be able to provide anything further. If anyone else would like to take a look, that'd be fab. |
Please let me know if anyone will be taking this on. If not, I'm going to close it with the recommended workaround. One good thing that came out of this, though, is that a couple of the other commands were fixed. The only thing I can't fix is command running post import. |
I'll aim to take this on but not sure how far I can take it without seriously "upping" my PoSh skills... |
Just wanted to add another comment to this. I was receiving the transcript error on a restore script (using Restore-DbaDatabase) and could not for the life of me figure out why.
So I started googling the error which landed me here. I am trying the workaround by moving the Import-Module dbatools to before the Start-Transcript and will check back in the AM to see if that resolved my issue. edit Moving the Start-Transcript to after the Import-Module dbatools fixed my issue. |
Gonna agree with @wsmelton's position over a year ago. This is a problem in PS 5.1 that was fixed in PS6. I asked in the referenced issue if it'll be fixed in 5.1 but don't have much hope. |
Bug Report
General Troubleshooting steps
Version Information
Steps to Reproduce
Start-Transcript
Import-Module dbatools
) or implicilty (Get-Command -Module dbatools
)Stop-Transcript
, or open the file) will be stopped silentlyGet-DbatoolsLog
)Feature Request
Problem to solve
Preferably not stop the transcripts.
Or warned that any started transcripts will be ended
Additional information
The text was updated successfully, but these errors were encountered: