Powershell Tricks And Simple Problems With Regex -matches

I wasted almost two hours on this today. The goal was simply to create a function to pull out a 5 digit zip code from a string. Three Powershell lessons learned : 1) using -match will return an additional $true/$false from a function unless you “swallow” the value into a variable.  http://stackoverflow.com/questions/27193956/extracting-data-from-the-matches-hashtable-after-a-powershell-regeg-match 2) return doesn’t […]

Powershell Script (Scheduled Task) to Monitor Windows Services

Powershell Code: # # LUNAR DUST – home grown server/service monitor – sends out email when services defined in related .CSV config file are down # Author: Neal Walters – Nov 2013 # (Lunar Dust is a play on words of the monitor name "Solar Wind") # [string[]] $users = "john@abc.com",'"fred@abc.com" # List of users […]

Powershell Grid-View

get-service | where {$_.name -match "win"} Normally displays like this: Note how very long names can get cut off with the ellipses…. Did you know that Powershell has a “grid-view”, similar to SQL? get-service | where {$_.name -match "win"} | out-gridview If you pipe all get-service to the out-gridview, then you can see how you […]

Manipulating BizTalk Services with Powershell

This is basically a follow-up to the previous post How to add a where filter match/contains/like to any powershell cmdlet (such as Get-Service) Cmdlets are named in the format “verb-noun”, for example get-service, start-service, etc… Suppose you cannot remember all the verbs associated with a noun. You can run this: get-command -Noun process Recall from […]

How to show full name without ellipsis (…) in a Powershell Query

Sometimes, when property names contain very long values, the default displays cuts part of the name, as shown with this command and its output. [“ellipsis” is the term for the … when a name is truncated] as shown in the example below: get-service | where {$_.name -match "win"}  | sort-object Status -desc   Simply pipe the […]

How to add a “where” filter match/contains/like clause to any Powershell cmdlet (such as Get-Service)

get-process  |  {$_.name -match "win"} Sample output is shown below. The above means “get all the process objects on this computer” and pipe that collection of objects to a where/filter where we only want to see processNames that contain the letters “host”. Example output: Handles  NPM(K)    PM(K)      WS(K) VM(M)   CPU(s)     Id ProcessName ——-  ——    —–      —– —–   ——     — ———–      75       8      796       […]

Powershell to Monitor Disk Space

The purpose of this script is to monitor disk space on a list of servers. Right now, it uses a hard-coded 20% as the point at which to send the email (look for variable $thresholdspace in the code below). An enhancement could be to have different percents on each server. The script reads a file […]

Explain BizTalk to your wife, kids, family, and friends

Maybe a VP at works ask you “What is BizTalk”?  Can you give him a quick answer? As a Dallas BizTalk Consultant, do you have a hard time explaining what you do for a living to your family and friends? Maybe this video will help.  Using the Parker Brothers game called “Watersworks Leaky Pipe Card […]

Powershell to Monitor and Email Windows EventLog Errors

You can set this up in Task Scheduler to run every x minutes and send you an email when there are any errors in the Application Event Log or the System Event Log. There is a section in the code where you can create more user-friendly messages for complex or confusing error messages. It also […]

BizTalk and .NET Ambient Transactions

One day, I hope to be able to fully understand and explain the “Ambient Transaction” true/false option in BizTalk WCF-SQL and WCF-Custom send and receive ports.  Until then, I’m going to collect the most relevant info and blogs here: The official Microsoft BizTalk parameter definition (for the WCF Send or Receive Port): http://msdn.microsoft.com/en-us/library/dd787981.aspx Specifies whether […]