PShell Intro 5.0
PShell Intro 5.0
Course Transcript
2. What is PowerShell?
PowerShell ISE
1. PowerShell Best Practices
https://library.skillport.com/courseware/Content/cca/os_psws_a01_it_enus/output/html/course_transcript.html 1/22
7/18/2019 Skillsoft Course Transcript
Course Introduction
Learning Objective
After completing this topic, you should be able to
start the course
1.
[Course title: Introduction to PowerShell 5.0.] Windows PowerShell 5.0 offers
powerful features while maintaining the robustness of its predecessors. Hi, I am
Jamie Campbell. [Senior IT Consultant.] And, in this course, I'll cover the
PowerShell environment including version history, the ISE, and differences with
cmd.exe.
https://library.skillport.com/courseware/Content/cca/os_psws_a01_it_enus/output/html/course_transcript.html 2/22
7/18/2019 Skillsoft Course Transcript
What is PowerShell?
Learning Objective
After completing this topic, you should be able to
describe PowerShell and its relationship with the .NET Framework
1.
[Topic title: What is PowerShell? The presenter is Jamie Campbell. PowerShell
Defined.] In this video, I'll introduce you to Windows PowerShell. Windows
PowerShell is similar to the command prompt, but it's much, much more.
PowerShell is an object-based command line interface. And to understand object-
based, you have to first understand how other command line interpreters, like the
Windows command prompt and Linux or Unix shells, work. They're text based, so if
you want to transfer data between commands, you pipe the output from one
command to the next. In PowerShell, data is retrieved as .NET Framework objects,
so it can gather data object properties and methods. It's built into Windows 7 and
Server 2008 and every Windows version since. But you can download it and install
it for earlier versions of Windows.
https://library.skillport.com/courseware/Content/cca/os_psws_a01_it_enus/output/html/course_transcript.html 3/22
7/18/2019 Skillsoft Course Transcript
comes pre-installed in Windows 10. It's also compatible with Windows Server 2016,
Server 2008 R2, Server 2012 and 2012 R2, Windows 7 Service Pack 1, and
Windows 8.1 Pro and Enterprise. PowerShell 5.1 was released on August 2nd,
2016, and was included with specific versions of Windows 10. It was later released
two other versions. [Accessing PowerShell.] To access PowerShell, you can use
the Start screen or the search feature in Windows. And begin typing PowerShell,
which will provide a list of options. PowerShell should be the first result. And you
can click the result or right-click it and choose to run it in different ways. [such as
Run as administrator and Run as a different user.]
https://library.skillport.com/courseware/Content/cca/os_psws_a01_it_enus/output/html/course_transcript.html 4/22
7/18/2019 Skillsoft Course Transcript
1.
[Topic title: The Importance of PowerShell. The presenter is Jamie Campbell.] In
this video, I'll discuss the importance of PowerShell. So why is PowerShell so
important? Well, if I had days to answer that question, it probably wouldn't be
enough. But let's take a look at some of the high-level reasons. First, as of 2016,
Microsoft has made PowerShell an open source. And that makes it more scalable
and better suited to meet the needs of the users. The source code is available
here. [https://github.com/powershell/powershell.] PowerShell 5.0 is installed by
default on Server 2016 and Windows 10. And you can install 5.0 on older versions
of Windows, as long as they're compatible, by downloading and installing the
Windows Management Framework 5.0. Here is the link.
[https://go.microsoft.com/fwlink/?linkid=830436.] PowerShell is widely used and
continues to grow in power and popularity. There are many add-on products based
on PowerShell that can increase, improve, and streamline your control over
systems. But the bottom line is that PowerShell simplifies tasks for Windows
administrators.
Even single lines of code can perform significant tasks in the time it takes to type a
command and press Enter. [More Reasons to Use PowerShell.] Additionally, you'll
find PowerShell in certain Microsoft certifications, Exchange Server exams, for
example. So you'll find many PowerShell related questions. And common Microsoft
GUI's have front ends provisioned by PowerShell. That is, Microsoft products have
incorporated PowerShell with their front-end operations. PowerShell interacts with
more than 100 cmdlets, allowing PowerShell configuration across several aspects
of system configuration and servers, including remote servers. And you can
automate most tasks with PowerShell using scripts that are executed directly from
the PowerShell command line. [Benefits of PowerShell ISE.] The PowerShell
Integrated Scripting Environment 5.0 is also present on systems running
PowerShell. And it's split into three sections to display output and to write scripts.
The ISE's benefits include tab documents to make script editing easier, better copy
and paste management, and easy to use help menu system using F1 for managing
https://library.skillport.com/courseware/Content/cca/os_psws_a01_it_enus/output/html/course_transcript.html 5/22
7/18/2019 Skillsoft Course Transcript
https://library.skillport.com/courseware/Content/cca/os_psws_a01_it_enus/output/html/course_transcript.html 6/22
7/18/2019 Skillsoft Course Transcript
1.
[Topic title: Windows PowerShell vs. cmd.exe. The presenter is Jamie Campbell.] In
this video, I'll discuss the main differences between Windows PowerShell and the
Windows Command Prompt. To those who haven't had experience with PowerShell
yet, it's easy to understand why PowerShell might appear just like a blue version of
the Windows Command Prompt. But digging deeper, many of the Command
Prompt DOS commands are available in PowerShell. And nevertheless, that's
where the similarities end. So let's take a quick look at what differentiates the two.
The Command Prompt has a black background by default, very much resembling
MS-DOS of old. It's a command line interpreter on Windows and Windows-based
operating systems. It's native Windows application that runs in a Win32 console.
And it runs from Windows using the application command cmd.exe.
It predates PowerShell, and has been part of the core Windows system since
Windows 95. Previous versions have had a command line interpreter referred to as
COMMAND.COM or MS-DOS. But eventually, Windows broke away from its
reliance on an underlying DOS-based system. You can create batch files in plain
text with a series of commands saved as batch files using the .bat extension. Then
there's PowerShell. Now, the obvious difference is its default blue background. And
it's made up of both a shell and a scripting language. It's run using powershell.exe
or powershell_ISE.exe for the Integrated Scripting Environment. And PowerShell is
integrated with .NET. It runs commands that are typically referred to as cmdlets
using the .ps1 extension.
https://library.skillport.com/courseware/Content/cca/os_psws_a01_it_enus/output/html/course_transcript.html 7/22
7/18/2019 Skillsoft Course Transcript
https://library.skillport.com/courseware/Content/cca/os_psws_a01_it_enus/output/html/course_transcript.html 8/22
7/18/2019 Skillsoft Course Transcript
1.
[Topic title: Windows PowerShell Version History. The presenter is Jamie
Campbell.] In this video, I'll discuss the Windows PowerShell Version History.
[PowerShell 1.0 + 2.0.] The first PowerShell, PowerShell 1.0, was released in
November 2006. And worked with Windows XP, SP2, and Windows Server 2003,
and Windows Vista. It was an optional feature in Windows Server 2008. PowerShell
2.0 was included with Windows 7 and Windows Server 2008 R2. And was available
as a download for Windows XP Service Pack 3, Windows Server 2003 Service
Pack 2, and Windows Vista Service Pack 1. It offered several new features, such
as Integrated Scripting Environment, eventing, script debugging, a data language,
modules, stepping pipelines, and more. [PowerShell 3.0 + 4.0.] PowerShell 3.0 was
included with Windows 7 Service Pack 1, 8, and Server 2008 R2, Service Pack 1,
and 2012.
And offered several new features, scheduled jobs, improved code scripting,
updates to the help system, and more. PowerShell 4.0 was included with Windows
7 Service Pack 1, 8.1, and Windows 2012 R2, Windows Server 2008 R2, and 2012.
And offered several new features, particularly desired state configuration,
enhanced debugging, network diagnostics, Where and ForEach commands, and
much more. PowerShell 5.0, the most recent major version, was released for
download on February 24, 2016. Its main features include OneGet cmdlets
supporting Chocolatey's RPM, and extending switch layer 2 support. Other features
include class definitions, .NET enumerations, Desired State Configuration,
improvements to Desired State Configuration. Partial configurations, Local
Configuration Manager, meta configurations, runspace debugging remotely.
Debugging background jobs, and management of DSC resources.
https://library.skillport.com/courseware/Content/cca/os_psws_a01_it_enus/output/html/course_transcript.html 9/22
7/18/2019 Skillsoft Course Transcript
1.
[Topic title: Determining your Version of PowerShell. The presenter is Jamie
Campbell.] In this video, I'll demonstrate how you can determine which version of
Windows PowerShell you're running. Now, Windows PowerShell is built into
Windows version 7 onward by default, and it can run previous versions if you install
it. But this is Windows 8.1, so let's go ahead and click on the Start Menu button,
and I'll start typing PowerShell. And as I do, it'll auto-fill, and you'll see right there is
Windows PowerShell. Now I'll right-click that, and then left-click Run as an
administrator. Okay, there's PowerShell. [The Administrator: Windows PowerShell
window opens.] Now, the thing about PowerShell is it's not like other command line
interfaces or CLIs that you might be familiar with. And so in PowerShell, it's not the
ver command, short for version, that you might normally expect in other shells. In
this case, you actually use a string character, [$] and then ps for PowerShell
versiontable.psversion. Okay, so there you go.
We see that we're running major version 4, so PowerShell 4, and there's no minor
version, so that's PowerShell 4.0. Now let's take a look at Windows 10. Okay, I'm
going to switch over here. [He right-clicks and from the shortcut menu, he selects
Windows 10 x64 option.] Okay, so here's Windows 10. Now to run PowerShell in
Windows 10, just click on the Search box, and start typing PowerShell, and you'll
see there it is right there. Once again, I'll right-click it and then left-click Run as an
administrator. And you might get this message. [The User Account Control
message box is displayed. It asks Do you want to allow this app to make changes
to your PC?] Let's go ahead and just click Yes. Okay, so we're in Windows
PowerShell in Windows 10. And the command for checking the version is the
same. So, the string character [$] psversiontable.psversion. And I'll press Enter,
and there you go. So, in Windows 10 by default, you're going to have PowerShell
5.0. So if you've got Windows 10, you don't have to upgrade it, depending on the
version that you have. But here we have 5.0, so we're good to go. So here we have
https://library.skillport.com/courseware/Content/cca/os_psws_a01_it_enus/output/html/course_transcript.html 10/22
7/18/2019 Skillsoft Course Transcript
PowerShell 5.0, and that's great. And that's how you check your PowerShell
version in Windows.
https://library.skillport.com/courseware/Content/cca/os_psws_a01_it_enus/output/html/course_transcript.html 11/22
7/18/2019 Skillsoft Course Transcript
1.
[Topic title: Installing PowerShell 5.1. The presenter is Jamie Campbell.] In this
video, I'll demonstrate how to install the Windows Management Framework 5.1
along with Windows PowerShell 5.1. Okay, now this is Windows Server 2016. So
let's just go ahead and check our version of PowerShell. [He opens the
Administrator: Windows PowerShell window.] The way you do that is with the
$psversiontable.ps. [He executes the $psversiontable.psversion command.] Okay,
so we've got Windows PowerShell 5.1 installed, and the reason I know that is
because we've got the major version 5 and the minor version 1, so that's great. And
that's no surprise because that does come pre-installed or by default included with
Windows Server 2016. But what if you wanted to install it on another version of
Windows, an earlier version? And maybe a non-sever version, so a client version.
So let's take a look at doing this with Windows 8.1. Okay, so in Windows 8.1, I'm
going to click on the Start Menu button, start typing in PowerShell, and there we go,
it's right there.
Now in Windows Server, I didn't need to do this because I was already logged in as
the administrator, but here I'm going to right-click and choose Run as administrator.
[The Administrator: Windows PowerShell window opens.] Now let's go ahead and
check the version, and to do that, $psversiontable.psversion. Okay, so we're using
the Windows Management Framework in PowerShell 4.0, which makes sense
because that's what shipped Windows 8.1. But we want to upgrade that to 5.1, so
I'm going to go to my browser and search for WMF 5.1. And the very first link is the
download link. [He opens the link, https://www.microsoft.com/en-
us/download/details.aspx?id=54616. The Download Center page opens in the
Microsoft web site.] And there's the download button right there. Now, it's very
important that before you download and install, that you make sure that you meet
the system requirements. And here are the various systems [such as Windows
Server 2012 R2, Windows Server 2012, and Windows 8.1.] that work with this
version of the Windows Management Framework. Okay, so here's the download
https://library.skillport.com/courseware/Content/cca/os_psws_a01_it_enus/output/html/course_transcript.html 12/22
7/18/2019 Skillsoft Course Transcript
page and there's the Download button, but before we go ahead and do that, let's
click on System Requirements.
Now this tells us the various operating systems that are supported. It's also
important to note that WMF 5.1 requires Microsoft .NET Framework 4.5. And as a
matter of fact, you should make sure that your Windows 8.1 system is entirely
updated, just to make sure that you don't have any problems during installation. So
just make sure you have that figured out first. And then once you have, go ahead
and click on the Download link. [He clicks the Download button and the Choose the
download you want subpage opens.] Now we're going to choose a version and
these versions vary from this one, [W2K12-KB3191565-x64.msu] which is Windows
2012, that's actually Server 2012. This one [Win7AndW2K8R2-KB3191566-x64.zip]
for Windows 7, and Windows Server 2012, or 2008 R2, rather. This one [Win7-
KB3191566-x86.zip] for Windows 7. This one [Win8.1AndW2K12R2-KB3191564-
x64.msu] for Windows 8.1 and Windows 2012 version R2. And finally, the version
for Windows 8.1. [Win8.1-KB3191564-x86.msu] Now notice that this one is the x86
version. So I'm using 64-bit Windows. So this [Win8.1AndW2K12R2-KB3191564-
x64.msu] is the one I really want, even though it also says Windows Server 2012.
So I'll go ahead and check this one and click Next.
And at this point you choose to open or save. I'm just going to open which means
that it's going to run automatically once I finish downloading it, and then the
download will start. Now keep in mind that once this is done, assuming that your
Windows system is up to date and you've got the .NET Framework 4.5, then
everything will be good to go. Now you also may get this message here [A
message box titled Windows Update Standalone Installer is displayed. The
message is, Do you want to install the following Windows software update? Update
for Windows (KB3191564).] if you haven't actually installed necessary components,
Windows or the Microsoft site might advise you that you have to download certain
things. [He clicks the Yes button. The Download and Install Updates dialog box
opens.] Go ahead and accept the license, and then the update will begin. And that's
it. The rest of it is smooth sailing. Once they're installed, you'll be able to go back
into PowerShell and check the version. And a restart will be required for this
particular operation. But after that, you will have the WMF framework and the
PowerShell versions 4.0 and PowerShell versions 5.1.
https://library.skillport.com/courseware/Content/cca/os_psws_a01_it_enus/output/html/course_transcript.html 13/22
7/18/2019 Skillsoft Course Transcript
1.
[Topic title: New Features in PowerShell 5.0. The presenter is Jamie Campbell.] In
this video, I'll discuss what's new with PowerShell 5.0. So let's talk about various
new features that extend PowerShell 5.0's capability. First, there's extended control
and provision of complex Windows-based environments. It's backwards compatible
with previous versions. And previous functionalities should perform without the
need to rewrite scripts, for example. Object classes now adopt similar syntax as
object oriented language structures. So if you program in Java or C++, for example,
you'll be right at home. And new keywords such as Class and Enum have been
added. The Write-Host cmdlet now defines how PowerShell handles data
information streams and acts as a wrapper for Write-Information. It's also
compatible with workflow activity. [PowerShell OneGet.] OneGet is a new module
that allows you to install packages from Chocolatey. [repository]
https://library.skillport.com/courseware/Content/cca/os_psws_a01_it_enus/output/html/course_transcript.html 14/22
7/18/2019 Skillsoft Course Transcript
1.
[Topic title: PowerShell Best Practices. The presenter is Jamie Campbell.] In this
video, I'll discuss best practices for working with Windows PowerShell. There are
several recommended practices when you're working with PowerShell. And these
are mostly common sense considerations that apply to any coding practices, but
still good to know. First, use proper data validation techniques, meaning you should
validate actions in scripts to ensure the values being passed are accurate. With
regard to error handling, it helps to anticipate errors and write code in a preventive
manner, so as to mitigate the risk of additional issues. Now, this may seem obvious,
but when you're working with any code, it sometimes becomes a secondary
consideration to plan ahead. In PowerShell, you can use messages in a try catch
block to provide information when faults are detected. You should limit the use of
aliases when you're creating large scripts. It's often difficult to track aliases, and you
can use a full cmdlet name to make it easier for others to read your code. Here's a
prime example. In the first line, you can see how aliases may shorten the amount of
typing. But while they simplify the process, oversimplification can make issues
difficult to [The first line is Aliases: ls |?{$_.Name -eq 'john'}|gc.] track when you're
trying to detect issues later on.
https://library.skillport.com/courseware/Content/cca/os_psws_a01_it_enus/output/html/course_transcript.html 15/22
7/18/2019 Skillsoft Course Transcript
other visual cues to identify sections. Everyone knows that messy code is difficult to
read. And unindented and poorly formatted code can make it very difficult to debug.
Common formatting elements such as tabs, spaces, and carriage returns are a
must. And look, this is one where I'm happy to admit that I'm obsessive-compulsive.
There's simply no excuse for poorly formatted code. And it's the first thing that
anyone wanting to code should master. Furthermore, you should use Write-
Verbose and Write-Debug. Using quotes for comments only benefits the user
reading the code, but using Write-Verbose and Write-Debug can assist a user when
they're debugging it. And use single quotes. PowerShell will expect escape
characters in double quotes. And it searches for characters after a string character,
expecting a value if double quotes are used. Single quotes will mitigate this. Finally,
it helps to exercise source control. Version control will assist in managing previous
versions or controlling updates if several changes occur in a short period of time.
And it assists groups of users who are working on specific scripts simultaneously.
Avoid using Hungarian notation. In the past, when VBScript was quite common, it
was common to put type identifiers in front of variables. [such as $strMonitor and
$intCount.] But PowerShell uses a different notation system. [such as
$monitorname and $cp_count.] And this can confuse PowerShell developers,
especially if they're not accustomed to VBScript.
https://library.skillport.com/courseware/Content/cca/os_psws_a01_it_enus/output/html/course_transcript.html 16/22
7/18/2019 Skillsoft Course Transcript
1.
[Topic title: Windows Management Framework (WMF). The presenter is Jamie
Campbell.] In this video, I'll discuss the Windows Management Framework. [WMF
Defined.] So what is the Windows Management Framework, or WMF? Well, it's an
important component for drivers and delivery, and provides a consistent interface
across various versions of Windows and Windows Server. It also provides
compatibility for installing updates to versions, as many as two lower versions,
below the current one. Several Windows features are updated by WMF. The
Windows Management Instrumentation, Windows PowerShell, PowerShell Desired
State Configuration, the PowerShell Integrated Scripting Environment, Windows
Remote Management, PowerShell Web Services, Software Inventory Logging, and
Server Manager CIM Provider. [WMF 5.0.] So what's new with 5.0? Well, it's a
major update to WMF 4.0 that's only available for Windows 7, SP1, and 8.1,
Windows Server 2008 R2, 2012, and 2012 R2.
It's fairly straightforward to install, either through the Command Prompt, the Control
Panel, or as downloaded .msu installers from Microsoft. And it may depend on
Windows type, version, service packs, and KB updates. WMF 5.1 is a minor update
that includes several components included in Windows Server 2016, particularly
PowerShell, WMI, WinRM, and SIL. It's compatible with Windows 7, 8.1, Windows
Server 2008 R2, and 2012 R2. And it offers several improvements to cmdlets,
PowerShellGet, package management support, and additional security
enhancements. To install it, download it from Microsoft based on your version of
Windows. [from command prompt, navigate to download directory. It is also
dependent on the version of Windows. This includes Win8.1AndW2K12R2-
KB3191564-x64.msu /quiet, W2K12-KB3191565-x64.msu /quiet, and Win8.1-
KB3191564-x86.msu /quiet.]
https://library.skillport.com/courseware/Content/cca/os_psws_a01_it_enus/output/html/course_transcript.html 17/22
7/18/2019 Skillsoft Course Transcript
1.
[Topic title: The Windows PowerShell ISE Interface. The presenter is Jamie
Campbell.] In this video I'll introduce you to the PowerShell ISE interface. Okay, I'm
going to click on the Start button, and here you see the Windows PowerShell ISE,
short for Integrated Scripting Environment. Now I'm using Windows Server 2016 so
I don't need to right-click and run it as an administrator. I'm already logged in as the
administrator. But if you're running this from another version of Windows, maybe a
non-server version. You might want to right-click it and then run it as administrator.
Because otherwise things won't work quite the way that you hope they will. [He
opens the Administrator: Windows PowerShell ISE window.] Now when you run the
PowerShell ISE you're going to see this interface. [The interface is divided into two
sections. The first section is the console and the second section is the Commands
tab which is divided into various subsections and buttons.] First we see the actual
console, the PowerShell console here with the flashing cursor. So I can go ahead
and actually start typing in commands just from the command line right there. Now
over on the right-hand side we have our commands window. And the commands
window shows us all the available commands and you can see that there are tons
of them for the ISE. Now this is great because what you can do is you can group by
modules, so if I click on the drop-down here. You can see that we have different
modules, so for example I'll go ahead and click AppLocker.
And what that will do is show me all the various commands that are associated with
the AppLocker module. Let's try something else. [He selects ConfigCI from the
Modules drop-down list.] Okay, so you can see all these different commands which
is really great because this way you can sort of get to exactly what it is you're
looking for. Now I'll go back to All [in the drop-down list.] and then just in the Name
search box type in a command. [He types copy.] It'll show me all the commands or
all the modules that are related to or use copy in the name. Which is great because
what you can do at this point is just click on any of them. And it'll give you a little bit
of help here as to what this particular module does. [He selects Copy-ItemProperty
and a message is displayed, To import the "Microsoft PowerShell Management"
https://library.skillport.com/courseware/Content/cca/os_psws_a01_it_enus/output/html/course_transcript.html 18/22
7/18/2019 Skillsoft Course Transcript
module and its cmdlets, including "Copy-ItemProperty", click Show Details button.]
And if I click on Show Details, [The parameters for "Copy-ItemProperty" section is
displayed.] it'll actually give me even more information. And here you can see we
have all the various parameters that we can use, some of them are fill ins, [such as
Exclude and Filter fields.] and some of them are check boxes. [such as Force
checkbox.] For instance, I just checked on force there to force this particular
command. And you can get to that just by clicking on details.
Now if I click on something else, actually let's go ahead and just get rid of that
altogether, [He backspaces copy in the Name field.] will take us back to the main
interface. So it's a really helpful way of working with PowerShell because
oftentimes you'll want to be able to search for commands and find out what they do.
And once you've actually found that command that you're looking for, for example
I'll just choose something like this, resume. [in the Name field.] And if I click this,
[Resume-BitsTransfer.] down here you have three buttons. Now you can see that
there's a Run button. That's grayed out. We can't actually run this from here. But if I
choose Insert, you'll see that the command has now been inserted into the console.
So that's a really great way of being able to get to that command quickly without
having to type it. I'll backspace, and let's try something else. Resume job. And this
time I'll copy it and click here, [in the main console.] and right-click and Paste. So
you can copy and paste in the console just as easily as using the Insert button.
And that's just sort of a basic overview of the interface in PowerShell ISE. And it's a
really great and clean and useful way of being able to work with this application.
And there's a button right here, [in the standard toolbar.] and I really like this one,
Show Command Window. As long as the cursor is placed on the command, if I click
this you'll see it'll bring up the command panel for this particular command resume-
job. And here we've got a full set of information on all of the various parameters
[such as InstanceParameterSet, JobParameterSet, and FilterParameterSet.] in a
tab format that we can actually enter the information here. And use the check
boxes to actually control this. And again you have these three buttons below, the
Run, Copy, and Cancel. There's a Copy button here that allows you to copy that
information. And you can go ahead and paste it in the console just like you did with
the button over here. But let's go ahead and just cancel that. And there we go. So
you can see that the PowerShell interface is going to be a very, very powerful tool
for being able to execute your scripts. And generate different batch jobs using a
PowerShell environment.
https://library.skillport.com/courseware/Content/cca/os_psws_a01_it_enus/output/html/course_transcript.html 19/22
7/18/2019 Skillsoft Course Transcript
1.
[Topic title: Running cmdlets in the ISE. The presenter is Jamie Campbell.] In this
video, I'll demonstrate how to run cmdlets in the PowerShell ISE. Now, I've got my
C folder here, [in the file explorer window.] and what I'd like to do is just maybe do
something sort of simple with the PowerShell ISE. I'm going to actually create a
new folder. I'll call it new. And see, it's not there right now. [He switches to the
Administrator: Windows PowerShell ISE window.] And to do that, this is a familiar
command, mkdir. [He types mkdir in the Name field in the Commands tab.] You can
see it right there. And if I click that, I'm going to get more detail in the Commands
window. And here in the path part, I can actually type in what I want to call my new
directory or folder. And I'll just call it new. [He types c:\new in the Path text box in
the Parameters for "mkdir" section.] Now, when I click on Insert, it's going to insert
all that code into the PowerShell console. And if I press Enter, you get some
feedback here telling us that a new folder has been created.
[He switches to the file explorer window. The new folder appears.] And you can see
there it is right there. [He switches to the Administrator: Windows PowerShell ISE
window.] Now, let's take a look at something else. So I'll clear the screen with the
cls command. Let's try something different. Let's try remove-item. [He types this in
the Name field.] You can see it right there. [in the subsection where the commands
are displayed.] I'll go ahead and click it. Now, Remove-Item, I'll go ahead and show
the details, works in the opposite. It's a delete command for PowerShell. And what I
want to do is enter the path again, c:\new. Remember, it's still there. [in the file
explorer window.] But I'll go ahead and click Insert [The commands displays in the
console.] and there's the entire command including the path, and I press Enter.
Now, this time we didn't get any feedback. But, if we go and check our folder, you
can see that the new directory is gone. [from the file explorer window.] So it's pretty
straightforward to get your commands into the console without having to type a
whole lot using the PowerShell ISE. And as you can see, it's pretty straightforward,
until you get to start to work with other more complex tasks. But that's just a basic
https://library.skillport.com/courseware/Content/cca/os_psws_a01_it_enus/output/html/course_transcript.html 20/22
7/18/2019 Skillsoft Course Transcript
understanding of how you can get cmdlets and their parameters into the
PowerShell ISE command console.
https://library.skillport.com/courseware/Content/cca/os_psws_a01_it_enus/output/html/course_transcript.html 21/22
7/18/2019 Skillsoft Course Transcript
1.
[Topic title: PowerShell Host Applications . The presenter is Jamie Campbell.] In
this video, I'll discuss PowerShell host applications. [Introduction to Creating a Host
Application.] A PowerShell host application can specify and manage the runspace
where commands are executed. And you execute commands by opening sessions
on a local or remote computer. They're executed either synchronously or
asynchronously. The PowerShell class is used to host PowerShell applications,
provisions methods that create a pipeline of processes. And commands are then
executed in a runspace. A default runspace can be created that will assist with
creating a host application, and a custom runspace can be created if a specific set
of commands need to be executed. [The Process of Creating a Host Application.]
To create a host application, AddCommand is used to add commands to the
pipeline in three main steps.
https://library.skillport.com/courseware/Content/cca/os_psws_a01_it_enus/output/html/course_transcript.html 22/22