Closed ruudvandebeeten closed 6 years ago
Afraid I can't replicate that:
Could you rerun this with $instance.GetType() after each statement so we can see if the type changes
Neither command modifies the $InstanceName in my example, and I neither command does that anyway as far as I know.
Thanks so much for looking into this, Stuart!
Afraid I can't replicate that:
Could you rerun this with $instance.GetType() after each statement so we can see if the type changes
Neither command modifies the $InstanceName in my example, and I neither command does that anyway as far as I know.
Thank you for your reply.
$instance.GetType() does not return anything.
Do you mean $InstanceName.GetType()? That is returning System.String
Sorry, was doing 3 things at once, it should have been $instancename.GetType()
On Mon, 15 Oct 2018 at 07:44 ruudvandebeeten notifications@github.com wrote:
Afraid I can't replicate that: [image: image] https://user-images.githubusercontent.com/5613670/46906705-9f561000-ceff-11e8-8f43-64efc05cc86e.png
Could you rerun this with $instance.GetType() after each statement so we can see if the type changes
Neither command modifies the $InstanceName in my example, and I neither command does that anyway as far as I know.
Thank you for your reply.
$instance.GetType() does not return anything.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/sqlcollaborative/dbatools/issues/4194#issuecomment-429726736, or mute the thread https://github.com/notifications/unsubscribe-auth/AFWoZj7aX_iluwKr438Va7HD5blwVzAxks5ulC7jgaJpZM4XZbLG .
I believe this is likely an issue with ISE and not dbatools. Can you try your command outside of ISE @ruudvandebeeten ?
Actually, I just reread and Invoke-Sqlcmd is being run which means SqlServer
or SQLPS
is being loaded. Unfortunately, we do not support this configuration due to issues like this, our apologies, it's not possible to fix.
@potatoqualitee thank you for looking into the problem I'm faceing. When running the script outside of ISE the error is not occuring.
Happy to! I do try to avoid the ISE myself except when I have to (presentations). VS Code's host causes some issues as well. I generally try to do straight console because it's reliable.
You may run into unexpected issues in the future with the console+SqlServer too, however, I've found mixing them to be inconsistent.
Before submitting a bug report:
powershell -NoProfile
)Steps to Reproduce
Running script below in Powershell ISE.
Expected Behavior
All the statements are ran without error.
Actual Behavior
After running the Invoke-Sqlcmd the second Get-DbaBackupInformation returns a error, see script output below.
It seems that Invoke-Sqlcmd or Get-DbaBackupInformation skrews with shared variables or objects.
When using Invoke-Sqlcmd2 the problem does not arise. But I'm not able to change all the existing Powershell code atm. Running the script the second time, even the first statement containing Get-DbaBackupInformation fails.
Environmental data
PSVersion 4.0
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.42000
BuildVersion 6.3.9600.18728
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion 2.2