The full guide of PowerShell that any developer needs to know – Cmdlet


The full guide of PowerShell that any developer needs to know – Index

In PowerShell (PS) a cmdlet is a process that created to execute code.

PS already has cmdlets created to execute common specific functionalities and PS users can also create their own (this cmdlets are created with .NET framework).

All cmdlets are named with a verb-noun expression like Get-Date (a common cmdlet to get current date). If you want to get the script source code you can execute:

(Get-Command Get-Date). DLL  (to get cmdlet dll source)
(Get-Command Get-Date). ImplementingType (to get cmdlet type in dll)
Then you need to open the DLL with ILSpy and look for ImplementingType command name resulted.

But this is in case on core cmdlet in the current PS version. Usually the PS users create your own cmdlet creating the script and save it with “.ps1” extension and then you can execute this cmdlet from the file importing as a cmdlet. Exists a lot of cmdlet repositories in the web for common functions or especific functionallity for particular software. But is very common that .NET developers build their own cmdlet in C# language.

PS is based on Microsoft .NET framework, so PS brings more powerful features than a simple script or command-line command. All cmdlets returns an object, so you can pass a cmdlet as a parameter or use a cmdlet result as part of a new cmdlet (pipelining) on PS,  for example:

Get-ChildItem | ForEach-Object {
Copy-Item -Path $_.FullName -destination $NewFolder;
}

(cmdlets in blue)

And look at red characters, this is a current object alias returned by loop cmdlet ForEach-Object

(we will see later in another chapter)

The full guide of PowerShell that any developer needs to know – Index

About the author:

Matías Creimerman

Matías Creimerman
I’m a specialist in design, development and management of software solutions with almost 20 years of experience. Microsoft Certificated Professional (MCP). Expert in dot net and Microsoft technologies. Experience and skills in designing solutions in a wide range of commercial, industrial and production areas. Design of architectures, software applications and processes. Skills in leadership and team management. Tech trainer. Technology researcher. Self-taught and dedicated to continuous learning. Skills in estimation, quotation, projects proposals and solutions design. Entrepreneurial spirit. Strong Tech profile but also customer oriented. I perform roles as fullstack dev, tech consultant, technical referent, development leader, team leader, architect, cross leader, tech manager, tech director, trainer, ramp-up & follow-up teams, software factory manager, DevOps and release manager. Regular chess player and musician.

Professional Website

In

Blogger

Github

About Me

Portfolio

Wordpress - Arquitectura y desarrollo de software

Wordpress - Personal Blog

Microsoft - Youracclaim Badges

Microsoft - Tech Profile

Microsoft - ASP.NET Forum

tw
Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License
Creative Commons License
This content is property of Matias Creimerman Any misuse of this material will be punishable
This work is licensed under a International Copyright Law protects “original works of authorship”
including photographs, videos, and blog posts posted on social media sites
The content has no rights to be shared without authorization or citation to the author.
This content cannot be sold be adapted or modified partially or totally.
All content shared outside this blog that doesn’t belong to the author must have citations to the author.

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión /  Cambiar )

Google photo

Estás comentando usando tu cuenta de Google. Cerrar sesión /  Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión /  Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión /  Cambiar )

Conectando a %s