Geek Culture
Published in

Geek Culture

Photo by Caspar Camille Rubin on Unsplash

Developing using PowerShell

Modules

Module directory structure

Common Utility

$configData = New-Object -TypeName PSCustomObject -argumentlist (Get-Content -Raw -Path $ConfigFile | ConvertFrom-Json)

Scripts

Function BootStrap {
[CmdletBinding()]
[OutputType([PSCustomObject])]
Param([string[]] $ModulesToLoad, [string] $ConfigFile, [string] $ConfigToLoad, [string] $LogLevel, [string] $LogType)

If (!(Get-Module Sample.Common-Utils)) {
Import-Module Sample.Common-Utils -Force -ErrorAction Stop
}

$LASTEXITCODE = 1
$SCRIPT_PATH= Split-Path (Resolve-Path $myInvocation.MyCommand.Path)
./$SCRIPT_PATH\bootStrap.ps1
# This line allows passing all command line parameters to bootstrap function
$BootstrapParameters =$PSBoundParameters
$loadModuleList = “Sample.Common-Utils”,”Sample.Az-Utils”
$BootstrapParameters.Add(‘ModulesToLoad’, $loadModuleList)
$ConfigData = BootStrap @BootStrapParameters
# continued code for script

--

--

--

A new tech publication by Start it up (https://medium.com/swlh).

Recommended from Medium

Working with Firebase Storage in Android: Part 1

Using Automation to Better Manage Secrets

SQL Notes: Not Boring Movies

Hibernate Issues Series : RollbackException

Slash Business Software Expenditure with this 5-Step Strategy

@Bluzelle and @cerenetwork partners to Expand Data Ecosystem in both database and data cloud spaces.

Book Review: Working effectively with legacy code

Apache Thrift in action(php edition)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Shekhar Jha

Shekhar Jha

My current focus is cloud security. I have worked in identity and access domain and have experience running infrastructure for a small company.

More from Medium

Three main components in Docker development

Getting Started with Docker

Commonly used Github commands

SSH, PuTTy: Secure Connection to Remote Server

SSH