Posts

Command into Scripts

Image
 .ps1 create a file in visual studio psscript.ps1 and run directly from VS and see the output file in folder. note in bash prompt , youcan call pwsh pscript.ps1 and it does same result, so no need of writing separate one for linux environment.

Powershell Modules

Image
ListModule get Command  Find module Install module import Module PS C:\Windows\system32> get-command -module AzureRM.KeyVault user and access provisioning ,used for sql , new user, membership and many more AD SQL ,create a scrip for local and cloud to query AD and Azure Entile id

PowerShell - Practical Commands

Image
   1. get-process | select-object ProcessName | Sort-Object ProcessName 2. get-process | where {$_.ProcessName -eq "systemd"} //comparison operator 3. $var =  get-process | where {$_.ProcessName -eq "systemd"} // no need to type same command everytime then use variable to store the result and assign into code. in powershell - everything is an object $myVar = "Hello Cloud SME" Set-Variable -Name $myVar -Description " Azure AWS GCP" select everything from that object. Logical Commands Add logic branch and looping to perform continue action until it finish the task. 1. Check Cpu is higher than 10  then print is high load if($myVar.Cpu -gt 20)  {Write-Host " Cpu Load is High")  Top 5 processor using cpu 

Powershell

Image
Why use powershell over other Languages? Special for windows.  Module Supports , Azure, Active Directory, Office 365, Exchange etc Cross platform scripts: Linux and win, it can write in windows and run on linux services for Azure platform. Object oriented pipe - can create own module for team Linux Enviornment : sudo yum install -y powershell Bash / Windows command You can see 100+ of commands used across all platform, windows to cloud, and cloud tools commands it can perform. Where-Object   Uninstall-Package  Set-TimeZone     Register-ScheduledJob    New- AzureStorSimpleNetworkConfig   Get-Certificate  Find-AzureRmResourceGroup Write-Verbose   Test-AzureStaticVNetIP    Stop-AzureSqlDatabaseCopy Update-FormatData    Sync-AppvPublishingServe r  S tart-AzureVM Update-AzureRmRecoveryServicesAsrRecoveryPlan   Connect-AzureRmAccount get-help get-process -Full  or  -Detai...