Showing posts with label Parsing. Show all posts
Showing posts with label Parsing. Show all posts

2014/09/21

PowerShell - NetBackupPS: Module for Symantec NetBackup


In my previous job, we used Symantec NetBackup to handle backups and restores. To handle some of the reporting, the storage admins were using the Symantec CLI tools (bunch of Exe).
Example of usages: Find the scratch tapes in a particular robot... or in a particular site...

I wanted to parse the output and be able to reuse the information for other commands or to report information to the team. I realised that could be a good exercice to improve my parsing skills using PowerShell and decided to work on some more cmdlets and eventually a module.

2014/09/06

PowerShell - ConvertFrom-String and the TemplateFile parameter

I'm continuing to play with the new ConvertFrom-String cmdlet (available in the last WMF 5.0 September preview released yesterday) which make the parsing job really easy for simple or complex output.

This cmdlets supports two types of modes: Basic Delimited Parsing (See yesterday's post) and the Auto-Generated Example-Driven Parsing which I will cover in this post.

This Auto-Generated Example-Driven Parsing mode is based on the FlashExtract research work in Microsoft Research...

Important: This post is based on the September 2014 preview release of WMF 5.0. This is pre-release software, so this information may change.

2014/09/05

PowerShell - Playing with the new ConvertFrom-String cmdlet

In a previous post I talked about parsing NetStat.exe using PowerShell and some regex, It is a fun exercice but require some knowledge to figure out how the parsing should happen.

Today, It got way easier !! The PowerShell Team just released a new version of the WMF : v5 September preview ! And One of the coolest feature is the new ConvertFrom-String cmdlet.

EDIT (2014/10/02): See also my post about using ConvertFrom-String and the param -TemplateFile against Netstat.exe

Using the same example from my previous post, I will perform a simple parsing of netstat.exe -n and send the output to ConvertFrom-String.

Important: This post is based on the September 2014 preview release of WMF 5.0. This is pre-release software, so this information may change.

2014/09/01

PowerShell - Sum similar entries from multiple CSV files

One of my script is scheduled to download everyday the proxy logs files from multiple proxies (Approx 1>2GB per file) of the previous day. The second step is to parse each of them and get the top 200 domain names within a specific environment. Finally at the end of the month another script create a report on the monthly internet usage.

I thought this was an interesting exercise even if some tools would probably do a better job ($$$). Also we shouldn't take those results too seriously since some protocols like Ajax or HTML5 talk a lot to the servers, keep refreshing pages even if you are not actively working on them.

In this post, I will talk about the last part of this process and how I combine all those files to get a real monthly top domains.


2014/08/17

PowerShell - Parse this: NetStat.exe

In the last couple of months I had to parse different types of output using PowerShell and I thought it would be a cool idea to explain how this can be done. Command line tool: Netstat.exe

This small tool allows you to display active TCP connections, ports on which the computer is listening, Ethernet statistics, the IP routing table, IPv4 and IPv6 statistics.

In this example I will use the parameter '-n' which displays active TCP connections (without name resolution).