Powershell:- Get-NetTCPConnection – Error – “No MSFT_NetTCPConnection objects found with property”

Background Dealing with them insomnia nights and you run into a trouble. And, you say I have other problems, I will come back and deal with this in the morning.   Get-NetTCPConnection Base To get a quick list of TCP Connections, you issue "Get-NetTCPConnection" Command Sample Output Image   SQL Server ( TCP Port 1433 … Continue reading Powershell:- Get-NetTCPConnection – Error – “No MSFT_NetTCPConnection objects found with property”

PowerShell:- Out-GridView -PassThru | Set-Clipboard

Background Yesterday, I found myself struggling with a database project. I thought let me capture some metadata, view it in a grid view and I will have more to go with.   Clipboard Captured the data into a data table, pipelined it into GridView. Got a good thing going. As always got greedy. Thought to … Continue reading PowerShell:- Out-GridView -PassThru | Set-Clipboard

PowerShell:- Write-Verbose

Background Let us take a quick look at PowerShell's Write-Verbose command.   Samples Outline In this post we have a couple of sample PowerShell Scripts. Sample -01 Add two numbers Display result of adding the numbers Sample -02 Added write-verbose to enable verbose code logging Sample -03 Added [CmdletBinding()] to enable "cmdlet-style parameter binding"   … Continue reading PowerShell:- Write-Verbose

PowerShell:- Single Quotes Versus Double Quotes – Day 01

Background This morning I ran into a PowerShell problem that was a little harder than I will like to admit. It had to do with a string that contains special characters.   Script Code   Output   Explanation Here is how our variable ( $myName ) is treated Double Quotes - Un-escaped Our variable ( … Continue reading PowerShell:- Single Quotes Versus Double Quotes – Day 01

PowerShell:- List – Sorting

Background Imagine it is mother's day and we need to fetch our Mother of the Church. Yes, just do a simple select against your congregation table. But, was exploring something similar in PowerShell. Here is what our code line looks like.   Script   Outline Class Create a simple class structure In our case we … Continue reading PowerShell:- List – Sorting

PowerShell:- Datatype – Array – Declaration & Initialization – Bug ? – Patrick Meinecke Response

Background A quick feedback on our last post.   Referenced Work PowerShell:- Datatype – Array – Declaration & Initialization Link Source Code Control GitLab PowerShell - Array - Declaration & Initialization - Sample - nameList Link Bug Report Microsoft PowerShell An Uninitialized declared array leads to string concatenation #17313 Link Feedback Patrick Meinecke ( SeeminglyScience … Continue reading PowerShell:- Datatype – Array – Declaration & Initialization – Bug ? – Patrick Meinecke Response

PowerShell:- Datatype – Array – Declaration & Initialization

Background In this post let us consider how to declare, initialize, populate, and iterate an array. Introduction We have a few avenues for declaring an Array in PowerShell. Our options are:- PowerShell @() String Array .Net System.Collections.ArrayList Script Outline Array Declare Array Declare And Initialized An Array [string[]]$nameListInitialized = $null; Declare An Array [string[]]$nameListInitialized; Populate … Continue reading PowerShell:- Datatype – Array – Declaration & Initialization

Powershell:- Function – Invocation – Error – ParameterArgumentTransformationError

Background Last evening I wanted to make a function out of a piece of Powershell Code Block, but ran into an error. Let us quickly go over the error.   Script Code   Error Error - Image Error - Text Error - Explanation The error reads:- Cannot process argument transformation on parameter 'ch'. Cannot convert … Continue reading Powershell:- Function – Invocation – Error – ParameterArgumentTransformationError

Powershell:- Get Machine Name

Background I needed to confirm a machine name. It is easy to do so via accessing the machine and running a few system commands. But, want to do so programmatically, as well. Choices Here are some of the options for getting a machine name in PowerShell. Get Computer Name Using Environment Variables .Net Class System.Environment … Continue reading Powershell:- Get Machine Name

Programming Languages:- Repeat Characters

Background When programming one will have to use various datatypes and consult API for each of the data types.   DataTypes Number/Integer Arithmetic String Concatenation Length Character Repeat   Character For instance, if we will like to place an underline against a title, we will get the length of the title, and repeat the underline … Continue reading Programming Languages:- Repeat Characters