PowerShell – Command Line – Differences between double-quote and single-quote

Background Want to quickly touch on one of the differences between how PowerShell processes double and single quotes.   Scenario Command Line Double-Quotes Versus Single Quotes Syntax Sample Double Quotes Sample Output Output - Image Output - Text Explanation Issuing the command " pwsh -Command "$PSVersionTable" " returns an empty output   Single Quotes Sample … Continue reading PowerShell – Command Line – Differences between double-quote and single-quote

Powershell Core – Update – Linux – CentOS

Background Recent disclosure from Microsoft shares news of Powershell Core security vulnerabilities. Let us quickly review whether we need to apply the patch to our Linux/CentOS box.   Scope Please keep in mind that the vulnerability does not affect Windows Powershell, but Powershell Core. Windows PowerShell runs only on MS Windows. Powershell Core is multi-OS. … Continue reading Powershell Core – Update – Linux – CentOS

PowerShell – System.Collections.ArrayList – Add versus AddRange

Background Recently, I converted a small Powershell code from using Array to ArrayList. Upon the conversion, the Out-Gridview no longer displayed the actual contents of the collection, but the collection's metadata.   Image Here is a sample of what is displayed:- Image -01 Textual -01 Columns Length LongLength Rank IsReadOnly IsFixedSized IsSynchronized Count   Sample … Continue reading PowerShell – System.Collections.ArrayList – Add versus AddRange

PowerShell:- File System – FileInfo

Background Determining whether a file is empty could involve a few application logic-specific steps or more generic API calls. Here is a sample code in Powershell.   Script Outline Command Line Arguments file Sanitize Variables file If the file is not specified, raise an exception Exception Type:- System.ArgumentNullException If the specified file does not exist, … Continue reading PowerShell:- File System – FileInfo

PowerShell:- File System – Create new file

Background I need to generate data files on a scheduled basis. The file's name should reflect the current time.   Script Outline Command Line Arguments folder filenamePrefix filenameSuffix fileExt fileTemplate Sanitize Variables folder If the folder is not specified, use the current folder Use Get-Location command Sanitize folder Make sure that it is not a … Continue reading PowerShell:- File System – Create new file

Dawson Jarrell, The Remnant Radio – Bible Book of Jeremiah

Videos Prophetic The Remnant Radio Testing the Prophets – Testing the Prophecies Given in 2020 Segments Testing the Prophets – Testing the Prophecies Given in 2020 - Dawson Jarrell Date Published:- 2021-July-1st Date Added:- 2021-July-1st Link Full Testing the Prophets – Testing the Prophecies Given in 2020 Channel:- The Remnant Radio Date Streamed Live:- 2020-December-31st … Continue reading Dawson Jarrell, The Remnant Radio – Bible Book of Jeremiah

WMI – Client – PowerShell & Linux

Background Will like to provide a sample working code for invoking wmic from a Linux box. Our scripting code will be Powershell.   Code Outline Command Line Arguments Targeted hostname using -hostname <target> wmic authentication file using -fileAuthentication <filename> Invoke-Expression Invoke Script using Invoke-Expression Capture Output Parse Captured Output using Operating System ( OS ) … Continue reading WMI – Client – PowerShell & Linux

PowerShell – Command Line – Error – “Cannot process argument transformation on parameter – value of type “System.String” to type “System.Management.Automation.ParameterAttribute”

Background Want to quickly touch on an error that I stumbled upon this morning. Error Error Image Error Text   Code Erroring Code Code Correction Parameter - Property - Mandatory is False Outline For parameter flag Supply property name and value In our case Mandatory is false As we are setting a default value for … Continue reading PowerShell – Command Line – Error – “Cannot process argument transformation on parameter – value of type “System.String” to type “System.Management.Automation.ParameterAttribute”

Windows – Start Administrator Command Shell Window

Background I find myself in a MS Windows Command Shell Window and will like to launch a new command shell window. Because of what I need to do within the new command shell window, I need it to be an Administrator Command Shell.   Here are some ways to bring that about Outline Powershell Start … Continue reading Windows – Start Administrator Command Shell Window

PowerShell – Using Pipeline Functions

Background In its design, Powershell offers a very elegant mechanism for pipeline handling. For instance, often in software development, we will need to process sets. Outline Function :- showFileContent Parameters ValueFromPipeline $filename Declare Local Variables [int] $rc = 0; [string] $filenameFullName = $null; [string] $filenameLeaf = $null; Process Increment script variable $fileNumber ( $script:fileNumber ) … Continue reading PowerShell – Using Pipeline Functions