An easy way to check if a variable or property has data in PowerShell

Today I found a little something in PowerShell. I needed a way to check if a variable/property was empty or not…
Now, who has written a small function to check this? 😉
I myself has written a function that provides a true/false output named ‘Validate-HasData’.

Did you know that you can do this with only 6 extra characters instead of writing a whole function and calling that over and over again?

Let’s get a process:

Now, how to check if the property ” has a value?

This will give you a simple true/false output 🙂
Easy, short… I love it!

Leave a Reply

Your email address will not be published. Required fields are marked *