In the IT world, Administrators love to debate which technology is better. Mac vs. PC, Android vs iOS, you name it we’ve argued over it. One that I’ve been seeing a lot of over the last few years is vbScript vs Powershell. As you probably know, I stayed in the vbScript world for quite a while because it was a safe, known haven that suited me. But then I came to Powershell, and learned how you can discover what’s going on in Powershell so easily. This started with using a great Integrated Scripting Environment (ISE) like PowerGUI or PowerShellPlus, but then I discovered a few other commands that helped me discover information about the objects I was working with. Specifically Get-Member. Read on to see how I recently used Get-Member to solve a problem.
This is true of any programming/scripting language. Variables are the life blood of what you do. Without them there is really nothing you can do in a scripting language. I’m going to assume you know all about variables so I won’t get down to what they are. But one of the fun things about variables is all the different things you can store in them. Objects, datetimes, integers pretty much anything can be stored in them these days. And Powershell has a truly dizzying array of variable types to work with. Figuring out what you’re dealing with is key to a successful script. There are a lot of things you can do to an object, but not all objects are created equal! So some objects will allow you to Convert them to datetime, and others won’t. How do you find out?