Missing a couple of basic features?

Use this forum to ask questions before you buy. Need information on licensing or pricing? Questions about a trial version? This is the right place for you. No scripting questions, please.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
User avatar
jenne.tondeleir
Posts: 4
Joined: Wed Nov 16, 2016 12:57 am

Missing a couple of basic features?

Post by jenne.tondeleir » Wed Nov 30, 2016 3:49 am

I started a trial for SAPIEN Powershell Studio to which I was drawn by the seemingly great GUI tools. Upon trying the software I can't seem to find a couple of things specifically in the debugging:

- Console: There's a little console in the bottom of the window. This console doesn't seem to be connected to anything within the debugging sessions. In ISE, you can use the console to reach the debugging environment, but I'm not able to replicate this behaviour in Studio?
- When debugging, I can't see the contents of any collections. In PowerGUI I simple open the Syncroot property, in Ise I get the first few items (array[0],array[1]). In PS Studio, I have no idea what's in there. Coupled with the previous issue, I simple have no idea of what's in a collection when I'm debugging. I'm driving blind here, guys. :)
- Studio doesn't load my profile: I have a library of functions written before that I load when I start a script. For some reason Powershell Studio skips what's my profile, and my functions are not loaded in when I debug. Am I overlooking something here? I find it hard to believe that basic things that a free program like PowerGUI offers aren't in Studio?

Am I missing something here? I can't seem to find these functions in the software, or am I really just overlooking something?

User avatar
Alexander Riedel
Posts: 7021
Joined: Tue May 29, 2007 4:43 pm

Re: Missing a couple of basic features?

Post by Alexander Riedel » Wed Nov 30, 2016 4:02 am

Well, yes, this is different. PowerShell Studio is a development tool for PowerShell applications, whereas the ISE is more or less a graphical console with an editor attached.
Developing applications is all about reproducing results and avoiding dependencies. So, YOUR profile will not exist anywhere else other than on your machine. If you want shared functions, dot source a file or add the functions to your script. That way you are sure they exit when you need them. Or create a module, which is the best way if you have many apps use shared functions.

As for the debugger, there is a debug console (not the regular console) where you can query anything you like while stopped at a breakpoint.
There is also a Variables window and a watch window you should check out.

Note that every time you launch a script or application it uses a new runspace. That way your results are not contaminated by previous iterations.
You get a post-mortem variable list in the debug window once a script finishes too.

If you need to examine variables AFTER the execution finishes, execute your script in the embedded console. Then you can look around afterwards as much as you like.

So you see, it is a little different for good reason, but you can still do anything you want.

I hope this helps.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
jenne.tondeleir
Posts: 4
Joined: Wed Nov 16, 2016 12:57 am

Re: Missing a couple of basic features?

Post by jenne.tondeleir » Wed Nov 30, 2016 8:37 am

Hi Alexander,

Thank you for your response. It seems that Powershell Studio is probably not the tool I'm looking for then, since I'm more interested in scripting, and much less in building stand alone applications for users.
Am I just looking at the wrong program, then? Would Primalscript have the functionality that I seek?

Kind regards.

User avatar
Alexander Riedel
Posts: 7021
Joined: Tue May 29, 2007 4:43 pm

Re: Missing a couple of basic features?

Post by Alexander Riedel » Wed Nov 30, 2016 10:47 am

I don't know what "scripting" means in your context, that is for you to decide. All the things I mentioned, using a new runspace when executing or avoiding dependencies on profiles, are just as valuable and a best practice whether you write an application or whether you just write a script for your own internal use.

The ISE is a great learning tool for what it does, so if "scripting" means learning PowerShell and figuring out what does what, use it for that. To develop scripts that don't stop to function when you change a profile or to test a script in various conditions, don't use the ISE. PowerShell Studio or PrimalScript will work much better for that.

If you want to develop any type of script, with UI or not, PowerShell Studio is a great tool. I am biased of course, but give it a try. First explore how it works, learn it.
Last but not least, if you look through the forum here, PowerShell Studio is alive and under active development. So if you need something new or support for a new PowerShell version, you are much more likely to get it here ;-)

Use the 45 day trial. If you have questions, we are here.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
juneblender
Posts: 93
Joined: Thu Jul 24, 2014 3:26 pm

Re: Missing a couple of basic features?

Post by juneblender » Wed Nov 30, 2016 3:53 pm

Hi, Jenne. I came from ISE immersion, too, and I'm a scripter, not a tool developer, so I understand your perspective. Let me share mine:

One of my favorite features of PowerShell Studio is the difference between Run and Run in Console. When you click Run, PowerShell Studio runs your script in a brand new, clean session that is unaffected by your profile or the remnants of any other run, like variables or functions. You get a clean session every time. This is a best-practice test environment.

But, when you want a persistent session that includes your profile and resources from a previous command, click Run in console, and your script is dot-sourced into the session and all variables, functions, and classes, are loaded into the console.

The cool part is that you can have both a clean session (Output window) and a persistent session (Console) running side-by-side. You can test in both environments and, best ever, you can restart the console (right-click, Restart Shell) without disturbing the editor or the results in the Output window.

If you want to test with your profile, use Run in console. But, more than once, I've been bitten by testing with my profile. I've shared a script with a friend or put it on GitHub, and it doesn't work for anyone else, because it calls functions that exist only in my profile. Now, I remember to test in both modes.

In the debugger, take a peek at the Watch window and try conditional breakpoints (break only when the value of a variable is x).

As Alex said, PowerShell Studio and ISE are different by design. Switching editors isn't easy. There's always a learning curve. But, once you learn PowerShell Studio, I think you'll really like it.

Here are my "favorite feature" lists:
https://www.sapien.com/blog/2015/09/28/ ... ll-studio/
http://info.sapien.com/how-to/powershel ... l-studio-2

Hope this helps!

User avatar
jenne.tondeleir
Posts: 4
Joined: Wed Nov 16, 2016 12:57 am

Re: Missing a couple of basic features?

Post by jenne.tondeleir » Fri Dec 02, 2016 5:30 am

Alexander and Juneblender, thank you both for your replies. I'll try to explain why I'm asking these questions, so you understand where I'm coming from, and I'll try to better explain what exactly I feel that I'm missing.

I'm a system engineer, working for an IT team for a company of about 6500 employees. We are a team of about 25 people, with 9 of us spending most of our time in Powershell.
We use powershell for a lot of projects, Active Directory, Exchange, SQL, Sharepoint etc... The most of our common tasks have been implemented (creating users + mailboxes, creating new databases, migrating users to new departments, assigning permissions etc.). In total we've got about 500 powershell scripts, about 100 of those used multple times a day. These scripts depend on a number of common functions that we load via the profile.

To this day, most of our scripts we're written in PowerGUI, but the lack of development since Quest basically abandoned the software back in 2012 when they were bought out by Dell, is starting to become very noticeable. We're on the lookout for something new, and I'm writing a memo to try and point us into the right direction. For this memo, I'm evaluating ISE-Steroids, Powershell Studio and the POSHTools for Visual Studio. The outcome of this memo will be the product we will purchase.

I get the reason for your suggestion for dot sourcing common functions in our scripts, our powershell console "takes a while" to start up in with the current state of the profile. Switching over, however, won't be something we can just to in a pinch, with the library we've built up through the years. But it can be done, certainly, so I can get over that.

The main issue , however, is the problems I'm facing with the debugger. I'll try to make this as clear as possible this time, so bear with me.

Say I'm doing the following:
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $myexchangeserverURI -Authentication Kerberos -Credential $UserCredential
Import-PSSession $Session
$mbxs = get-mailbox "*velde*"
So, I'm getting al the mailboxes for people with 'Velde' in their names. So I break the line after the last line here, and I want to investigate these mailboxes because I want to take a look at the properties I'll be needing in the next steps of my script, ie. Distinguishedname, some customattributes, etc.

So I click [...Click to see array values...]. I see a couple of names. I know there are more properties to a mailbox, so I open the Syncroot property, I can see a couple of properties for the array, but nothing for the members except the names.
My next try was using the console, but since it isn't connected to the debugging session, I can't use it check the $mbxs collection.
If I add the $mbxs to the watched variables, I get the same info I get as when I use the variables window.
Lastly, when i use the Run in Console function, the breakpoints I've set are ignored, so I can't use it to check the collection.

So basically, when I try to examine an object in a collection, I can't see what the properties for that object are. Hence my "I'm driving blind here" remark in the original post.

We work with a lot of custom objects, often written by colleagues. Reviewing the source code everytime you require using one is not really feasible, so having a way to check what you get back from commandlets is somewhat mandatory for us. The debugger doesn't allow me to do that, as explained.

I'm still thinking I'm missing something. Can you show me how I would be able to bypass the issues I'm having with the debugger? Am I missing something in the settings? At the moment I simply can't recommend the otherwise promising looking program based on the above issue.

User avatar
juneblender
Posts: 93
Joined: Thu Jul 24, 2014 3:26 pm

Re: Missing a couple of basic features?

Post by juneblender » Fri Dec 02, 2016 8:56 am

Thanks for explaining. While debugging, you use the Debug Console, which is in scope for the debugger, not the standard Console pane, which is independent, although you can use the standard Console Pane for other purposes (I often look up syntax or test a coding strategy in that pane).

By default , the Debug Console appears in the bottom left panel group.
DebugConsole-Default.png
DebugConsole-Default.png (56.42 KiB) Viewed 7645 times
But, if you use it a lot while debugging (I do), you can move it anywhere in your screen, and save the layout so you can share and reuse it. The following image shows my debug layout with the Debug Console side-by-side with the editor.
DebugConsole-Custom.png
DebugConsole-Custom.png (122.25 KiB) Viewed 7645 times

User avatar
jenne.tondeleir
Posts: 4
Joined: Wed Nov 16, 2016 12:57 am

Re: Missing a couple of basic features?

Post by jenne.tondeleir » Mon Dec 05, 2016 1:33 am

Okay, I found it. Apparently there's both a debug pane and a debug window pane. :oops:

User avatar
juneblender
Posts: 93
Joined: Thu Jul 24, 2014 3:26 pm

Re: Missing a couple of basic features?

Post by juneblender » Mon Dec 05, 2016 12:26 pm

No problem! There's so much in PowerShell Studio that I'm still discovering new things. I blog them when I find them, so take a peek at our index library of posts at http://info.sapien.com, especially the PowerShell Studio How-To section, http://info.sapien.com/index.php/how-to ... udio-howto. I also post videos on our YouTube channel: http://sapien.com/videos.

And, if you're ever stuck, come right back here to the forum. Thanks!