PowerShell - Riptutorial

Transcription

PowerShell#powershell

Table of ContentsAbout1Chapter 1: Getting started with PowerShell2Remarks2Versions2Examples2Installation or Setup2Windows2Other Platforms3Allow scripts stored on your machine to run un-signed3Aliases & Similar Functions4The Pipeline - Using Output from a PowerShell cmdlet5Commenting6Calling .Net Library Methods6Creating Objects7Chapter 2: ActiveDirectory Groups10Computers10Objects10Chapter 3: Chapter 4: Amazon Web Services (AWS) RekognitionIntroduction1515

Examples15Detect Image Labels with AWS Rekognition15Compare Facial Similarity with AWS Rekognition16Chapter 5: Amazon Web Services (AWS) Simple Storage Service (S3)17Introduction17Parameters17Examples17Create a new S3 Bucket17Upload a Local File Into an S3 Bucket17Delete a S3 Bucket18Chapter 6: Anonymize IP (v4 and v6) in text file with Powershell19Introduction19Examples19Anonymize IP address in text fileChapter 7: Archive s21Examples22Compress-Archive with wildcard22Update existing ZIP with Compress-Archive22Extract a Zip with Expand-Archive22Chapter 8: Automatic Variables23Introduction23Syntax23Examples23 pid23Boolean values23 null23 OFS24 / PSItem24

?25 error25Chapter 9: Automatic Variables - part 226Introduction26Remarks26Examples26 PSVersionTableChapter 10: Basic Set ering: Where-Object / where / ?27Ordering: Sort-Object / sort28Grouping: Group-Object / group29Projecting: Select-Object / select29Chapter 11: Built-in variables32Introduction32Examples32 PSScriptRoot32 Args32 PSItem32 ?33 error33Chapter 12: Calculated Properties34Introduction34Examples34Display file size in KB - Calculated PropertiesChapter 13: Cmdlet Naming3435Introduction35Examples35Verbs35Nouns35

Chapter 14: Comment-based help36Introduction36Examples36Function comment-based help36Script comment-based help38Chapter 15: Common parameters41Remarks41Examples41ErrorAction parameter41-ErrorAction Continue41-ErrorAction Ignore41-ErrorAction Inquire42-ErrorAction SilentlyContinue42-ErrorAction Stop42-ErrorAction Suspend43Chapter 16: Communicating with RESTful APIs44Introduction44Examples44Use Slack.com Incoming Webhooks44Post Message to hipChat44Using REST with PowerShell Objects to Get and Put individual data44Using REST with PowerShell Objects to GET and POST many items45Using REST with PowerShell to Delete items45Chapter 17: Conditional logic46Syntax46Remarks46Examples46if, else and else if46Negation47If conditional shorthand47Chapter 18: Creating DSC Class-Based Resources49

Introduction49Remarks49Examples49Create a DSC Resource Skeleton Class49DSC Resource Skeleton with Key Property49DSC Resource with Mandatory Property50DSC Resource with Required Methods50Chapter 19: CSV parsingExamples5252Basic usage of Import-Csv52Import from CSV and cast properties to correct type52Chapter 20: Desired State ConfigurationExamples5454Simple example - Enabling WindowsFeature54Starting DSC (mof) on remote machine54Importing psd1 (data file) into local variable54List available DSC Resources55Importing resources for use in DSC55Chapter 21: Embedding Managed Code (C# VB)56Introduction56Parameters56Remarks56Removing Added types56CSharp and .NET syntax56Examples57C# Example57VB.NET Example57Chapter 22: Enforcing script prerequisites59Syntax59Remarks59Examples59Enforce minimum version of powershell host59

Enforce running the script as admininstratorChapter 23: Environment VariablesExamples596161Windows environment variables are visible as a PS drive called Env:61Instant call of Environment Variables with env:61Chapter 24: Error handling62Introduction62Examples62Error TypesChapter 25: GUI in PowershellExamplesWPF GUI for Get-Service cmdletChapter 26: Handling Secrets and ting for Credentials66Accessing the Plaintext Password66Working with Stored Credentials66Encrypter67The code that uses the stored credentials:67Storing the credentials in Encrypted form and Passing it as parameter when RequiredChapter 27: ating a Hash Table69Access a hash table value by key.69Looping over a hash table70Add a key value pair to an existing hash table70Enumerating through keys and Key-Value Pairs70Remove a key value pair from an existing hash table71

Chapter 28: How to download latest artifact from Artifactory using Powershell script (v2.072Introduction72Examples72Powershell Script for downloading the latest artifcatChapter 29: Infrastructure Automation7273Introduction73Examples73Simple script for black-box integration test of console applicationsChapter 30: Introduction to Pester7374Remarks74Examples74Getting Started with PesterChapter 31: Introduction to Psake7476Syntax76Remarks76Examples76Basic outline76FormatTaskName example76Run Task conditionally77ContinueOnError77Chapter 32: ISE module78Introduction78Examples78Test Scripts78Chapter 33: formance80Examples80

For80Foreach80While81ForEach-Object81Basic usage82Advanced usage82Do83ForEach() Method83Continue84Break84Chapter 34: Modules, Scripts and criptDemoModuleDemoAdvanced FunctionsChapter 35: MongoDB86878788888892Remarks92Examples92MongoDB with C# driver 1.7 using PowerShell92I have 3 sets of array in Powershell92Chapter 36: Naming Conventions94ExamplesFunctionsChapter 37: Operators949495Introduction95Examples95Arithmetic Operators95

Logical Operators95Assignment Operators95Comparison Operators96Redirection Operators96Mixing operand types : the type of the left operand dictates the behavior.97String Manipulation Operators98Chapter 38: Package management99Introduction99Examples99Find a PowerShell module using a pattern99Create the default PowerShell Module Reposity99Find a module by name99Install a Module by name99Uninstall a module my name and version99Update a module by name99Chapter 39: Parameter sets101Introduction101Examples101Simple parameter sets101Parameterset to enforce the use of a parmeter when a other is selected.101Parameter set to limit the combination of parmeters102Chapter 40: PowerShell "Streams"; Debug, Verbose, Warning, Error, Output and Information 103Remarks103Examples103Write-Output103Write Preferences103Chapter 41: PowerShell Background Jobs105Introduction105Remarks105Examples105Basic job creation105Basic job management106

Chapter 42: PowerShell Classes108Introduction108Examples108Methods and properties108Listing available constructors for a class108Constructor overloading110Get All Members of an Instance110Basic Class Template110Inheritance from Parent Class to Child Class111Chapter 43: PowerShell Dynamic Parameters112Examples"Simple" dynamic parameterChapter 44: PowerShell Functions112112114Introduction114Examples114Simple Function with No Parameters114Basic Parameters114Mandatory Parameters115Advanced Function116Parameter teScript118Chapter 45: Powershell Modules120Introduction120Examples120Create a Module Manifest120Simple Module Example120Exporting a Variable from a Module121

Structuring PowerShell Modules121Location of Modules122Module Member Visibility122Chapter 46: Powershell profiles123Remarks123Examples123Create an basic profileChapter 47: Powershell Remoting123125Remarks125Examples125Enabling PowerShell RemotingOnly for non-domain environmentsEnabling Basic Authentication125125125Connecting to a Remote Server via PowerShell126Run commands on a Remote Computer126Remoting serialization warning127Argument Usage128A best practise for automatically cleaning-up PSSessionsChapter 48: powershell sql 0Examples132SQLExample132SQLQuery132Chapter 49: PowerShell mple Workflow Example134Workflow with Input Parameters134

Run Workflow as a Background Job135Add a Parallel Block to a Workflow135Chapter 50: PowerShell.exe Command-Line136Parameters136Examples137Executing a command137-Command string 137-Command { scriptblock }137-Command - (standard input)137Executing a script file138Basic script138Using parameters and arguments138Chapter 51: PSScriptAnalyzer - PowerShell Script yzing scripts with the built-in preset rulesets139Analyzing scripts against every built-in rule140List all built-in rules140Chapter 52: Regular Expressions141Syntax141Examples141Single match141Using the -Match operator141Using Select-String142Using [RegEx]::Match()143Replace143Using -Replace operator143Using [RegEx]::Replace() method144Replace text with dynamic value using a MatchEvalutor144Escape special characters145

Multiple matches145Using Select-String146Using [RegEx]::Matches()146Chapter 53: Return behavior in arly exit148Gotcha! Return in the pipeline148Gotcha! Ignoring unwanted output149Return with a value149How to work with functions returns150Chapter 54: Running ExecutablesExamples152152Console Applications152GUI Applications152Console Streams152Exit Codes153Chapter 55: Scheduled tasks module154Introduction154Examples154Run PowerShell Script in Scheduled TaskChapter 56: Security and CryptographyExamplesCalculating a string's hash codes via .Net CryptographyChapter 57: Sending amples157Simple Send-MailMessage157Send-MailMessage with predefined parameters157

SMTPClient - Mail with .txt file in body messageChapter 58: SharePoint ModuleExamples157159159Loading SharePoint Snap-In159Iterating over all lists of a site collection159Get all installed features on a site collection159Chapter 59: Signing Scripts161Remarks161Execution policies161Examples162Signing a script162Changing the execution policy using Set-ExecutionPolicy162Bypassing execution policy for a single script162Other Execution Policies:163Get the current execution policy163Getting the signature from a signed script164Creating a self-signed code signing certificate for testing164Chapter 60: Special OperatorsExamples165165Array Expression Operator165Call Operation165Dot sourcing operator165Chapter 61: latting parameters166Passing a Switch parameter using Splatting167Piping and Splatting167Splatting From Top Level Function to a Series of Inner Function167Chapter 62: StringsSyntax169169

Remarks169Examples169Creating a basic string169String169Literal string169Format string170Multiline string170Here-string170Here-string170Literal here-string171Concatenating strings171Using variables in a string171Using the operator171Using subexpressions171Special charactersChapter 63: Switch 3Simple Switch173Switch Statement with Regex Parameter173Simple Switch With Break174Switch Statement with Wildcard Parameter174Switch Statement with Exact Parameter175Switch Statement with CaseSensitive Parameter175Switch Statement with File Parameter176Simple Switch with Default Condition176Switch Statement with Expressions177Chapter 64: TCP Communication with PowerShellExamplesTCP listener178178178

TCP SenderChapter 65: URL Encode/Decode178180Remarks180Examples180Quick Start: Encoding180Quick Start: Decoding180Encode Query String with [uri]::EscapeDataString() 181Encode Query String with [System.Web.HttpUtility]::UrlEncode() 182Decode URL with [uri]::UnescapeDataString() 182Decode URL with [System.Web.HttpUtility]::UrlDecode() 184Chapter 66: Using existing static classes187Introduction187Examples187Creating new GUID instantly187Using the .Net Math Class187Adding types188Chapter 67: Using amples189Adding -WhatIf and -Confirm support to your cmdlet189Using ShouldProcess() with one argument189Full Usage Example190Chapter 68: Using the Help System192Remarks192Examples192Updating the Help System192Using Get-Help192Viewing online version of a help topic193Viewing Examples193Viewing the Full Help Page193

Viewing help for a specific parameterChapter 69: Using the progress bar193194Introduction194Examples194Simple use of progress bar194Usage of inner progress bar195Chapter 70: Variables in PowerShell197Introduction197Examples197Simple variable197Removing a variable197Scope197Reading a CmdLet Output198List Assignment of Multiple Variables199Arrays199Adding to an arry200Combining arrays together200Chapter 71: WMI and CIM201Remarks201CIM vs WMI201Additional resources201ExamplesQuerying objects202202List all objects for CIM-class202Using a filter202Using a WQL-query:203Classes and namespaces204List available classes204Search for a class204List classes in a different namespace205List available namespaces206

Chapter 72: Working with ObjectsExamples207207Updating Objects207Adding properties207Removing properties207Creating a new object208Option 1: New-Object208Option 2: Select-Object208Option 3: pscustomobject type accelerator (PSv3 required)209Examining an object209Creating Instances of Generic Classes210Chapter 73: Working with the PowerShell les212Writing Functions with Advanced Lifecycle212Basic Pipeline Support in Functions213Working concept of pipeline214Chapter 74: Working with XML FilesExamples215215Accessing an XML File215Creating an XML Document using XmlWriter()217Adding snippits of XML to current XMLDocument218Sample Data218XML Document218New Data219Templates220Adding the new data220Profit222Improvements222

Credits223

AboutYou can share this PDF with anyone you feel could benefit from it, downloaded the latest versionfrom: powershellIt is an unofficial and free PowerShell ebook created for educational purposes. All the content isextracted from Stack Overflow Documentation, which is written by many hardworking individuals atStack Overflow. It is neither affiliated with Stack Overflow nor official PowerShell.The content is released under Creative Commons BY-SA, and the list of contributors to eachchapter are provided in the credits section at the end of this book. Images may be copyright oftheir respective owners unless otherwise specified. All trademarks and registered trademarks arethe property of their respective company owners.Use the content presented in this book at your own risk; it is not guaranteed to be correct noraccurate, please send your feedback and corrections to info@zzzprojects.comhttps://riptutorial.com/1

Chapter 1: Getting started with PowerShellRemarksWindows PowerShell is a shell and scripting component of the Windows ManagementFramework, an automation/configuration management framework from Microsoft built on the .NETFramework. PowerShell is installed by default on all supported versions of Windows client andserver operating systems since Windows 7 / Windows Server 2008 R2. Powershell can beupdated at any time by downloading a later version of the Windows Management Framework(WMF). The "Alpha" version of PowerShell 6 is cross-platform (Windows, Linux, and OS X) andneeds to be downloaded and installed from this release page.Additional resources: MSDN Documentation: ing/powershellscripting TechNet: d742419.aspxAbout pages PowerShell Gallery: https://www.powershellgallery.com/ MSDN Blog: https://blogs.msdn.microsoft.com/powershell/ Github: https://github.com/powershell Community Site: http://powershell.com/cs/ VersionsVersionIncluded with WindowsNotesRelease Date1.0XP / Server 20082006-11-012.07 / Server 2008 R22009-11-013.08 / Server 20122012-08-014.08.1 / Server 2012 R22013-11-015.010 / Server 2016 Tech Preview2015-12-165.110 Anniversary edition / Server 20162017-01-27ExamplesInstallation or SetupWindowshttps://riptutorial.com/2

PowerShell is included with the Windows Management Framework. Installation and Setup are notrequired on modern versions of Windows.Updates to PowerShell can be accomplished by installing a newer version of the WindowsManagement Framework.Other Platforms"Beta" version of PowerShell 6 can be installed on other platforms. The installation packages areavailable here.For example, PowerShell 6, for Ubuntu 16.04, is published to package repositories for easyinstallation (and updates).To install run the following:# Import the public repository GPG keyscurl https://packages.microsoft.com/keys/microsoft.asc sudo apt-key add # Register the Microsoft Ubuntu repositorycurl /prod.list sudo tee/etc/apt/sources.list.d/microsoft.list# Update apt-getsudo apt-get update# Install PowerShellsudo apt-get install -y powershell# Start PowerShellpowershellAfter registering the Microsoft repository once as superuser, from then on, you just need to usesudo apt-get upgrade powershell to update it. Then just run powershellAllow scripts stored on your machine to run un-signedFor security reasons, PowerShell is set up by default to only allow signed scripts to execute.Executing the following command will allow you to run unsigned scripts (you must run PowerShellas Administrator to do this).Set-ExecutionPolicy RemoteSignedAnother way to run PowerShell scripts is to use Bypass as ExecutionPolicy:powershell.exe -ExecutionPolicy Bypass -File "c:\MyScript.ps1"Or from within your existing PowerShell console or ISE session by running:Set-ExecutionPolicy Bypass Processhttps://riptutorial.com/3

A temporary workaround for execution policy can also be achieved by running the Powershellexecutable and passing any valid policy as -ExecutionPolicy parameter. The policy is in effect onlyduring process' lifetime, so no administrative access to the registry is needed.C:\ powershell -ExecutionPolicy RemoteSignedThere are multiple other policies available, and sites online often encourage you to use SetExecutionPolicy Unrestricted. This policy stays in place until changed, and lowers the systemsecurity stance. This is not advisable. Use of RemoteSigned is recommended because it allowslocally stored and written code, and requires remotely acquired code be signed with a certificatefrom a trusted root.Also, beware that the Execution Policy may be enforced by Group Policy, so that even if the policyis changed to Unrestricted system-wide, Group Policy may revert that setting at its nextenforcement interval (typically 15 minutes). You can see the execution policy set at the variousscopes using Get-ExecutionPolicy -ListTechNet Documentation:Set-ExecutionPolicyabout Execution PoliciesAliases & Similar FunctionsIn PowerShell, there are many ways to achieve the same result. This can be illustrated nicely withthe simple & familiar Hello World example:Using Write-Host:Write-Host "Hello World"Using Write-Output:Write-Output 'Hello world'It's worth noting that although Write-Output & Write-Host both write to the screen there is a subtledifference. Write-Host writes only to stdout (i.e. the console screen), whereas Write-Output writes toboth stdout AND to the output [success] stream allowing for redirection. Redirection (and streamsin general) allow for the output of one command to be directed as input to another includingassignment to a variable. message Write-Output "Hello World" message"Hello World"These similar functions are not aliases, but can produce the same results if one wants to avoid"polluting" the success stream.Write-Outputis aliased to Echo or Writehttps://riptutorial.com/4

Echo 'Hello world'Write 'Hello world'Or, by simply typing 'Hello world'!'Hello world'All of which will result with the expected console outputHello worldAnother example of aliases in PowerShell is the common mapping of both older command promptcommands and BASH commands to PowerShell cmdlets. All of the following produce a directorylisting of the current directory.C:\Windows dirC:\Windows lsC:\Windows Get-ChildItemFinally, you can create your own alias with the Set-Alias cmdlet! As an example let's alisas TestNetConnection, which is essentially the PowerShell equivalent to the command prompt's pingcommand, to "ping".Set-Alias -Name ping -Value Test-NetConnectionNow you can use ping instead of Test-NetConnection! Be aware that if the alias is already in use,you'll overwrite the association.The Alias will be alive, till the session is active. Once you close the session and try to run the aliaswhich you have created in your last session, it will not work. To overcome this issue, you canimport all your aliases from an excel into your session once, before starting your work.The Pipeline - Using Output from a PowerShell cmdletOne of the first questions people have when they begin to use PowerShell for scripting is how tomanipulate the output from a cmdlet to perform another action.The pipeline symbol is used at the end of a cmdlet to take the data it exports and feed it to thenext cmdlet. A simple example is using Select-Object to only show the Name property of a fileshown from Get-ChildItem:Get-ChildItem Select-Object Name#This may be shortened to:gci Select NameMore advanced usage of the pipeline allows us to pipe the output of a cmdlet into a foreach loop:Get-ChildItem ForEach-Object {https://riptutorial.com/5

Copy-Item -Path .FullName -destination C:\NewDirectory\}#This may be shortened to:gci % { Copy .FullName C:\NewDirectory\ }Note that the example above uses the automatic variable. is the short alias of PSItemwhich is an automatic variable which contains the current item in the pipeline.CommentingTo comment on power scripts by prepending the line using the # (hash) symbol# This is a comment in powershellGet-ChildItemYou can also have multi-line comments using # and # at the beginning and end of the commentrespectively. #This is amulti-linecomment# Get-ChildItemCalling .Net Library MethodsStatic .Net library methods can be called from PowerShell by encapsulating the full class name inthird bracket and then calling the method using ::#calling Path.GetFileName()C:\ .exe')explorer.exeStatic methods can be called from the class itself, but calling non-static methods requires aninstance of the .Net class (an object).For example, the AddHours method cannot be called from the System.DateTime class itself. Itrequires an instance of the class :C:\ [System.DateTime]::AddHours(15)Method invocation failed because [System.DateTime] does not contain a method named 'AddHours'.At line:1 char:1 [System.DateTime]::AddHours(15) CategoryInfo: InvalidOperation: (:) [], RuntimeException FullyQualifiedErrorId : MethodNotFoundIn this case, we first create an object, for example :https://riptutorial.com/6

C:\ Object [System.DateTime]::NowThen, we can use methods of that object, even methods which cannot be called directly from theSystem.DateTime class, like the AddHours method :C:\ Object.AddHours(15)Monday 12 September 2016 01:51:19Creating ObjectsThe New-Object cmdlet is used to create an object.# Create a DateTime object and stores the object in variable " var" var New-Object System.DateTime# calling constructor with parameters sr New-Object System.IO.StreamReader -ArgumentList "file path"In many instances, a new object will be created in order to export data or pass it to anothercommandlet. This can be done like so: newObject New-Object -TypeName PSObject -Property @{ComputerName "SERVER1"Role "Interface"Environment "Production"}There are many ways of creating an object. The following method is probably the shortest andfastest way to create a PSCustomObject: newObject [PSCustomObject]@{ComputerName 'SERVER1'Role 'Interface'Environment 'Production'}In case you already have an object, but you only need one or two extra properties, you can simplyadd that property by using Select-Object:Get-ChildItem Select-Object FullName, Name,@{Name 'DateTime'; Expression {Get-Date}},@{Name 'PropertieName'; Expression {'CustomValue'}}All objects can be stored in variables or passed into the pipeline. You could also add these objectsto a collection and then show the results at the end.Collections of objects work well with Export-CSV (and Import-CSV). Each line of the CSV is anobject, each column a property.https://riptutorial.com/7

Format commands convert objects into text stream for display. Avoid using Format-* commandsuntil the final step of any data processing, to maintain the usability of the objects.Read Getting started with PowerShell online: ngstarted-with-powershellhttps://riptutorial.com/8

Chapter 2: ActiveDirectory moduleIntroductionThis topic will introduce you to some of the basic cmdlets used within the Active Directory Modulefor PowerShell, for manipulating Users, Groups, Computers and Objects.RemarksPlease remember that PowerShell's Help System is one of the best resources you can t-ADUser -FullGet-ADGroup -FullGet-ADComputer -FullGet-ADObject -FullAll of the help documentation will provide examples, syntax and parameter help.ExamplesModule#Add the ActiveDirectory Module to current PowerShell SessionImport-Module ActiveDirectoryUsersRetrieve Active Directory UserGet-ADUser -Identity JohnSmithRetrieve All Properties Associated with UserGet-ADUser -Identity JohnSmith -Properties *Retrieve Selected Properties for UserGet-ADUser -Identity JohnSmith -Properties * Select-Object -Property sAMAccountName, Name,MailNew AD UserNew-ADUser -Name "MarySmith" -GivenName "Mary" -Surname "Smith" -DisplayName "MarySmith" -Path"CN Users,DC Domain,DC Local"https://riptutorial.com/9

GroupsRetrieve Active Directory GroupGet-ADGroup -Identity "My-First-Group" #Ensure if group name has space quotes are usedRetrieve All Properties Associated with GroupGet-ADGroup -Identity "My-First-Group" -Properties *Retrieve All Members of a GroupGet-ADGroupMember -Identity "My-First-Group" Select-Object -Property sAMAccountNameGet-ADgroup "MY-First-Group" -Properties Members Select -ExpandProperty MembersAdd AD User to an AD GroupAdd-ADGroupMember -Identity "My-First-Group" -Members "JohnSmith"New AD GroupNew-ADGroup -GroupScope Universal -Name "My-Second-Group"ComputersRetrieve AD ComputerGet-ADComputer -Identity "JohnLaptop"Retrieve All Properties Associated with ComputerGet-ADComputer -Identity "JohnLaptop" -Properties *Retrieve Select Properties of ComputerGet-ADComputer -Identity "JohnLaptop" -Properties * Select-Object -Property Name, EnabledObjectsRetrieve an Active Directory Object#Identity can be ObjectGUID, Distinguished Name or many moreGet-ADObject -Identity "ObjectGUID07898"Move an Active Directory Objecthttps://riptutorial.com/10

Move-ADObject -Identity "CN JohnSmith,OU Users,DC Domain,DC Local" -TargetPath"OU SuperUser,DC Domain,DC Local"Modify an Active Directory ObjectSet-ADObject -Identity "CN My-First-Group,OU Groups,DC Domain,DC local" -Description "This isMy First Object Modification"Read ActiveDirectory module online: vedirectorymodulehttps://riptutorial.com/11

Chapter 3: AliasesRemarksPowershell naming system has quite strict rules of naming cmdlets (Verb-Noun template; see[topic not yet created] for more information). But it is not really convenient to write Get-ChildItemsevery time you want to list files in directory interactively.Therefore Powershell enables using shortcuts - aliases - instead of cmdlet names.You can write ls, dir or gci instead of Get-ChildItem and get the same result. Alias is equivalent toits cmdlet.Some of the common aliases are:aliascmdlet%, foreachFor-EachObject?, whereWhere-Objectcat, gc, typeGet-Contentcd, chdir, slSet-Locationcls, clearClear-Hostcp, copy, cpiCopy-Itemdir/ls/gciGet-ChildItemecho, at-Widegc, nvoke-Itemmv, moveMove-Itemrm, rmdir, del, erase, rd, riRemove-Itemhttps://riptutorial.com/12

aliascmdletsleepStart-Sleepstart, sapsStart-ProcessIn the table above, you can see how aliases enabled simulating commands known from otherenvironments (cmd, bash), hence increased discoverability.ExamplesGet-AliasTo list all aliases and their functions:Get-AliasTo get all aliases for specific cmdlet:PS C:\ get-alias -Definition ame---dir - Get-ChildItemgci - Get-ChildItemls - ---Source------To find aliases by matching:PS C:\ get-alias -Name me---popd - Pop-Locationproc - Get-Processps - Get-Processpushd - Push-Locationpwd - Get-LocationSet-AliasThis cmdlet allows you to create new alternate names for exiting cmdletsPS C:\ Set-Alias -Name proc -Value Get-ProcessPS C:\ tps://riptutorial.com/WS(K) VM(M)----- ----20444 .19CPU(s)-----7.94Id-620SI ProcessName-- ----------1 ApplicationFrameHost13

Keep in mind that any alias you create will be persisted only in current session. When you startnew session you need to create your aliases again. Powershell Profiles (see [topic not yetcreated]) are great for these purposes.Read Aliases online: seshttps://riptutorial.com/14

Chapter 4: Amazon Web Services (AWS)RekognitionIntroductionAmazon Rekognition is a service that makes it easy to add image analysis to your applications.With Rekognition, you can detect objects, scenes, and faces in images. You can also search andcompare faces. Rekognition’s API enables you to quickly add sophistic

Using REST with PowerShell Objects to Get and Put individual data 44 Using REST with PowerShell Objects to GET and POST many items 45 Using REST with PowerShell to Delete items 45 Chapter 17: Conditional logic 46 Syntax 46 Remarks 46 Examples 46 if, else and else if 46 Negation 47 If conditional shorthand 47 Chapter 18: Creating DSC Class-Based .