6 responses to “Is PowerShell $ShellId too big a burden?”

  1. Jason Archer

    I want!

    Perhaps a global variable signifying that your shell is capable of graphics in the shell output is a reasonable workaround? It would mean that each Cmdlet would need to check for it.

  2. Lunatic Experimentalist

    if ($host -is $yourhosttype) {#run code for your host }
    else {#run generic code}

  3. Chad Miller

    Microsoft’s SQL Server PowerShell (sqlps.exe) implements the ShellId. I’m using “if ($Shellid -ne ‘Microsoft.SqlServer.Management.PowerShell.sqlps’)” in my profile to avoid running add-snapin commands when launching sqlps.exe (sqlps.exe does not support add-snapin). I posted a comment about sqlps.exe in the PSCX issue tracker:

    http://www.codeplex.com/PowerShellCX/WorkItem/View.aspx?WorkItemId=18417

  4. Chad Miller

    It does seem a little pointless, but if you want to launch PowerShell from within SQL Server its your only option. I prefer to use SQL Server PowerShell Extensions (http://www.codeplex.com/sqlpsx) in regular PowerShell when possible, but as a project developer I’m a little bias :)

    Thanks for the insight into shellid and the advice to use Microsoft.PowerShell_profile.ps1 which seems cleaner than the “if ($Shellid -ne ‘Microsoft.SqlServer.Management.PowerShell.sqlps’)” approach I had taken especially since Microsoft is releasing mini-shells like sqlps.exe.