Tag: How to

Parse log files with PowerShell

Parse log files with PowerShell

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

How to convert MAML to Text

How to convert MAML to Text

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

How to validate credential argument for your function

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

Search the event log with the Get-WinEvent PowerShell cmdlet

Search the event log with the Get-WinEvent PowerShell cmdlet

Searching in the event log is one of the most common tasks of a system administrator. With the help of the Get-WinEvent PowerShell cmdlet, you can easily display the Windows events that interest you. Content of this article: All available logs Events of a specific event log All events one page at a time A … Continue reading Search the event log with the Get-WinEvent PowerShell cmdlet