If you have to find information in unstructured log files, PowerShell offers a variety of cmdlets that can help you parse text files to extract the information you need. In my last article, I showed you how to search the Windows Event Log with Get-Event. That's where you usually spot most of the pertinent messages. … Continue reading Parse log files with PowerShell
MAML is an XML-based markup language developed by the Microsoft User Assistance Platform team to provide user assistance. Among others, it is used in SCOM to format Knowledge articles. Here is how to convert a MAML string to standard readable text. Note: When you copy/paste code from a web site, quotes and backticks are often … Continue reading How to convert MAML to Text
Powershell has an easy to use and built-in cmdlet named Write-Progres. However, displaying the PercentComplete parameter seems sometimes cumbersome. Fortunately, most of the time, you need a progress bar when you are inside a foreach loop. This makes it easy to handle because the object you enumerate has a Count and an IndexOf properties. Basic … Continue reading How to write a one-liner progress bar
This one is not really complicated. You must just open your eyes because this parameter is working differently. Usually, you pass parameters with the variable name preceded by a $ dollar sign. But for the Tee-Object cmdlet, you must omit the $ dollar sign for the Variable parameter, and it works like a charm!
You may know that it's a best practice to validate arguments you pass to your function. For example, if you want to validate that your parameter named MyString is not null nor empty you can use the ValidateNotNullOrEmpty attribute. But there are other validations which must be done through casting1 or type accelerators. And fortunately, … Continue reading How to validate credential argument for your function