Featured

Introduction

This is the post excerpt.

This blog is a personal journey exploring the learning process  for PowerShell  and it’s capabilities for system’s automation. it will be simple at first but hopefully growing. This is not an expert’s blog and certainly it will not be elite or pretentious in anyway or connected directly with Microsoft. it’s simply a personal learning tool.

start a new post

Advertisement

PowerShell Class notes1 – Wednesday May 3, 2017

Practice the exercises, watch the syntax specifics and get time in the shell to develop finger-muscle memory.

To view the Version of PowerShell, from inside the Registry, Use the following path.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine\PowerShellVersion

Obviously you have to launch RegEdit.

 

If only 1 is there, PowerShell 1 is installed.

If 3 is NOT there PowerShell 1 or 2 may be installed.

 

Within the CLI, use the PowerShell Automatic Variable$PSVersionTable”,

to get a simple table of the Version of PowerShell.

 

We can also use the Cmdlet: Get-Host. But keep in mind this gives the version of the host running the PowerShell Environment which can be different than the version of PowerShell running.

But if you are running local only (same machine) this will give you an accurate Version.

 

From Windows 7 and beyond, there are two paths for launching ISE and the CLI (the editor or shell)

One path is for 64 bit, the other for 32-bit engines respectively.  It is recommended to stay on the 64-bit

Engine….  Notice the difference in the path – System32 and SysWoW64

So Why is the 64-bit engine associated with System32 and…

Why is the 32-bit Engine associated with SysWoW64  ( Windows on Windows) ???? Seems reversed!!

 

64-bit:

“C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe”

“C:\Windows\System32\WindowsPowerShell\v1.0\powershell_ise.exe”

 

Can Put icons on the desktop or launch from the main startup menu.

 

32-bit:

“C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe”

“C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell_ise.exe”

 

Only one Version of PowerShell is allowed on one machine.

 

Microsoft updates for PowerShell are MSU files and beyond version 1, have been related to the “Microsoft Management Framework” (WMF) the current one being 5.1.

This is applicable for updating the PowerShell Engine, on Windows 7 machines.

https://www.microsoft.com/en-us/download/details.aspx?id=54616

 

PowerShell Cmdlets use the form of a Verb-Noun structure.

We Can use the Get-Help command to explore this.

 

ISE – has a section for managing Themes to change the display a little.

PowerShell has multiple hosts – the CLI and ISE – but there are also third party hosts.

PowerShell Plus:

Idera: https://www.idera.com/productssolutions/freetools/powershellplus

Dell – PowerGUI  ( if you can find it)

https://support.quest.com/technical-documents/powergui/3.8/user-guide/17#TOPIC-144273

The Microsoft RSAT Tools also have an Outlook host with special PowerShell Cmdlets.

 

The PowerShell host by default does not come up with elevated permissions.

Run-As Administrator when required. (Right-Click the icon)

Change the UAC if need be. The PowerShell host can be changed to run in administrator mode

Permanently by Right-Clicking the icon – pick Properties – pick shortcut TAB – pick advanced button and click on the “Run as administrator” check-mark-box.

 

We also discussed how to run PS1 script files from the command line.

The method used is by navigating to the desired script folder and

From the CLI use the structure:    .\<Cmdlet name>   

(Can use the Right-Click “Copy as Path”, option, inside of Windows Explorer)

 

Remember, how some DOS Batch Language commands, the CMD, (but not all) can be used within the PowerShell CLI.  For example, such CMD commands: as Dir, CD and Ipconfig Etc.

This dove tails into discussions about the Alias terms in PowerShell for Cmdlets.

Use Get-Alias and Get-Help to explore listings of such command aliases.

 

Please Read and Review Chapter 1 of our Text Book –

N:\deploy\Team 3\PS-Review\eBooks\PowerShell Automating Administrative Tasks.pdf

 

Please Read and Review some of the Get-Help About_*,  topics inside the PowerShell CLI.

 

Please Explore the Cmdlets

Get-Help

Get-Command

Get-Verb

Get-Member

Get-Service

Get-PSDrive  ( We will discuss the last three further,  in our next meeting)

 

 

…by the way, a common mistake when starting out, is to use the plural for a noun in a Cmdlet.

Don’t make that mistake. All Nouns are Singular.

Example:

Get-Verb  NOT Get-Verbs ( I have done it multiple times)